非法值输入修改

This commit is contained in:
cwchen 2025-09-28 17:59:19 +08:00
parent b3c0f59171
commit 18bd30d68e
2 changed files with 23 additions and 5 deletions

View File

@ -322,7 +322,12 @@ service.interceptors.response.use(
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
Message({ message: msg, type: 'error' })
return Promise.reject(new Error(msg))
if(res.data.data){
return Promise.reject(new Error(`${msg}${JSON.stringify(res.data.data)}`));
}else{
return Promise.reject(new Error(msg));
}
} else if (code === 601) {
Message({ message: msg, type: 'warning' })
return Promise.reject('error')

View File

@ -68,6 +68,10 @@ export default {
{ required: true, message: '请选择维度', trigger: 'change' }
],
},
errorObj: {
classifyName: '分类名称',
classifyDesc: '分类描述',
},
};
},
created() {
@ -77,13 +81,14 @@ export default {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
console.log(this.rowData);
//
this.form = {
id: this.rowData.id,
classifyName: this.rowData.classifyName || null,
dimension: this.rowData.dimension || null,
classifyDesc: this.rowData.classifyDesc || null,
fileRelated: this.rowData.fileRelated || null,
fileRelated: this.rowData.fileRelatedId || null,
};
} else {
//
@ -150,7 +155,7 @@ export default {
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
this.$modal.msgError(this.errorMsg(error));
});
} else {
updateKyFilesMultiClassifyAPI(params).then(res => {
@ -160,13 +165,21 @@ export default {
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
})
.catch(error => {
this.loading.close();
// this.$modal.msgError('');
this.$modal.msgError(this.errorMsg(error));
});
}
}
});
},
errorMsg(error) {
const errorMessage = error.message;
const errorArr = errorMessage.split('');
const errorObjData = errorArr.length > 1 ? JSON.parse(errorArr[1]) : '';
return this.errorObj[errorObjData.paramName] + errorArr[0] + ':' + errorObjData.originalValue;
}
}
};