非法值输入修改

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('无效的会话,或者会话已过期,请重新登录。') return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) { } else if (code === 500) {
Message({ message: msg, type: 'error' }) 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) { } else if (code === 601) {
Message({ message: msg, type: 'warning' }) Message({ message: msg, type: 'warning' })
return Promise.reject('error') return Promise.reject('error')

View File

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