|
@@ -15,7 +15,7 @@
|
|
:model="modalForm"
|
|
:model="modalForm"
|
|
:rules="rules"
|
|
:rules="rules"
|
|
:key="modalForm.id"
|
|
:key="modalForm.id"
|
|
- label-width="130px"
|
|
|
|
|
|
+ label-width="auto"
|
|
>
|
|
>
|
|
<el-form-item prop="name" label="名称:">
|
|
<el-form-item prop="name" label="名称:">
|
|
<el-input
|
|
<el-input
|
|
@@ -157,6 +157,17 @@ export default {
|
|
},
|
|
},
|
|
trigger: "change",
|
|
trigger: "change",
|
|
},
|
|
},
|
|
|
|
+ booleanValidator: {
|
|
|
|
+ required: true,
|
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
|
+ const val = this.getModalFromVal(rule.field);
|
|
|
|
+ if (!val && val !== false) {
|
|
|
|
+ callback(new Error("请选择"));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -210,6 +221,12 @@ export default {
|
|
{ ...this.numberValidator },
|
|
{ ...this.numberValidator },
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
+ if (cont.type === "boolean") {
|
|
|
|
+ // custom[cont.key] = null;
|
|
|
|
+ this.rules[`control.custom.${cont.key}`] = [
|
|
|
|
+ { ...this.booleanValidator },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
});
|
|
});
|
|
this.modalForm.control.custom = custom;
|
|
this.modalForm.control.custom = custom;
|
|
|
|
|