Commit db156535 by fukai

修复异常校验问题

parent 55b51ab4
......@@ -18,8 +18,12 @@ export default {
message: "保存失败",
type: "error",
});
if(Object.keys(result.fieldErrors).length > 0 ){
this.$notify.error({ title: "错误", message: result.respMsg });
if(result.fieldErrors && Object.keys(result.fieldErrors).length > 0 ){
const tab = this.showBackendErrors(fieldErrors)
if (tab) {
// tab切换之后,需出发tab-click的事件
this.tabClick(tab);
}
}
}
},
......@@ -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() {
let result = await this.checkAll();
if (result.respCode == SUCCESS && Object.keys(result.fieldErrors).length == 0) {
// 清除之前的校验状态
this.$refs.modelForm.clearValidate();
const fields = this.$refs.modelForm.fields;
if (result.respCode == SUCCESS) {
const fieldErrors = result.fieldErrors;
this.updateModel(result.data);
Utils.positioningErrorMsg(fieldErrors, fields);
const tab = Utils.positioningErrorMsg(fieldErrors, fields);
const tab = this.showBackendErrors(fieldErrors)
if (tab) {
// tab切换之后,需出发tab-click的事件
this.tabClick(tab);
this.$notify({
title: "错误",
message: "校核失败",
type: "error",
});
return
}
this.$notify({
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