bri-components 1.3.70 → 1.3.71

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.3.70",
3
+ "version": "1.3.71",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -154,6 +154,12 @@
154
154
  return {};
155
155
  }
156
156
  },
157
+ inTableType: {
158
+ type: String,
159
+ validator (val) {
160
+ return ["flatTable", "cascaderTable", "treeTable"].includes(val);
161
+ }
162
+ },
157
163
 
158
164
  changedFields: {
159
165
  type: Array,
@@ -346,21 +352,6 @@
346
352
  let rules = [];
347
353
  let ruleConfig = this.$getFieldRuleConfig(formItem);
348
354
 
349
- // 格式校验 (不依赖必填)
350
- if (ruleConfig.regs.length) {
351
- rules.push({
352
- message: formItem._regMessage || `${formItem._name} 格式不正确!`,
353
- trigger: "blur",
354
- transform: (val) => {
355
- if (this.$isEmptyData(val)) {
356
- return val;
357
- } else {
358
- return ruleConfig.regs.every(regItem => regItem.test(val)) && val;
359
- }
360
- },
361
- ...ruleConfig
362
- });
363
- }
364
355
  // 必填校验
365
356
  if (formItem._required) {
366
357
  // 其他配置
@@ -383,6 +374,15 @@
383
374
  }
384
375
  }
385
376
  },
377
+ cascaderTable: {
378
+ fields: {
379
+ tree: {
380
+ required: true,
381
+ message: `${formItem._name} 不能为空行!`,
382
+ type: "array"
383
+ }
384
+ }
385
+ },
386
386
  referenceBy: {
387
387
  fields: {
388
388
  count: {
@@ -410,6 +410,49 @@
410
410
  });
411
411
  }
412
412
 
413
+ // 格式校验 (不依赖必填)
414
+ if (ruleConfig.regs.length) {
415
+ rules.push({
416
+ message: formItem._regMessage || `${formItem._name} 格式不正确!`,
417
+ trigger: "blur",
418
+ transform: (val) => {
419
+ if (this.$isEmptyData(val)) {
420
+ return val;
421
+ } else {
422
+ return ruleConfig.regs.every(regItem => regItem.test(val)) && val;
423
+ }
424
+ },
425
+ ...ruleConfig
426
+ });
427
+ }
428
+
429
+ // 对比校验(横向对比和层级对比)
430
+ if (["number", "date"].includes(formItem._type)) {
431
+ const tipObj = {};
432
+ rules.push({
433
+ message: "对比不通过!",
434
+ trigger: "blur, change",
435
+ transform: (val) => {
436
+ const comparedBool = this.$normalComparedFunc(
437
+ formItem,
438
+ this.formData,
439
+ this.parentObj,
440
+ formItem._isCompareByParent ? this.parentObj : undefined,
441
+ formItem._isCompareByParent ? this.parentFormList : this.allFormList,
442
+ tipObj,
443
+ this.inTableType
444
+ ) && this.$levelComparedFunc(formItem, this.formData, tipObj, this.inTableType);
445
+
446
+ if (comparedBool) {
447
+ return val;
448
+ } else {
449
+ return false;
450
+ }
451
+ },
452
+ ...ruleConfig
453
+ });
454
+ }
455
+
413
456
  return rules;
414
457
  },
415
458
  // 强行执行一些校验
@@ -155,7 +155,7 @@ export default {
155
155
  return [
156
156
  h("div", {
157
157
  style: {
158
- paddingLeft: `${(row.level - 1) * 18} px`,
158
+ paddingLeft: `${(row.level - 1) * 18}px`,
159
159
  fontWeight: "500"
160
160
  }
161
161
  }, row.__treeIndex__),
@@ -223,6 +223,11 @@ export default {
223
223
  ...this.commonPropsObj
224
224
  };
225
225
  },
226
+ inTableType () {
227
+ return this.controlType === "cascaderTable" && ["treeTable"].includes(this.selfPropsObj._showMode)
228
+ ? this.selfPropsObj._showMode
229
+ : this.controlType;
230
+ },
226
231
  // isShare () {
227
232
  // return this.selfPropsObj.isShare;
228
233
  // },
@@ -446,9 +451,15 @@ export default {
446
451
  return {
447
452
  _id: this.parentDataId,
448
453
  _key: this.controlKey,
449
- importType: this.controlType === "cascaderTable" && ["treeTable"].includes(this.selfPropsObj._showMode)
450
- ? this.selfPropsObj._showMode
451
- : this.controlType
454
+ importType: this.inTableType
455
+ };
456
+ },
457
+ exportParams () {
458
+ return {
459
+ screenKey: this.screenKey,
460
+ _id: this.parentDataId,
461
+ _key: this.controlKey,
462
+ advSearch: this.finalTableAdvSearch
452
463
  };
453
464
  },
454
465
 
@@ -465,6 +476,7 @@ export default {
465
476
  column = this.$transformDynamicProperty(column, row, this.parentObj);
466
477
  column = this.resetCol(column, row);
467
478
  const unitCanEdit = this.getUnitCanEdit(column, row);
479
+ const ruleResultObj = this.getColRuleResult(column, row, rowIndex);
468
480
 
469
481
  return [
470
482
  this.isShowCompare(column, row, this.compareListData[rowIndex])
@@ -517,10 +529,10 @@ export default {
517
529
  }),
518
530
 
519
531
  // 校验文字
520
- !this.getColRuleResult(column, row, rowIndex).bool
532
+ !ruleResultObj.bool
521
533
  ? h("span", {
522
534
  class: "bri-table-td-tip"
523
- }, this.getColRuleResult(column, row, rowIndex).message)
535
+ }, ruleResultObj.message)
524
536
  : undefined
525
537
  ];
526
538
  },
@@ -814,12 +826,7 @@ export default {
814
826
  module: "sheet",
815
827
  name: ["flatTable"].includes(this.controlType) ? "exportFlatTableExcel" : "exportCascaderTableExcel"
816
828
  },
817
- params: {
818
- screenKey: this.screenKey,
819
- _id: this.parentObj._id,
820
- _key: this.controlKey,
821
- advSearch: this.finalTableAdvSearch
822
- },
829
+ params: this.exportParams,
823
830
  callback: data => {
824
831
  this.getJobStatus(operationItem, data.jobId, data.excel_url);
825
832
  this.exportTimer = setInterval(() => {
@@ -999,7 +1006,27 @@ export default {
999
1006
  col = this.$transformDynamicProperty(col, row, this.parentObj);
1000
1007
 
1001
1008
  if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
1002
- return this.$getFieldRuleResult(col, row);
1009
+ const ruleResultObj = this.$getFieldRuleResult(col, row);
1010
+
1011
+ if (ruleResultObj.bool) {
1012
+ const tipObj = {};
1013
+ const comparedBool = this.$normalComparedFunc(
1014
+ col,
1015
+ row,
1016
+ this.parentObj,
1017
+ col._isCompareByParent ? this.parentObj : undefined,
1018
+ col._isCompareByParent ? this.allFormList : this.columns,
1019
+ tipObj,
1020
+ this.inTableType
1021
+ ) && this.$levelComparedFunc(col, row, tipObj, this.inTableType);
1022
+
1023
+ return {
1024
+ bool: comparedBool,
1025
+ message: tipObj.message
1026
+ };
1027
+ } else {
1028
+ return ruleResultObj;
1029
+ }
1003
1030
  } else {
1004
1031
  return {
1005
1032
  bool: true
@@ -1019,7 +1046,7 @@ export default {
1019
1046
  // 列本身是否可编辑
1020
1047
  getColCanEdit (col, row) {
1021
1048
  return (
1022
- ["cascaderTable"].includes(this.controlType) && ["number", "date"].includes(col._type)
1049
+ ["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
1023
1050
  ? ![undefined, null, "", "no"].includes(col._summaryType)
1024
1051
  ? row.isLeaf === true
1025
1052
  // : ["downToUp"].includes(col._writeSort)