bri-components 1.3.70 → 1.3.72
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 +1 -1
- package/src/components/controls/base/DshDate/DshDate.vue +17 -27
- package/src/components/controls/mixins/controlMixin.js +6 -0
- package/src/components/form/DshForm.vue +54 -21
- package/src/components/list/mixins/DshTreeTableMixin.js +2 -2
- package/src/components/list/mixins/tableBaseMixin.js +35 -14
- package/src/components/unit/DshFormUnit.vue +15 -12
- package/src/components/unit/DshListUnit.vue +1 -0
- package/src/components/unit/unitMixin.js +7 -1
package/package.json
CHANGED
|
@@ -109,40 +109,30 @@
|
|
|
109
109
|
writeSort () {
|
|
110
110
|
return this.selfPropsObj._writeSort;
|
|
111
111
|
},
|
|
112
|
-
compareOperator () {
|
|
113
|
-
return this.selfPropsObj._compareOperator;
|
|
114
|
-
},
|
|
115
112
|
options () {
|
|
116
113
|
return {
|
|
117
114
|
shortcuts: [],
|
|
118
115
|
disabledDate: (date) => {
|
|
119
|
-
const
|
|
116
|
+
const selfValue = {
|
|
117
|
+
...this.value,
|
|
118
|
+
[this.controlKey]: this.$transformDate(date, "/", this.subType)
|
|
119
|
+
};
|
|
120
120
|
|
|
121
|
-
//
|
|
122
|
-
const
|
|
123
|
-
this.selfPropsObj,
|
|
124
|
-
{
|
|
125
|
-
...this.value,
|
|
126
|
-
[this.controlKey]: curDateStr
|
|
127
|
-
},
|
|
128
|
-
this.parentObj,
|
|
129
|
-
this.selfPropsObj._isCompareByParent === true ? this.parentObj : undefined,
|
|
130
|
-
this.selfPropsObj._isCompareByParent === true ? this.parentFormList : this.allFormList
|
|
131
|
-
);
|
|
121
|
+
// 日期字段的平级对比
|
|
122
|
+
const compareBool = this.$normalComparedFunc(this.selfPropsObj, selfValue, this.allFormList, this.parentObj, this.parentFormList, this.inTableType);
|
|
132
123
|
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
124
|
+
// 层级表格里-日期字段的上下级对比(从下往上时,子行的值全有时,才启用置灰)
|
|
125
|
+
const caluBool = (
|
|
126
|
+
this.inTableType === "treeTable" &&
|
|
127
|
+
this.writeSort === "downToUp" &&
|
|
128
|
+
this.value.children &&
|
|
129
|
+
this.value.children.length &&
|
|
130
|
+
this.value.children.some(child => this.$isEmptyData(child[this.controlKey]))
|
|
131
|
+
)
|
|
132
|
+
? true
|
|
133
|
+
: this.$levelComparedFunc(this.selfPropsObj, selfValue, this.allListRows, this.inTableType);
|
|
144
134
|
|
|
145
|
-
return !
|
|
135
|
+
return !compareBool || !caluBool;
|
|
146
136
|
}
|
|
147
137
|
};
|
|
148
138
|
}
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
:formData="formData"
|
|
28
28
|
:formItem="formItem"
|
|
29
29
|
:allFormList="allFormList"
|
|
30
|
+
:inTableType="inTableType"
|
|
30
31
|
:allListRows="allListRows"
|
|
31
32
|
:rowIndex="rowIndex"
|
|
32
33
|
:parentFormList="parentFormList"
|
|
@@ -135,6 +136,12 @@
|
|
|
135
136
|
},
|
|
136
137
|
|
|
137
138
|
/* 内部表,层级表内的字段用到的 */
|
|
139
|
+
inTableType: {
|
|
140
|
+
type: String,
|
|
141
|
+
validator (val) {
|
|
142
|
+
return ["flatTable", "cascaderTable", "treeTable"].includes(val);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
138
145
|
allListRows: {
|
|
139
146
|
type: Array,
|
|
140
147
|
default () {
|
|
@@ -230,7 +237,7 @@
|
|
|
230
237
|
},
|
|
231
238
|
// 初始化校验
|
|
232
239
|
initRules () {
|
|
233
|
-
//
|
|
240
|
+
// 此处代码可以改,但写法不能改!不然会引起表单页面渲染完就自动校验
|
|
234
241
|
this.formList.reduce((rulesObj, formItem) => {
|
|
235
242
|
rulesObj[formItem._key] = this.getRules(formItem);
|
|
236
243
|
return rulesObj;
|
|
@@ -268,7 +275,7 @@
|
|
|
268
275
|
bool = bool && valid;
|
|
269
276
|
|
|
270
277
|
errorFormList.forEach(formItem => {
|
|
271
|
-
this.validateCb(formItem._key, false,
|
|
278
|
+
this.validateCb(formItem._key, false, `"${formItem._name}"内部校验不正确!`);
|
|
272
279
|
});
|
|
273
280
|
});
|
|
274
281
|
|
|
@@ -346,21 +353,6 @@
|
|
|
346
353
|
let rules = [];
|
|
347
354
|
let ruleConfig = this.$getFieldRuleConfig(formItem);
|
|
348
355
|
|
|
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
356
|
// 必填校验
|
|
365
357
|
if (formItem._required) {
|
|
366
358
|
// 其他配置
|
|
@@ -369,7 +361,7 @@
|
|
|
369
361
|
fields: {
|
|
370
362
|
lnglat: {
|
|
371
363
|
required: true,
|
|
372
|
-
message: `${formItem._name}
|
|
364
|
+
message: `${formItem._name}为必填项!`,
|
|
373
365
|
type: "array"
|
|
374
366
|
}
|
|
375
367
|
}
|
|
@@ -378,7 +370,16 @@
|
|
|
378
370
|
fields: {
|
|
379
371
|
list: {
|
|
380
372
|
required: true,
|
|
381
|
-
message: `${formItem._name}
|
|
373
|
+
message: `${formItem._name}不能为空行!`,
|
|
374
|
+
type: "array"
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
cascaderTable: {
|
|
379
|
+
fields: {
|
|
380
|
+
tree: {
|
|
381
|
+
required: true,
|
|
382
|
+
message: `${formItem._name}不能为空行!`,
|
|
382
383
|
type: "array"
|
|
383
384
|
}
|
|
384
385
|
}
|
|
@@ -386,7 +387,7 @@
|
|
|
386
387
|
referenceBy: {
|
|
387
388
|
fields: {
|
|
388
389
|
count: {
|
|
389
|
-
message: `${formItem._name}
|
|
390
|
+
message: `${formItem._name}必须关联数据!`,
|
|
390
391
|
type: "number",
|
|
391
392
|
transform: (val) => {
|
|
392
393
|
if (val && val > 0) {
|
|
@@ -402,7 +403,7 @@
|
|
|
402
403
|
|
|
403
404
|
rules.push({
|
|
404
405
|
required: true,
|
|
405
|
-
message: `${formItem._name}
|
|
406
|
+
message: `${formItem._name}为必填项!`,
|
|
406
407
|
trigger: "blur, change",
|
|
407
408
|
type: "string",
|
|
408
409
|
...(subFieldsMap[formItem._type] || {}),
|
|
@@ -410,6 +411,38 @@
|
|
|
410
411
|
});
|
|
411
412
|
}
|
|
412
413
|
|
|
414
|
+
// 格式校验(不依赖必填)
|
|
415
|
+
if (ruleConfig.regs && ruleConfig.regs.length) {
|
|
416
|
+
rules.push({
|
|
417
|
+
message: formItem._regMessage || `${formItem._name}格式不正确!`,
|
|
418
|
+
trigger: "blur",
|
|
419
|
+
transform: (val) => {
|
|
420
|
+
if (this.$isEmptyData(val)) {
|
|
421
|
+
return val;
|
|
422
|
+
} else {
|
|
423
|
+
return ruleConfig.regs.every(regItem => regItem.test(val)) && val;
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
...ruleConfig
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// 对比校验(横向对比和层级对比)
|
|
431
|
+
const tipObj = {
|
|
432
|
+
message: `${formItem._name}对比不通过!`,
|
|
433
|
+
trigger: "blur, change",
|
|
434
|
+
transform: (val) => {
|
|
435
|
+
const comparedBool = (
|
|
436
|
+
this.$normalComparedFunc(formItem, this.formData, this.allFormList, this.parentObj, this.parentFormList, this.inTableType, tipObj) &&
|
|
437
|
+
this.$levelComparedFunc(formItem, this.formData, this.allListRows, this.inTableType, tipObj)
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
return comparedBool ? val : false;
|
|
441
|
+
},
|
|
442
|
+
...ruleConfig
|
|
443
|
+
};
|
|
444
|
+
rules.push(tipObj);
|
|
445
|
+
|
|
413
446
|
return rules;
|
|
414
447
|
},
|
|
415
448
|
// 强行执行一些校验
|
|
@@ -155,7 +155,7 @@ export default {
|
|
|
155
155
|
return [
|
|
156
156
|
h("div", {
|
|
157
157
|
style: {
|
|
158
|
-
paddingLeft: `${(row.level - 1) * 18}
|
|
158
|
+
paddingLeft: `${(row.level - 1) * 18}px`,
|
|
159
159
|
fontWeight: "500"
|
|
160
160
|
}
|
|
161
161
|
}, row.__treeIndex__),
|
|
@@ -274,7 +274,7 @@ export default {
|
|
|
274
274
|
["upToDown"].includes(column._writeSort)
|
|
275
275
|
) {
|
|
276
276
|
// 第一级的和父级有值的,否则置空
|
|
277
|
-
const val = parentRow &&
|
|
277
|
+
const val = parentRow && this.$isEmptyData(parentRow[column._key])
|
|
278
278
|
? this.$deepCopy(this.initDftValMap[column._type])
|
|
279
279
|
: newRow[column._key];
|
|
280
280
|
|
|
@@ -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.
|
|
450
|
-
|
|
451
|
-
|
|
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])
|
|
@@ -487,6 +499,7 @@ export default {
|
|
|
487
499
|
formData: row,
|
|
488
500
|
formItem: column,
|
|
489
501
|
allFormList: this.columns,
|
|
502
|
+
inTableType: this.inTableType,
|
|
490
503
|
allListRows: this.allListData,
|
|
491
504
|
rowIndex: rowIndex,
|
|
492
505
|
parentFormList: this.allFormList,
|
|
@@ -505,6 +518,7 @@ export default {
|
|
|
505
518
|
formData: row,
|
|
506
519
|
formItem: column,
|
|
507
520
|
allFormList: this.columns,
|
|
521
|
+
inTableType: this.inTableType,
|
|
508
522
|
allListRows: this.allListData,
|
|
509
523
|
rowIndex: rowIndex,
|
|
510
524
|
parentFormList: this.allFormList,
|
|
@@ -517,10 +531,10 @@ export default {
|
|
|
517
531
|
}),
|
|
518
532
|
|
|
519
533
|
// 校验文字
|
|
520
|
-
!
|
|
534
|
+
!ruleResultObj.bool
|
|
521
535
|
? h("span", {
|
|
522
536
|
class: "bri-table-td-tip"
|
|
523
|
-
},
|
|
537
|
+
}, ruleResultObj.message)
|
|
524
538
|
: undefined
|
|
525
539
|
];
|
|
526
540
|
},
|
|
@@ -814,12 +828,7 @@ export default {
|
|
|
814
828
|
module: "sheet",
|
|
815
829
|
name: ["flatTable"].includes(this.controlType) ? "exportFlatTableExcel" : "exportCascaderTableExcel"
|
|
816
830
|
},
|
|
817
|
-
params:
|
|
818
|
-
screenKey: this.screenKey,
|
|
819
|
-
_id: this.parentObj._id,
|
|
820
|
-
_key: this.controlKey,
|
|
821
|
-
advSearch: this.finalTableAdvSearch
|
|
822
|
-
},
|
|
831
|
+
params: this.exportParams,
|
|
823
832
|
callback: data => {
|
|
824
833
|
this.getJobStatus(operationItem, data.jobId, data.excel_url);
|
|
825
834
|
this.exportTimer = setInterval(() => {
|
|
@@ -998,8 +1007,20 @@ export default {
|
|
|
998
1007
|
getColRuleResult (col, row, rowIndex) {
|
|
999
1008
|
col = this.$transformDynamicProperty(col, row, this.parentObj);
|
|
1000
1009
|
|
|
1010
|
+
// 未触发校验时 不显示错误
|
|
1001
1011
|
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
|
|
1002
|
-
|
|
1012
|
+
// 校验必填不通过 => 校验对比
|
|
1013
|
+
const tipObj = this.$getFieldRuleResult(col, row);
|
|
1014
|
+
const comparedBool = (
|
|
1015
|
+
tipObj.bool &&
|
|
1016
|
+
this.$normalComparedFunc(col, row, this.columns, this.parentObj, this.allFormList, this.inTableType, tipObj) &&
|
|
1017
|
+
this.$levelComparedFunc(col, row, this.allListData, this.inTableType, tipObj)
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
return {
|
|
1021
|
+
bool: comparedBool,
|
|
1022
|
+
message: tipObj.message
|
|
1023
|
+
};
|
|
1003
1024
|
} else {
|
|
1004
1025
|
return {
|
|
1005
1026
|
bool: true
|
|
@@ -1019,13 +1040,13 @@ export default {
|
|
|
1019
1040
|
// 列本身是否可编辑
|
|
1020
1041
|
getColCanEdit (col, row) {
|
|
1021
1042
|
return (
|
|
1022
|
-
["
|
|
1043
|
+
["treeTable"].includes(this.inTableType) && ["number", "date"].includes(col._type)
|
|
1023
1044
|
? ![undefined, null, "", "no"].includes(col._summaryType)
|
|
1024
1045
|
? row.isLeaf === true
|
|
1025
1046
|
// : ["downToUp"].includes(col._writeSort)
|
|
1026
1047
|
// ? row.isLeaf === true
|
|
1027
1048
|
: ["upToDown"].includes(col._writeSort)
|
|
1028
|
-
? row.level === 1 ||
|
|
1049
|
+
? row.level === 1 || !this.$isEmptyData(this.getParentNode(row, this.allTreeData)[col._key])
|
|
1029
1050
|
: true
|
|
1030
1051
|
: true
|
|
1031
1052
|
) &&
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
:value="formData"
|
|
78
78
|
:propsObj="formItem"
|
|
79
79
|
:allFormList="allFormList"
|
|
80
|
+
:inTableType="inTableType"
|
|
80
81
|
:allListRows="allListRows"
|
|
81
82
|
:rowIndex="rowIndex"
|
|
82
83
|
:parentFormList="parentFormList"
|
|
@@ -342,18 +343,20 @@
|
|
|
342
343
|
}
|
|
343
344
|
|
|
344
345
|
&-required {
|
|
345
|
-
.DshFormUnit-label
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
346
|
+
> .DshFormUnit-label {
|
|
347
|
+
&::before {
|
|
348
|
+
position: absolute;
|
|
349
|
+
left: -10px;
|
|
350
|
+
|
|
351
|
+
content: '*';
|
|
352
|
+
display: inline-block;
|
|
353
|
+
width: 6px;
|
|
354
|
+
line-height: 1.5;
|
|
355
|
+
font-family: SimSun;
|
|
356
|
+
font-weight: 500;
|
|
357
|
+
font-size: @textSize;
|
|
358
|
+
color: #E94829;
|
|
359
|
+
}
|
|
357
360
|
}
|
|
358
361
|
}
|
|
359
362
|
|
|
@@ -27,13 +27,19 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
/* 内部表,层级表内的字段用到的 */
|
|
30
|
-
|
|
30
|
+
inTableType: {
|
|
31
|
+
type: String,
|
|
32
|
+
validator (val) {
|
|
33
|
+
return ["flatTable", "cascaderTable", "treeTable"].includes(val);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
31
36
|
allListRows: {
|
|
32
37
|
type: Array,
|
|
33
38
|
default () {
|
|
34
39
|
return [];
|
|
35
40
|
}
|
|
36
41
|
},
|
|
42
|
+
rowIndex: Number,
|
|
37
43
|
parentFormList: {
|
|
38
44
|
type: Array,
|
|
39
45
|
default () {
|