bri-components 1.4.39 → 1.4.41

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": "bri-components",
3
- "version": "1.4.39",
3
+ "version": "1.4.41",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -203,6 +203,7 @@
203
203
  // 参数event
204
204
  onChange (event) {
205
205
  this.quickChange(); // 立马触发
206
+
206
207
  clearTimeout(this.timer);
207
208
  this.timer = setTimeout(() => {
208
209
  this.change();
@@ -17,6 +17,7 @@
17
17
  :span="formItem._br ? 24 : (formItem._span || 24)"
18
18
  >
19
19
  <FormItem
20
+ v-if="hideMap[formItem._key] !== true"
20
21
  class="DshForm-item-FormItem"
21
22
  :prop="formItem._key"
22
23
  @click.native="clickControl(formItem)"
@@ -192,6 +193,7 @@
192
193
  data () {
193
194
  return {
194
195
  rules: {},
196
+ hideMap: {},
195
197
  errorObj: {
196
198
  errors: []
197
199
  },
@@ -277,6 +279,17 @@
277
279
 
278
280
  return bool;
279
281
  },
282
+ // 强制校验,动态校验切换时-单选多选的校验文字无法消失
283
+ forceValidateField (formItem) {
284
+ if (["select", "checkbox"].includes(formItem._type) && !this.rules[formItem._key].length) {
285
+ this.$set(this.hideMap, formItem._key, true);
286
+ this.$nextTick(() => {
287
+ this.$set(this.hideMap, formItem._key, false);
288
+ });
289
+ } else {
290
+ this.$refs.form.validateField(formItem._key);
291
+ }
292
+ },
280
293
 
281
294
  // 控件自己的校验
282
295
  selfValidate (cb) {
@@ -275,18 +275,20 @@ export default {
275
275
  });
276
276
  },
277
277
  quickChangeVal (operationItem, row, rowIndex, column, params) {
278
- this.$set(this.ruleRecordMap, this.getMixKey(row, column), { showRuleMessage: true });
279
- this.dealSameRowsVal({ row, rowIndex, column });
278
+ if (this.isUseQuickChange({ row, rowIndex, column })) {
279
+ this.$set(this.ruleRecordMap, this.getMixKey(row, column), { showRuleMessage: true });
280
+ this.dealSameRowsVal({ row, rowIndex, column });
280
281
 
281
- this.change("quickChangeVal", row, rowIndex, column, ...params);
282
+ this.change("quickChangeVal", row, rowIndex, column, ...params);
283
+ }
282
284
  },
283
285
  changeVal (operationItem, row, rowIndex, column, params) {
284
- this.$set(this.ruleRecordMap, this.getMixKey(row, column), { showRuleMessage: true });
285
- if (!["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._key)) {
286
+ if (!this.isUseQuickChange({ row, rowIndex, column })) {
287
+ this.$set(this.ruleRecordMap, this.getMixKey(row, column), { showRuleMessage: true });
286
288
  this.dealSameRowsVal({ row, rowIndex, column });
287
- }
288
289
 
289
- this.change("changeVal", row, rowIndex, column, ...params);
290
+ this.change("changeVal", row, rowIndex, column, ...params);
291
+ }
290
292
  },
291
293
 
292
294
  /* ----------- 方法 ---------- */
@@ -337,15 +339,19 @@ export default {
337
339
 
338
340
  return rowspan;
339
341
  },
342
+ // 是都满足使用quickChange
343
+ isUseQuickChange ({ row, rowIndex, column }) {
344
+ return ["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type) &&
345
+ this.mergeRowColKeys.includes(column._key) &&
346
+ this.rowspanMap[this.getMixKey(row, column)] > 1;
347
+ },
340
348
  // 合并单元格的行,某列的值全部跟着修改
341
349
  dealSameRowsVal ({ row, rowIndex, column }, list = this.allListData) {
342
- if (this.mergeRowColKeys.includes(column._key) && this.rowspanMap[this.getMixKey(row, column)] > 1) {
343
- const indexInAll = list.findIndex(dataItem => dataItem._id === row._id);
344
- list.slice(indexInAll + 1, indexInAll + this.rowspanMap[this.getMixKey(row, column)])
345
- .forEach(rowItem => {
346
- rowItem[column._key] = this.$deepCopy(row[column._key]);
347
- });
348
- }
350
+ const indexInAll = list.findIndex(dataItem => dataItem._id === row._id);
351
+ list.slice(indexInAll + 1, indexInAll + this.rowspanMap[this.getMixKey(row, column)])
352
+ .forEach(rowItem => {
353
+ rowItem[column._key] = this.$deepCopy(row[column._key]);
354
+ });
349
355
  }
350
356
  }
351
357
  };
@@ -813,8 +813,7 @@ export default {
813
813
  },
814
814
  // 输入框值改变立即
815
815
  quickChangeVal (operationItem, row, rowIndex, column, params) {
816
- this.$set(this.ruleRecordMap, this.getMixKey(row, column), { showRuleMessage: true });
817
- this.change("quickChangeVal", row, rowIndex, column, ...params);
816
+ // 啥也不做,平级表格合并单元格时用这个方法
818
817
  },
819
818
  // 输入框值改变
820
819
  changeVal (operationItem, row, rowIndex, column, params) {