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
+5 -2
View File
@@ -249,7 +249,8 @@ module.exports = {
solicitOpinionObject: '征求意见对象', solicitOpinionObject: '征求意见对象',
isCountersign: '是否会签', isCountersign: '是否会签',
countersignRelevantPersonnel: '会签相关人员', countersignRelevantPersonnel: '会签相关人员',
downloadTemplate: '企标稽查计划导入模板' downloadTemplate: '企标稽查计划导入模板',
pleaseFillOpinion: '请填写意见'
}, },
// 企标稽查流程 // 企标稽查流程
esInspectionProcess: { esInspectionProcess: {
@@ -279,7 +280,9 @@ module.exports = {
rectificationPlanDoneDate: '整改计划完成日期', rectificationPlanDoneDate: '整改计划完成日期',
rectificationRealityDoneDate: '整改实际完成日期', rectificationRealityDoneDate: '整改实际完成日期',
rectificationStatus: '整改状态', rectificationStatus: '整改状态',
pleaseFillInspectionContent: '请填写稽查内容' pleaseFillInspectionContent: '请填写稽查内容',
pleaseFillInspectionReport: '请填写稽查报告',
pleaseFillRectificationPlan: '请填写整改计划'
}, },
// 稽查延期申请流程 // 稽查延期申请流程
incExtensionRequest: { incExtensionRequest: {
+5 -2
View File
@@ -283,7 +283,8 @@ module.exports = {
solicitOpinionObject: '征求意见对象', solicitOpinionObject: '征求意见对象',
isCountersign: '是否会签', isCountersign: '是否会签',
countersignRelevantPersonnel: '会签相关人员', countersignRelevantPersonnel: '会签相关人员',
downloadTemplate: '企标稽查计划导入模板' downloadTemplate: '企标稽查计划导入模板',
pleaseFillOpinion: '请填写意见'
}, },
// 企标稽查流程 // 企标稽查流程
esInspectionProcess: { esInspectionProcess: {
@@ -313,7 +314,9 @@ module.exports = {
rectificationPlanDoneDate: '整改计划完成日期', rectificationPlanDoneDate: '整改计划完成日期',
rectificationRealityDoneDate: '整改实际完成日期', rectificationRealityDoneDate: '整改实际完成日期',
rectificationStatus: '整改状态', rectificationStatus: '整改状态',
pleaseFillInspectionContent: '请填写稽查内容' pleaseFillInspectionContent: '请填写稽查内容',
pleaseFillInspectionReport: '请填写稽查报告',
pleaseFillRectificationPlan: '请填写整改计划'
}, },
// 稽查延期申请流程 // 稽查延期申请流程
incExtensionRequest: { incExtensionRequest: {
@@ -349,9 +349,15 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
if (isValidate && this.$refs.inspectionPlanTable.dataSource.length === 0) { if (isValidate && this.$refs.inspectionPlanTable.dataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData')) this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base') if (!flag) {
flag = base
}
} }
// 节点2,验证所有数据意见是否都已填写 // 节点2,验证所有数据意见是否都已填写
if (isValidate && this.currentNode === EsInspectionPlan.fillInComments.value) { if (isValidate && this.currentNode === EsInspectionPlan.fillInComments.value) {
@@ -368,8 +374,10 @@ export default {
} }
}) })
if (opinionHasEmpty) { if (opinionHasEmpty) {
this.$message.warning(this.$t('pleaseCompleteTableInfo')) this.$message.warning(this.$t('workCenter.esInspectionPlan.pleaseFillOpinion'))
throw new Error('base') if (!flag) {
flag = base
}
} }
} }
const params = {} const params = {}
@@ -383,7 +391,13 @@ export default {
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { if (isValidate) {
formDataList = await this.validateFormList(this.processInfoForm, this.countersignForm, this.approvalInfoForm) formDataList = await this.validateFormList(this.processInfoForm, this.countersignForm, this.approvalInfoForm).catch(() => {
if (!flag) {
flag = base
}
// 空数组防止后续操作报错
return []
})
} else { } else {
formDataList = [ formDataList = [
this.processInfoForm.getFieldsValue(), this.processInfoForm.getFieldsValue(),
@@ -394,9 +408,9 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {}) this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
} }
// 收集人员信息 // 收集人员信息
const personInfo = this.getPersonInfo(isValidate) const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) { if (!personInfo) {
throw new Error('user') flag = user
} }
// 开始处理信息 // 开始处理信息
@@ -432,6 +446,11 @@ export default {
// 业务表格数据,用于强制撤回后回显 // 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectPlanList draftData: params.processEsInspectPlanList
}) })
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params return params
}, },
/** /**
@@ -305,30 +305,42 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
// 如果需要校验校验表格数据 // 如果需要校验校验表格数据
if (isValidate) { if (isValidate) {
const list = this.$refs.inspectionProcessTable.dataSource const list = this.$refs.inspectionProcessTable.dataSource
if (list.length === 0) { if (list.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData')) this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base') if (!flag) {
flag = base
}
} }
/** /**
* 调整为前端存储 * 调整为前端存储
*/ */
// 节点1:稽查内容条数不能为0 // 节点1:稽查内容条数不能为0
if (this.isInitiate && list.some(item => !(item.enterpriseStandardInspectContentList && item.enterpriseStandardInspectContentList.length))) { if (this.isInitiate && list.some(item => !(item.enterpriseStandardInspectContentList && item.enterpriseStandardInspectContentList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo')) this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionContent'))
throw new Error('base') if (!flag) {
flag = base
}
} }
// 节点3:稽查报告条数不能为0 // 节点3:稽查报告条数不能为0
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectReportList && item.enterpriseStandardInspectReportList.length))) { if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectReportList && item.enterpriseStandardInspectReportList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo')) this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillInspectionReport'))
throw new Error('base') if (!flag) {
flag = base
}
} }
// 节点3:整改计划条数不能为0 // 节点3:整改计划条数不能为0
if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectRectifyPlanList && item.enterpriseStandardInspectRectifyPlanList.length))) { if (this.isInputInspectionReport && list.some(item => !(item.enterpriseStandardInspectRectifyPlanList && item.enterpriseStandardInspectRectifyPlanList.length))) {
this.$message.warning(this.$t('pleaseCompleteTableInfo')) this.$message.warning(this.$t('workCenter.esInspectionProcess.pleaseFillRectificationPlan'))
throw new Error('base') if (!flag) {
flag = base
}
} }
} }
const params = {} const params = {}
@@ -354,7 +366,13 @@ export default {
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { 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 { } else {
formDataList = [ formDataList = [
this.processInfoForm.getFieldsValue(), this.processInfoForm.getFieldsValue(),
@@ -364,9 +382,9 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {}) this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
} }
// 收集人员信息 // 收集人员信息
const personInfo = this.getPersonInfo(isValidate) const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) { if (!personInfo) {
throw new Error('user') flag = user
} }
// 开始处理信息 // 开始处理信息
@@ -393,6 +411,11 @@ export default {
// 业务表格数据,用于强制撤回后回显 // 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectList draftData: params.processEsInspectList
}) })
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params return params
}, },
/** /**
@@ -5,7 +5,6 @@
:visible="visible" :visible="visible"
:confirmLoading="loading" :confirmLoading="loading"
switchFullscreen switchFullscreen
@ok="handleOk"
@cancel="handleCancel" @cancel="handleCancel"
:cancelText="$t('close')"> :cancelText="$t('close')">
<a-spin :spinning="loading"> <a-spin :spinning="loading">
@@ -39,6 +38,17 @@
</j-table> </j-table>
</a-spin> </a-spin>
<!-- 操作按钮 -->
<template slot="footer">
<a-button :loading="loading" @click="handleCancel">
{{ $t('cancel') }}
</a-button>
<a-button v-if="!disabled" type="primary" :loading="loading" @click="handleOk">
{{ $t('submit') }}
</a-button>
</template>
<!-- 新增编辑稽查内容 --> <!-- 新增编辑稽查内容 -->
<inspection-process-content-modal ref="inspectionProcessContentModal" @ok="modalFormOk"/> <inspection-process-content-modal ref="inspectionProcessContentModal" @ok="modalFormOk"/>
</j-modal> </j-modal>
@@ -85,7 +95,6 @@ export default {
// }, // },
{ {
// 操作 // 操作
fixed: 'right',
title: this.$t('operation'), title: this.$t('operation'),
// dataIndex: 'action', // dataIndex: 'action',
align: 'center', align: 'center',
@@ -107,7 +116,7 @@ export default {
index: -1, index: -1,
// 需要删除的数据id(前端添加后没有保存表的数据没有id) // 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [], delIds: [],
columns: columns.slice(0, this.disabled ? 3 : 4) columns: columns.slice(0, this.disabled ? 2 : 3)
} }
}, },
methods: { methods: {
@@ -5,7 +5,6 @@
:visible="visible" :visible="visible"
:confirmLoading="loading" :confirmLoading="loading"
switchFullscreen switchFullscreen
@ok="handleOk"
@cancel="handleCancel" @cancel="handleCancel"
:cancelText="$t('close')"> :cancelText="$t('close')">
<a-spin :spinning="loading"> <a-spin :spinning="loading">
@@ -47,6 +46,15 @@
</j-table> </j-table>
</a-spin> </a-spin>
<!-- 操作按钮 -->
<template slot="footer">
<a-button :loading="loading" @click="handleCancel">
{{ $t('cancel') }}
</a-button>
<a-button v-if="!disabled" type="primary" :loading="loading" @click="handleOk">
{{ $t('submit') }}
</a-button>
</template>
<!-- 新增、编辑整改计划 --> <!-- 新增、编辑整改计划 -->
<inspection-process-rectification-plan-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/> <inspection-process-rectification-plan-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/>
</j-modal> </j-modal>
@@ -5,7 +5,6 @@
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
switchFullscreen switchFullscreen
@ok="handleOk"
@cancel="handleCancel" @cancel="handleCancel"
:cancelText="$t('close')"> :cancelText="$t('close')">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
@@ -44,6 +43,15 @@
</j-table> </j-table>
</a-spin> </a-spin>
<!-- 操作按钮 -->
<template slot="footer">
<a-button :loading="confirmLoading" @click="handleCancel">
{{ $t('cancel') }}
</a-button>
<a-button v-if="!disabled" type="primary" :loading="confirmLoading" @click="handleOk">
{{ $t('submit') }}
</a-button>
</template>
<!-- 新增、编辑稽查报告 --> <!-- 新增、编辑稽查报告 -->
<inspection-process-report-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/> <inspection-process-report-modal ref="modalForm" @ok="modalFormOk" :temp-data-source="dataSource"/>
<!-- 上传回显 --> <!-- 上传回显 -->
@@ -303,12 +303,26 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
const params = {} const params = {}
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { if (isValidate) {
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm) formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => {
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate() if (!flag) {
flag = base
}
// 设置成数组防止后面报错
return []
})
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate().catch(() => {
if (!flag) {
flag = base
}
})
} else { } else {
formDataList = [ formDataList = [
this.processInfoForm.getFieldsValue(), this.processInfoForm.getFieldsValue(),
@@ -319,9 +333,9 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {}) this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
} }
// 收集人员信息 // 收集人员信息
const personInfo = this.getPersonInfo(isValidate) const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) { if (!personInfo) {
throw new Error('user') flag = user
} }
// 自动发起特殊流程,单独把人员信息存一份 // 自动发起特殊流程,单独把人员信息存一份
@@ -361,6 +375,11 @@ export default {
// 业务表格数据,用于强制撤回后回显 // 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectRectify draftData: params.processEsInspectRectify
}) })
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params return params
}, },
/** /**
@@ -305,10 +305,16 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
// 必须有数据才能提交 // 必须有数据才能提交
if (isValidate && this.$refs.extensionRequestTable.dataSource.length === 0) { if (isValidate && this.$refs.extensionRequestTable.dataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData')) this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base') if (!flag) {
flag = base
}
} }
const params = {} const params = {}
// 收集表格信息 // 收集表格信息
@@ -318,7 +324,13 @@ export default {
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { 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 { } else {
formDataList = [ formDataList = [
this.processInfoForm.getFieldsValue(), this.processInfoForm.getFieldsValue(),
@@ -328,9 +340,9 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {}) this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
} }
// 收集人员信息 // 收集人员信息
const personInfo = this.getPersonInfo(isValidate) const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) { if (!personInfo) {
throw new Error('user') flag = user
} }
// 开始处理信息 // 开始处理信息
@@ -357,6 +369,11 @@ export default {
// 业务表格数据,用于强制撤回后回显 // 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectDelayApplyList draftData: params.processEsInspectDelayApplyList
}) })
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params return params
}, },
/** /**
@@ -408,14 +408,22 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
// 节点1判断表格是否有数据 // 节点1判断表格是否有数据
if (this.isInitiate && this.$refs.baseInfoTable.dataSource.length === 0) { if (this.isInitiate && this.$refs.baseInfoTable.dataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData')) this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base') if (!flag) {
flag = base
}
} else if (!this.isInitiate && this.$refs.applyPermissionTable.dataSource.length === 0) { } else if (!this.isInitiate && this.$refs.applyPermissionTable.dataSource.length === 0) {
// 其他节点判断表单中的表格是否有数据 // 其他节点判断表单中的表格是否有数据
this.$message.warning(this.$t('addAtLeastOneRowOfData')) this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base') if (!flag) {
flag = base
}
} }
// 校验表格中是否已有权限 // 校验表格中是否已有权限
if (isValidate && this.isInitiate) { if (isValidate && this.isInitiate) {
@@ -423,7 +431,9 @@ export default {
await checkPermissionApply({ ids }).then(res => { await checkPermissionApply({ ids }).then(res => {
if (!res.success) { if (!res.success) {
this.$message.warning(res.message) this.$message.warning(res.message)
throw new Error('base') if (!flag) {
flag = base
}
} }
}) })
} }
@@ -431,16 +441,13 @@ export default {
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { if (isValidate) {
// 记录表单验证是否报错
let err = null
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm, this.baseInfoForm).catch(() => { formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm, this.baseInfoForm).catch(() => {
err = true if (!flag) {
flag = base
}
// 设置成数组防止后面报错
return [] return []
}) })
// 如果有错误就跳转表单
if (err !== null) {
throw new Error('base')
}
} else { } else {
formDataList = [ formDataList = [
this.processInfoForm.getFieldsValue(), this.processInfoForm.getFieldsValue(),
@@ -451,9 +458,9 @@ export default {
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {}) this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
} }
// 收集人员信息 // 收集人员信息
const personInfo = this.getPersonInfo(isValidate) const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) { if (!personInfo) {
throw new Error('user') flag = user
} }
// 开始处理信息 // 开始处理信息
@@ -491,6 +498,11 @@ export default {
// 业务数据,用于强制撤回后回显 // 业务数据,用于强制撤回后回显
draftData: params.processEsPermissionApply draftData: params.processEsPermissionApply
}) })
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params return params
}, },
/** /**
@@ -329,23 +329,26 @@ export default {
async getPageParams (isValidate = true) { async getPageParams (isValidate = true) {
// 去除备注必填 // 去除备注必填
this.validatorRules.remarks.rules[0].required = false this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
const params = {} const params = {}
// 收集所有表单信息 // 收集所有表单信息
let formDataList = [] let formDataList = []
if (isValidate) { if (isValidate) {
// 记录表单验证是否报错
let err = null
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => { formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => {
err = true if (!flag) {
flag = base
}
// 设置成数组防止后面报错
return [] return []
}) })
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate().catch(() => { formDataList[2] = await this.$refs.baseInfoForm.getDataValidate().catch(() => {
err = true if (!flag) {
flag = base
}
}) })
// 如果有错误就跳转表单
if (err !== null) {
throw new Error('base')
}
} else { } else {
formDataList = [ formDataList = [
this.processInfoForm.getFieldsValue(), this.processInfoForm.getFieldsValue(),
@@ -357,9 +360,9 @@ export default {
} }
// 收集人员信息 // 收集人员信息
const personInfo = this.getPersonInfo(isValidate) const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) { if (!personInfo) {
throw new Error('user') flag = user
} }
// 开始处理信息 // 开始处理信息
@@ -397,6 +400,11 @@ export default {
// 业务数据,用于强制撤回后回显 // 业务数据,用于强制撤回后回显
draftData: params.processMeetingManage draftData: params.processMeetingManage
}) })
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params return params
}, },
/** /**
@@ -354,6 +354,10 @@ export default {
this.disabledInitiator = val ? !!ids : true this.disabledInitiator = val ? !!ids : true
this.initiatorName = names this.initiatorName = names
this.$set(this.formInline, 'initiator', ids) this.$set(this.formInline, 'initiator', ids)
// 如果接口有回显,就去掉校验信息
if (ids) {
this.$refs.ruleForm.clearValidate('initiator')
}
} }
}) })
} }