Commit 767f42e2 by 李少勇

修改校验相关问题

parent b0ca9b52
......@@ -21,9 +21,6 @@ export default {
},
// 检核
async handleCheck() {
// this.$refs['modelForm'].validate((valid) => {
// console.log('valid', valid)
// })
const loading = this.loading('正在校验数据');
const rtnmsg = await Api.post('/service/gitopn/checkAll', {
...this.model,
......@@ -31,19 +28,25 @@ export default {
userId: window.sessionStorage.userId || 'ZL',
});
if (rtnmsg.respCode === SUCCESS) {
console.log('=====校验', rtnmsg)
// this.updateValueSet(rtnmsg.codeSet);
let errorRules = rtnmsg.data
Object.keys(errorRules).map((ruleKey) => {
// 此处判断是为了区分,如果在前端做了校验后端也校验了就不采用自定义校验规则
if (!this.rules[ruleKey]) {
this.rules[ruleKey] = [
{
validator: (rule, value, callback) => {
callback(new Error(errorRules[ruleKey]))
},
trigger: ['change', 'blur']
}
]
}
})
console.log('rules', this.rules)
this.$refs['modelForm'].validate((valid) => {
console.log('valid', valid)
})
}
// if (rtnmsg.respCode === SUCCESS) {
// const fieldErrors = rtnmsg.fieldErrors;
// this.updateModel(rtnmsg.data);
// if (fieldErrors && Object.keys(fieldErrors).length === 0) {
// // 清除之前的校验状态
// this.getRoot().$refs.modelForm.clearValidate();
// return;
// }
// }
// this.$notify({
// title: '成功',
// message: '校验成功',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment