@zscreate/zhxy-app-component 1.0.336 → 1.0.337-test.2
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/README.md
CHANGED
|
@@ -891,6 +891,7 @@ export default {
|
|
|
891
891
|
let widget = this.widget;
|
|
892
892
|
let model = widget.model;
|
|
893
893
|
if (!widget.options) return
|
|
894
|
+
this.setRules()
|
|
894
895
|
// 时间比较增加校验规则
|
|
895
896
|
if (widget.options.condition && widget.options.conditionValue) {
|
|
896
897
|
let model = widget.model;
|
|
@@ -929,6 +930,58 @@ export default {
|
|
|
929
930
|
uni.$off(this.widget.model);
|
|
930
931
|
},
|
|
931
932
|
methods: {
|
|
933
|
+
//复选框改变
|
|
934
|
+
checkboxChange(e) {
|
|
935
|
+
if (this.tableKey) {
|
|
936
|
+
this.models[this.tableKey][this.tableIndex][this.widget.model] = e.target.value;
|
|
937
|
+
} else {
|
|
938
|
+
this.models[this.widget.model] = e.target.value;
|
|
939
|
+
}
|
|
940
|
+
this.validateInit()
|
|
941
|
+
},
|
|
942
|
+
setRules() {
|
|
943
|
+
let widget = this.widget;
|
|
944
|
+
// 最多选最少选
|
|
945
|
+
if (widget.options.maxValue || widget.options.minValue) {
|
|
946
|
+
if (this.tableKey) {
|
|
947
|
+
if(this.rules[this.tableKey][this.widget.model]) this.rules[this.tableKey][this.widget.model] = []
|
|
948
|
+
this.rules[this.tableKey][this.widget.model].push({
|
|
949
|
+
validator: this.validateNumRange,
|
|
950
|
+
trigger: "change",
|
|
951
|
+
});
|
|
952
|
+
} else {
|
|
953
|
+
if(!this.rules[this.widget.model]) this.rules[this.widget.model] = []
|
|
954
|
+
this.rules[this.widget.model].push({
|
|
955
|
+
validator: this.validateNumRange,
|
|
956
|
+
trigger: "change",
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
} else {
|
|
960
|
+
// 清空最多最少选
|
|
961
|
+
if (this.tableKey) {
|
|
962
|
+
if(this.rules[this.tableKey][this.widget.model].filter(item=> item.validator)) this.rules[this.tableKey][this.widget.model] = this.rules[this.tableKey][this.widget.model].filter(item=> !item.validator)
|
|
963
|
+
} else {
|
|
964
|
+
if(this.rules[this.widget.model].filter(item=> item.validator)) this.rules[this.widget.model] = this.rules[this.widget.model].filter(item=> !item.validator)
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
|
|
969
|
+
validateNumRange(rule, value, callback) {
|
|
970
|
+
debugger;
|
|
971
|
+
let options = this.widget.options;
|
|
972
|
+
if (!options.maxValue && !options.minValue) {
|
|
973
|
+
callback();
|
|
974
|
+
}
|
|
975
|
+
if (Array.isArray(value) && options.maxValue && options.minValue && options.minValue == options.maxValue && (!value || (Array.isArray(value) && value.length != options.maxValue))) {
|
|
976
|
+
callback(this.widget.name + "只能选择" + options.maxValue + "项");
|
|
977
|
+
} else if (Array.isArray(value) && options.maxValue && value.length > options.maxValue) {
|
|
978
|
+
callback(this.widget.name + "最多选择" + options.maxValue + "项");
|
|
979
|
+
} else if (options.minValue && (!value || (Array.isArray(value) && value.length < options.minValue))) {
|
|
980
|
+
callback(this.widget.name + "最少选择" + options.minValue + "项");
|
|
981
|
+
} else {
|
|
982
|
+
callback();
|
|
983
|
+
}
|
|
984
|
+
},
|
|
932
985
|
// 会议室点击
|
|
933
986
|
openConferenceRoom() {
|
|
934
987
|
if (!this.widget.dataKey) {
|
|
@@ -1697,6 +1750,7 @@ export default {
|
|
|
1697
1750
|
}
|
|
1698
1751
|
})
|
|
1699
1752
|
this.dataModelShow = str.substring(1)
|
|
1753
|
+
if (this.widget.type == 'radio' || this.widget.type == 'checkbox')this.updateRadioOrCheckboxModel(global.dictData[this.widget.model])
|
|
1700
1754
|
} else {
|
|
1701
1755
|
if (this.widget.options.dictCode || this.widget.options.dictName) {
|
|
1702
1756
|
//根据字典Code, 初始化字典数组
|
|
@@ -2428,6 +2482,13 @@ export default {
|
|
|
2428
2482
|
}
|
|
2429
2483
|
this.updateUserSelectorModal()
|
|
2430
2484
|
}
|
|
2485
|
+
if(this.widget.type === 'imgupload') {
|
|
2486
|
+
// applyId代表已提交过的(不包含暂存)
|
|
2487
|
+
if((!v || !v.length) && !this.applyId && !this.$Route.query.applyId && this.widget.options.defaultFiles) {
|
|
2488
|
+
this.dataModel = this.widget.options.defaultFiles
|
|
2489
|
+
this.models[this.widget.model] = this.widget.options.defaultFiles
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2431
2492
|
if (this.widget.type === 'deptSelector') {
|
|
2432
2493
|
this.updatedeptSelectorModal()
|
|
2433
2494
|
}
|
|
@@ -20,7 +20,6 @@ const utils = {
|
|
|
20
20
|
if (typeof pattern === 'string' && String(pattern).startsWith('/') && (String(pattern).endsWith('/') || String(pattern).slice(-2)[0] === '/' )) {
|
|
21
21
|
pattern = String(pattern).substring(1, pattern.length - (String(pattern).slice(-2)[0] === '/' ? 2 : 1))
|
|
22
22
|
}
|
|
23
|
-
debugger
|
|
24
23
|
console.log('isRegExp:', isRegExp(pattern))
|
|
25
24
|
rule.pattern = new RegExp(pattern, flag)
|
|
26
25
|
console.log("rule.pattern: ",pattern, rule.pattern, flag)
|
|
@@ -30,19 +29,7 @@ const utils = {
|
|
|
30
29
|
[prop]: propRules
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
* 拓展 数组类的value 校验;只需满足非空数组即可
|
|
35
|
-
* **/
|
|
36
|
-
if(typeof value == "object" && value.constructor == Array ){
|
|
37
|
-
console.log('===',descriptor)
|
|
38
|
-
}
|
|
39
|
-
if(typeof value == "object" && value.constructor == Array && value.length > 0){
|
|
40
|
-
callback(null);
|
|
41
|
-
return false;
|
|
42
|
-
}else if(typeof value == 'boolean'){
|
|
43
|
-
callback(null);
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
32
|
+
|
|
46
33
|
|
|
47
34
|
/**
|
|
48
35
|
* 拓展 数组类的value 校验;
|
|
@@ -51,13 +38,28 @@ const utils = {
|
|
|
51
38
|
const model = {
|
|
52
39
|
[prop]: value
|
|
53
40
|
};
|
|
54
|
-
|
|
41
|
+
let flag = false
|
|
55
42
|
validator.validate(model, {
|
|
56
43
|
firstFields: true,
|
|
57
44
|
first:true,
|
|
58
45
|
}, (errors) => {
|
|
59
|
-
|
|
46
|
+
flag = true
|
|
47
|
+
return callback(errors);
|
|
60
48
|
});
|
|
49
|
+
if(flag) return
|
|
50
|
+
/**
|
|
51
|
+
* 拓展 数组类的value 校验;只需满足非空数组即可
|
|
52
|
+
* **/
|
|
53
|
+
if(typeof value == "object" && value.constructor == Array ){
|
|
54
|
+
console.log('===',descriptor)
|
|
55
|
+
}
|
|
56
|
+
if(typeof value == "object" && value.constructor == Array && value.length > 0){
|
|
57
|
+
callback(null);
|
|
58
|
+
return false;
|
|
59
|
+
}else if(typeof value == 'boolean'){
|
|
60
|
+
callback(null);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
61
63
|
},
|
|
62
64
|
}
|
|
63
65
|
export default utils
|