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: '征求意见对象',
isCountersign: '是否会签',
countersignRelevantPersonnel: '会签相关人员',
downloadTemplate: '企标稽查计划导入模板'
downloadTemplate: '企标稽查计划导入模板',
pleaseFillOpinion: '请填写意见'
},
// 企标稽查流程
esInspectionProcess: {
@@ -279,7 +280,9 @@ module.exports = {
rectificationPlanDoneDate: '整改计划完成日期',
rectificationRealityDoneDate: '整改实际完成日期',
rectificationStatus: '整改状态',
pleaseFillInspectionContent: '请填写稽查内容'
pleaseFillInspectionContent: '请填写稽查内容',
pleaseFillInspectionReport: '请填写稽查报告',
pleaseFillRectificationPlan: '请填写整改计划'
},
// 稽查延期申请流程
incExtensionRequest: {
+5 -2
View File
@@ -283,7 +283,8 @@ module.exports = {
solicitOpinionObject: '征求意见对象',
isCountersign: '是否会签',
countersignRelevantPersonnel: '会签相关人员',
downloadTemplate: '企标稽查计划导入模板'
downloadTemplate: '企标稽查计划导入模板',
pleaseFillOpinion: '请填写意见'
},
// 企标稽查流程
esInspectionProcess: {
@@ -313,7 +314,9 @@ module.exports = {
rectificationPlanDoneDate: '整改计划完成日期',
rectificationRealityDoneDate: '整改实际完成日期',
rectificationStatus: '整改状态',
pleaseFillInspectionContent: '请填写稽查内容'
pleaseFillInspectionContent: '请填写稽查内容',
pleaseFillInspectionReport: '请填写稽查报告',
pleaseFillRectificationPlan: '请填写整改计划'
},
// 稽查延期申请流程
incExtensionRequest: {
@@ -349,9 +349,15 @@ 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 && this.$refs.inspectionPlanTable.dataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base')
if (!flag) {
flag = base
}
}
// 节点2,验证所有数据意见是否都已填写
if (isValidate && this.currentNode === EsInspectionPlan.fillInComments.value) {
@@ -368,8 +374,10 @@ export default {
}
})
if (opinionHasEmpty) {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
throw new Error('base')
this.$message.warning(this.$t('workCenter.esInspectionPlan.pleaseFillOpinion'))
if (!flag) {
flag = base
}
}
}
const params = {}
@@ -383,7 +391,13 @@ export default {
// 收集所有表单信息
let formDataList = []
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 {
formDataList = [
this.processInfoForm.getFieldsValue(),
@@ -394,9 +408,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
}
// 开始处理信息
@@ -432,6 +446,11 @@ export default {
// 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectPlanList
})
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params
},
/**
@@ -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
},
/**
@@ -5,7 +5,6 @@
:visible="visible"
:confirmLoading="loading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
:cancelText="$t('close')">
<a-spin :spinning="loading">
@@ -39,6 +38,17 @@
</j-table>
</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"/>
</j-modal>
@@ -85,7 +95,6 @@ export default {
// },
{
// 操作
fixed: 'right',
title: this.$t('operation'),
// dataIndex: 'action',
align: 'center',
@@ -107,7 +116,7 @@ export default {
index: -1,
// 需要删除的数据id(前端添加后没有保存表的数据没有id)
delIds: [],
columns: columns.slice(0, this.disabled ? 3 : 4)
columns: columns.slice(0, this.disabled ? 2 : 3)
}
},
methods: {
@@ -5,7 +5,6 @@
:visible="visible"
:confirmLoading="loading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
:cancelText="$t('close')">
<a-spin :spinning="loading">
@@ -47,6 +46,15 @@
</j-table>
</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"/>
</j-modal>
@@ -5,7 +5,6 @@
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
:cancelText="$t('close')">
<a-spin :spinning="confirmLoading">
@@ -44,6 +43,15 @@
</j-table>
</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"/>
<!-- 上传回显 -->
@@ -303,12 +303,26 @@ export default {
async getPageParams (isValidate = true) {
// 去除备注必填
this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
const params = {}
// 收集所有表单信息
let formDataList = []
if (isValidate) {
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm)
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate()
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => {
if (!flag) {
flag = base
}
// 设置成数组防止后面报错
return []
})
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate().catch(() => {
if (!flag) {
flag = base
}
})
} else {
formDataList = [
this.processInfoForm.getFieldsValue(),
@@ -319,9 +333,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
}
// 自动发起特殊流程,单独把人员信息存一份
@@ -361,6 +375,11 @@ export default {
// 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectRectify
})
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params
},
/**
@@ -305,10 +305,16 @@ 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 && this.$refs.extensionRequestTable.dataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base')
if (!flag) {
flag = base
}
}
const params = {}
// 收集表格信息
@@ -318,7 +324,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(),
@@ -328,9 +340,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
}
// 开始处理信息
@@ -357,6 +369,11 @@ export default {
// 业务表格数据,用于强制撤回后回显
draftData: params.processEsInspectDelayApplyList
})
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params
},
/**
@@ -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
},
/**
@@ -329,23 +329,26 @@ export default {
async getPageParams (isValidate = true) {
// 去除备注必填
this.validatorRules.remarks.rules[0].required = false
// 报错标记(base基本信息校验失败,user人员信息校验失败)
let flag = ''
const base = 'base'
const user = 'user'
const params = {}
// 收集所有表单信息
let formDataList = []
if (isValidate) {
// 记录表单验证是否报错
let err = null
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm).catch(() => {
err = true
if (!flag) {
flag = base
}
// 设置成数组防止后面报错
return []
})
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate().catch(() => {
err = true
if (!flag) {
flag = base
}
})
// 如果有错误就跳转表单
if (err !== null) {
throw new Error('base')
}
} else {
formDataList = [
this.processInfoForm.getFieldsValue(),
@@ -357,9 +360,9 @@ export default {
}
// 收集人员信息
const personInfo = this.getPersonInfo(isValidate)
const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) {
throw new Error('user')
flag = user
}
// 开始处理信息
@@ -397,6 +400,11 @@ export default {
// 业务数据,用于强制撤回后回显
draftData: params.processMeetingManage
})
// 如果有校验失败的,那就报错
if (flag) {
throw new Error(flag)
}
return params
},
/**
@@ -354,6 +354,10 @@ export default {
this.disabledInitiator = val ? !!ids : true
this.initiatorName = names
this.$set(this.formInline, 'initiator', ids)
// 如果接口有回显,就去掉校验信息
if (ids) {
this.$refs.ruleForm.clearValidate('initiator')
}
}
})
}