bxs-tools-ui 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bxs-tools-ui",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "微易前端业务组件",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -212,7 +212,7 @@ export function initElementValidateRules(ele : IInsElement, productData? : IPbPr
212
212
  if (insurance2 && insurance2.eleOrderList) {
213
213
  insTitle2 = insurance2.eleOrderList.find(e => e.key === 'title');
214
214
  if (insTitle2 && insTitle2.value) {
215
- itemValue2 = insurance2.eleOrderList.find(e => e.key === item1[2]);
215
+ itemValue2 = insurance2.eleOrderList.find(e => e.key === item2[2]);
216
216
  }
217
217
  }
218
218
  if (itemValue1 && itemValue1.value && itemValue2 && itemValue2.value && ele.compareItem[1]) {
@@ -721,6 +721,13 @@ export function restrictInsurancesInProduct({
721
721
  }
722
722
  }
723
723
  });
724
+ if (!(curEle.isHide && !curEle.isDisabled) && curEle.opts) {
725
+ const validOptions = curEle.opts.filter(o => !o.isDisabled && !o.isHide && !o.isInvalid)
726
+ const activeOption = validOptions.find(o => o.val === curEle.value)
727
+ if (!activeOption && validOptions.length) {
728
+ curEle.value = validOptions[0].val
729
+ }
730
+ }
724
731
  }
725
732
  break;
726
733
  }
@@ -37,7 +37,7 @@
37
37
  :disabled="ele.isDisabled"
38
38
  :huomian-tag="getInsuranceTitleHmTag(ins)"
39
39
  :huomian-tips="!!$listeners.openCrmPerson && getHuomianTips(ins, ele)"
40
- @change="change({ insData: ins, eleData: ele, type: 'change' })"
40
+ @change="onChange({ insData: ins, eleData: ele })"
41
41
  @openCrmPerson="$emit('openCrmPerson')"
42
42
  />
43
43
  </bxs-form-item>
@@ -77,7 +77,7 @@
77
77
  "
78
78
  @blur="activeInputKey = ''"
79
79
  @input="numberUnitStr = getAmountUnit(ele)"
80
- @change="change({ insData: ins, eleData: ele, type: 'change' })"
80
+ @change="onChange({ insData: ins, eleData: ele })"
81
81
  @click-icon="onClickIcon(`id_${ins.key}_${ele.key}`)"
82
82
  />
83
83
  <div v-if="activeInputKey === ins.key + ele.key && numberUnitStr" class="bxt-ins-unit-tips">
@@ -110,9 +110,9 @@
110
110
  <bxs-radio-group
111
111
  v-model="ele.value"
112
112
  :disabled="ele.isDisabled"
113
- @change="change({ insData: ins, eleData: ele, type: 'change' })"
113
+ @change="onChange({ insData: ins, eleData: ele })"
114
114
  >
115
- <template v-for="opt in ele.opts">
115
+ <template v-for="opt in ele.opts.filter(o => !o.isHide && !o.isDisabled && !o.isInvalid)">
116
116
  <bxs-radio
117
117
  :key="opt.val"
118
118
  type="button"
@@ -139,7 +139,7 @@
139
139
  <bxs-radio-group
140
140
  v-model="ele.value"
141
141
  :disabled="ele.isDisabled"
142
- @change="change({ insData: ins, eleData: ele, type: 'change' })"
142
+ @change="onChange({ insData: ins, eleData: ele })"
143
143
  >
144
144
  <template v-for="opt in ele.opts">
145
145
  <bxs-radio
@@ -185,7 +185,7 @@
185
185
  :options="ele.opts.filter(o => !o.isHide && !o.isDisabled && !o.isInvalid)"
186
186
  :disabled="isDisabled(ele)"
187
187
  :right-icon="isDisabled(ele) ? '' : 'arrow-right'"
188
- @change="change({ insData: ins, eleData: ele, type: 'change' })"
188
+ @change="onChange({ insData: ins, eleData: ele })"
189
189
  />
190
190
  </bxs-form-item>
191
191
  </template>
@@ -200,6 +200,7 @@
200
200
  <script lang="ts">
201
201
  import Vue from 'vue';
202
202
  import { Component, Prop } from 'vue-property-decorator';
203
+ import { get as _get } from 'lodash';
203
204
  import {
204
205
  productDataHandler,
205
206
  verifyProductRules,
@@ -313,41 +314,46 @@ export default class BxtProductInfo extends Vue {
313
314
  }
314
315
 
315
316
  created() {
316
- this.change({
317
- ins: null,
318
- ele: null,
319
- type: 'init'
320
- });
317
+ this.init();
321
318
  }
322
- change(options) {
323
- const self = this;
324
- if (!options.eleData || !['title'].includes(options.eleData.key)) {
325
- self.requiestRecommendValues();
326
- }
327
- if (options.type === 'change') {
328
- self.$nextTick(() => {
329
- self.$emit(
330
- 'change',
331
- self.productData,
332
- {
333
- ...options,
334
- errorMsg: self.changeProduct(self.productData, options)
335
- },
336
- this
337
- );
338
- });
339
- return;
340
- }
341
- self.$emit(
319
+ init() {
320
+ this.requiestRecommendValues();
321
+ this.$emit(
342
322
  'change',
343
- self.productData,
323
+ this.productData,
344
324
  {
345
- ...options,
346
- errorMsg: self.changeProduct(self.productData, options)
325
+ errorMsg: this.changeProduct(this.productData, {})
347
326
  },
348
327
  this
349
328
  );
350
329
  }
330
+ onChange(options: any = {}) {
331
+ options.type = 'change';
332
+ const { type, insData, eleData } = options;
333
+ if (!['title'].includes(eleData.key)) {
334
+ this.requiestRecommendValues();
335
+ }
336
+ setTimeout(() => {
337
+ const refInsuranceForm: any = _get(this.$refs, `insuranceForm${insData.key}[0]`);
338
+ if (refInsuranceForm) {
339
+ console.log(this.productForm[insData.key]);
340
+ refInsuranceForm.validate(eleData.key);
341
+ }
342
+ }, 300);
343
+ this.$nextTick(() => {
344
+ this.$emit(
345
+ 'change',
346
+ this.productData,
347
+ {
348
+ type,
349
+ insData,
350
+ eleData,
351
+ errorMsg: this.changeProduct(this.productData, options)
352
+ },
353
+ this
354
+ );
355
+ });
356
+ }
351
357
  onClickIcon(id) {
352
358
  const inputDom: any = document.querySelector(`#${id}`);
353
359
  inputDom.focus();
@@ -445,16 +451,22 @@ export default class BxtProductInfo extends Vue {
445
451
  }
446
452
  }
447
453
  async validate() {
448
- let insKeys: any = this.filterInsuranceList.map(ins => ins.key);
449
- let validateInfo: any = [];
450
- for (let k of insKeys) {
451
- let info = await this.$refs[`insuranceForm${k}`][0].validate();
452
- validateInfo.push(info);
453
- }
454
- if (validateInfo.some(p => !!p)) {
455
- return Promise.reject(validateInfo);
456
- }
457
- return Promise.resolve(validateInfo);
454
+ const { $refs, filterInsuranceList } = this;
455
+ const insKeys: any = filterInsuranceList.map(ins => ins.key);
456
+ return new Promise((resolve, reject) => {
457
+ setTimeout(() => {
458
+ const promises = [];
459
+ for (const k of insKeys) {
460
+ const _ref = _get($refs, `insuranceForm${k}[0]`);
461
+ if (_ref) {
462
+ promises.push(_ref?.validate());
463
+ }
464
+ }
465
+ Promise.all(promises)
466
+ .then(() => resolve([]))
467
+ .catch(error => reject(error));
468
+ }, 200);
469
+ });
458
470
  }
459
471
  closeKeyBoard() {
460
472
  const activeElement: any = document.activeElement;
@@ -526,10 +538,9 @@ export default class BxtProductInfo extends Vue {
526
538
  onClickRecommendValue(value, ins, ele) {
527
539
  const self = this;
528
540
  ele.value = value;
529
- self.change({
541
+ self.onChange({
530
542
  insData: ins,
531
- eleData: ele,
532
- type: 'change'
543
+ eleData: ele
533
544
  });
534
545
 
535
546
  self.$nextTick(() => {