update 流程校验调整

This commit is contained in:
danshihao
2024-01-19 15:09:14 +08:00
parent c503bab2f7
commit 8fcdd702ae
12 changed files with 188 additions and 55 deletions
@@ -305,30 +305,42 @@ export default {
async getPageParams (isValidate = true) {
// 去除备注必填
this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
// 如果需要校验校验表格数据
if (isValidate) {
const list = this.$refs.inspectionProcessTable.dataSource
if (list.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base')
if (!flag) {
flag = base
}
}
/**
* 调整为前端存储
*/
// 节点1:稽查内容条数不能为0
if (this.isInitiate && list.some(item => !(item.enterpriseStandardInspectContentList && item.enterpriseStandardInspectContentList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionContent'))
if (!flag) {
flag = base
}
}
// 节点3:稽查报告条数不能为0
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectReportList && item.enterpriseStandardInspectReportList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionReport'))
if (!flag) {
flag = base
}
}
// 节点3:整改计划条数不能为0
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectRectifyPlanList && item.enterpriseStandardInspectRectifyPlanList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillRectificationPlan'))
if (!flag) {
flag = base
}
}
}
const params = {}
@@ -354,7 +366,13 @@ export default {
// 收集所有表单信息
let formDataList = []
if (isValidate) {
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm)
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => {
if (!flag) {
flag = base
}
// 空数组防止后续操作报错
return []
})
} else {
formDataList = [
this.processInfoForm.getFieldsValue(),
@@ -364,9 +382,9 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
}
// 收集人员信息
const personInfo = this.getPersonInfo(isValidate)
const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) {
throw new Error('user')
flag = user
}
// 开始处理信息
@@ -393,6 +411,11 @@ export default {
// 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectList
})
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params
},
/**