update 流程校验调整
This commit is contained in:
+24
-12
@@ -408,14 +408,22 @@ export default {
|
||||
async getPageParams (isValidate = true) {
|
||||
// 去除备注必填
|
||||
this.validatorRules.remarks.rules[0].required = false
|
||||
// 报错标记(base基本信息校验失败,user人员信息校验失败)
|
||||
let flag = ''
|
||||
const base = 'base'
|
||||
const user = 'user'
|
||||
// 节点1判断表格是否有数据
|
||||
if (this.isInitiate && this.$refs.baseInfoTable.dataSource.length === 0) {
|
||||
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
|
||||
throw new Error('base')
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
} else if (!this.isInitiate && this.$refs.applyPermissionTable.dataSource.length === 0) {
|
||||
// 其他节点判断表单中的表格是否有数据
|
||||
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
|
||||
throw new Error('base')
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
}
|
||||
// 校验表格中是否已有权限
|
||||
if (isValidate && this.isInitiate) {
|
||||
@@ -423,7 +431,9 @@ export default {
|
||||
await checkPermissionApply({ ids }).then(res => {
|
||||
if (!res.success) {
|
||||
this.$message.warning(res.message)
|
||||
throw new Error('base')
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -431,16 +441,13 @@ export default {
|
||||
// 收集所有表单信息
|
||||
let formDataList = []
|
||||
if (isValidate) {
|
||||
// 记录表单验证是否报错
|
||||
let err = null
|
||||
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm, this.baseInfoForm).catch(() => {
|
||||
err = true
|
||||
if (!flag) {
|
||||
flag = base
|
||||
}
|
||||
// 设置成数组防止后面报错
|
||||
return []
|
||||
})
|
||||
// 如果有错误就跳转表单
|
||||
if (err !== null) {
|
||||
throw new Error('base')
|
||||
}
|
||||
} else {
|
||||
formDataList = [
|
||||
this.processInfoForm.getFieldsValue(),
|
||||
@@ -451,9 +458,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
|
||||
}
|
||||
|
||||
// 开始处理信息
|
||||
@@ -491,6 +498,11 @@ export default {
|
||||
// 业务数据,用于强制撤回后回显
|
||||
draftData: params.processEsPermissionApply
|
||||
})
|
||||
|
||||
// 如果有校验失败的,那就报错
|
||||
if (flag) {
|
||||
throw new Error(flag)
|
||||
}
|
||||
return params
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user