bri-components 1.3.71 → 1.3.73
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 +31 -41
- package/src/components/list/mixins/DshTreeTableMixin.js +1 -1
- package/src/components/list/mixins/tableBaseMixin.js +15 -21
- 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 () {
|
|
@@ -154,12 +161,6 @@
|
|
|
154
161
|
return {};
|
|
155
162
|
}
|
|
156
163
|
},
|
|
157
|
-
inTableType: {
|
|
158
|
-
type: String,
|
|
159
|
-
validator (val) {
|
|
160
|
-
return ["flatTable", "cascaderTable", "treeTable"].includes(val);
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
164
|
|
|
164
165
|
changedFields: {
|
|
165
166
|
type: Array,
|
|
@@ -236,7 +237,7 @@
|
|
|
236
237
|
},
|
|
237
238
|
// 初始化校验
|
|
238
239
|
initRules () {
|
|
239
|
-
//
|
|
240
|
+
// 此处代码可以改,但写法不能改!不然会引起表单页面渲染完就自动校验
|
|
240
241
|
this.formList.reduce((rulesObj, formItem) => {
|
|
241
242
|
rulesObj[formItem._key] = this.getRules(formItem);
|
|
242
243
|
return rulesObj;
|
|
@@ -274,7 +275,7 @@
|
|
|
274
275
|
bool = bool && valid;
|
|
275
276
|
|
|
276
277
|
errorFormList.forEach(formItem => {
|
|
277
|
-
this.validateCb(formItem._key, false,
|
|
278
|
+
this.validateCb(formItem._key, false, `"${formItem._name}"内部校验不正确!`);
|
|
278
279
|
});
|
|
279
280
|
});
|
|
280
281
|
|
|
@@ -360,7 +361,7 @@
|
|
|
360
361
|
fields: {
|
|
361
362
|
lnglat: {
|
|
362
363
|
required: true,
|
|
363
|
-
message: `${formItem._name}
|
|
364
|
+
message: `${formItem._name}为必填项!`,
|
|
364
365
|
type: "array"
|
|
365
366
|
}
|
|
366
367
|
}
|
|
@@ -369,7 +370,7 @@
|
|
|
369
370
|
fields: {
|
|
370
371
|
list: {
|
|
371
372
|
required: true,
|
|
372
|
-
message: `${formItem._name}
|
|
373
|
+
message: `${formItem._name}不能为空行!`,
|
|
373
374
|
type: "array"
|
|
374
375
|
}
|
|
375
376
|
}
|
|
@@ -378,7 +379,7 @@
|
|
|
378
379
|
fields: {
|
|
379
380
|
tree: {
|
|
380
381
|
required: true,
|
|
381
|
-
message: `${formItem._name}
|
|
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,10 +411,10 @@
|
|
|
410
411
|
});
|
|
411
412
|
}
|
|
412
413
|
|
|
413
|
-
//
|
|
414
|
-
if (ruleConfig.regs.length) {
|
|
414
|
+
// 格式校验(不依赖必填)
|
|
415
|
+
if (ruleConfig.regs && ruleConfig.regs.length) {
|
|
415
416
|
rules.push({
|
|
416
|
-
message: formItem._regMessage || `${formItem._name}
|
|
417
|
+
message: formItem._regMessage || `${formItem._name}格式不正确!`,
|
|
417
418
|
trigger: "blur",
|
|
418
419
|
transform: (val) => {
|
|
419
420
|
if (this.$isEmptyData(val)) {
|
|
@@ -427,31 +428,20 @@
|
|
|
427
428
|
}
|
|
428
429
|
|
|
429
430
|
// 对比校验(横向对比和层级对比)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
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
|
-
}
|
|
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);
|
|
455
445
|
|
|
456
446
|
return rules;
|
|
457
447
|
},
|
|
@@ -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
|
|
|
@@ -499,6 +499,7 @@ export default {
|
|
|
499
499
|
formData: row,
|
|
500
500
|
formItem: column,
|
|
501
501
|
allFormList: this.columns,
|
|
502
|
+
inTableType: this.inTableType,
|
|
502
503
|
allListRows: this.allListData,
|
|
503
504
|
rowIndex: rowIndex,
|
|
504
505
|
parentFormList: this.allFormList,
|
|
@@ -517,6 +518,7 @@ export default {
|
|
|
517
518
|
formData: row,
|
|
518
519
|
formItem: column,
|
|
519
520
|
allFormList: this.columns,
|
|
521
|
+
inTableType: this.inTableType,
|
|
520
522
|
allListRows: this.allListData,
|
|
521
523
|
rowIndex: rowIndex,
|
|
522
524
|
parentFormList: this.allFormList,
|
|
@@ -1005,28 +1007,20 @@ export default {
|
|
|
1005
1007
|
getColRuleResult (col, row, rowIndex) {
|
|
1006
1008
|
col = this.$transformDynamicProperty(col, row, this.parentObj);
|
|
1007
1009
|
|
|
1010
|
+
// 未触发校验时 不显示错误
|
|
1008
1011
|
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
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);
|
|
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
|
+
);
|
|
1022
1019
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
} else {
|
|
1028
|
-
return ruleResultObj;
|
|
1029
|
-
}
|
|
1020
|
+
return {
|
|
1021
|
+
bool: comparedBool,
|
|
1022
|
+
message: tipObj.message
|
|
1023
|
+
};
|
|
1030
1024
|
} else {
|
|
1031
1025
|
return {
|
|
1032
1026
|
bool: true
|
|
@@ -1052,7 +1046,7 @@ export default {
|
|
|
1052
1046
|
// : ["downToUp"].includes(col._writeSort)
|
|
1053
1047
|
// ? row.isLeaf === true
|
|
1054
1048
|
: ["upToDown"].includes(col._writeSort)
|
|
1055
|
-
? row.level === 1 ||
|
|
1049
|
+
? row.level === 1 || !this.$isEmptyData(this.getParentNode(row, this.allTreeData)[col._key])
|
|
1056
1050
|
: true
|
|
1057
1051
|
: true
|
|
1058
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 () {
|