Commit 46a2b7b5 by 1198835488@qq.com
parents b288a61b 8366ed5b
...@@ -18,8 +18,12 @@ export default { ...@@ -18,8 +18,12 @@ export default {
message: "保存失败", message: "保存失败",
type: "error", type: "error",
}); });
if(Object.keys(result.fieldErrors).length > 0 ){ if(result.fieldErrors && Object.keys(result.fieldErrors).length > 0 ){
this.$notify.error({ title: "错误", message: result.respMsg }); const tab = this.showBackendErrors(fieldErrors)
if (tab) {
// tab切换之后,需出发tab-click的事件
this.tabClick(tab);
}
} }
} }
}, },
...@@ -41,20 +45,30 @@ export default { ...@@ -41,20 +45,30 @@ export default {
}); });
} }
}, },
showBackendErrors(fieldErrors){
// 清除之前的校验状态
this.$refs.modelForm.clearValidate();
const fields = this.$refs.modelForm.fields;
Utils.positioningErrorMsg(fieldErrors, fields);
const tab = Utils.positioningErrorMsg(fieldErrors, fields);
return tab;
},
// 表单校验 // 表单校验
async handleCheck() { async handleCheck() {
let result = await this.checkAll(); let result = await this.checkAll();
if (result.respCode == SUCCESS && Object.keys(result.fieldErrors).length == 0) { if (result.respCode == SUCCESS) {
// 清除之前的校验状态
this.$refs.modelForm.clearValidate();
const fields = this.$refs.modelForm.fields;
const fieldErrors = result.fieldErrors; const fieldErrors = result.fieldErrors;
this.updateModel(result.data); this.updateModel(result.data);
Utils.positioningErrorMsg(fieldErrors, fields); const tab = this.showBackendErrors(fieldErrors)
const tab = Utils.positioningErrorMsg(fieldErrors, fields);
if (tab) { if (tab) {
// tab切换之后,需出发tab-click的事件 // tab切换之后,需出发tab-click的事件
this.tabClick(tab); this.tabClick(tab);
this.$notify({
title: "错误",
message: "校核失败",
type: "error",
});
return
} }
this.$notify({ this.$notify({
title: "成功", title: "成功",
......
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