From a035ac63aafb58050a83fb4221bbdbfbdac6a6c4 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Wed, 1 Nov 2023 19:33:54 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BC=81=E6=A0=87=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RevisionPlanActivelyReportFlow.vue | 94 +++++++++---------- .../modules/ContactEnterSendTaskForm.vue | 35 ++++--- .../RevisionPlanStandardizationInitFlow.vue | 39 ++++---- 3 files changed, 86 insertions(+), 82 deletions(-) diff --git a/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue b/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue index 84043ec4..ccaf389c 100644 --- a/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue +++ b/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue @@ -49,7 +49,7 @@ v-decorator="['prcMes']" /> - + { // 初始化流程信息,节点1没有制修订计划说明,其余节点都有制修订计划说明 - if (this.currentNode === 1) { - this.processInfoForm.setFieldsValue(pick(this.model.common, 'prcName', 'dueTime', 'prcMes')) - } else { - this.processInfoForm.setFieldsValue(pick(this.model.common, 'prcName', 'dueTime', 'prcMes', 'processDescription')) - } + this.processInfoForm.setFieldsValue(pick(this.model.common, 'prcName', 'dueTime', 'prcMes', 'processDescription')) // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile')) }) @@ -486,26 +482,25 @@ export default { // 流程信息校验 this.processInfoForm.validateFields((err, values) => { // 流程审批信息校验 - this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { + this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => { // 需要校验业务基本信息中的表单 - this.$refs.baseInfoFormRef.getDataValidate(data => { - if (!err && !approvalErr && data) { - this.loading = true - const param = {} // 需要给后端的参数 - param.common = { ...values, ...approvalValues, ...data.formInline } - param.flowUser = personnelObj - activelyReportApproval(param).then(res => { - if (res.success) { - this.$message.success(res.message) - this.goBack() - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - } - }) + const data = await this.$refs.baseInfoFormRef.getDataValidate() + if (!err && !approvalErr && data) { + this.loading = true + const param = {} // 需要给后端的参数 + param.common = { ...values, ...approvalValues, ...data.formInline } + param.flowUser = personnelObj + activelyReportApproval(param).then(res => { + if (res.success) { + this.$message.success(res.message) + this.goBack() + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } }) }) }, @@ -540,34 +535,37 @@ export default { handleSubmit () { if (this.loading) return // 流程审批信息校验 - this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { - this.$refs.baseInfoFormRef.getDataValidate(data => { - if (approvalErr && data) { - this.loading = true - const param = {} // 传给后端的参数 - // 节点2,3有表单和表格,节点4只有表格 - if ([2, 3].includes(this.currentNode)) { - // 业务基本信息有表单也有表格 - param.common = approvalValues + this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => { + const data = await this.$refs.baseInfoFormRef.getDataValidate() + const param = {} // 传给后端的参数 + if (!approvalErr && data) { + this.loading = true + // 节点2可能是表单和表格也可能只有表单,节点3有表单和表格,节点4只有表格 + if ([2, 3].includes(this.currentNode)) { + // 业务基本信息有表单也有表格 + if (data.dataSource) { param.dataList = data.dataSource.map(item => { return { ...item, ...data.formInline } }) - } else if (this.currentNode === 5) { - param.common = approvalValues - param.dataList = data.dataSource + } else { + param.dataList = [data.formInline] } - activelyReportAgree(param).then(res => { - if (res.success) { - this.$message.success(res.message) - this.goBack() - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) + } else if (this.currentNode === 5) { + param.dataList = data.dataSource } - }) + param.common = approvalValues + param.common.taskId = this.$route.query.taskId + activelyReportAgree(param).then(res => { + if (res.success) { + this.$message.success(res.message) + this.goBack() + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } }) }, // 同意(节点4,6有同意) diff --git a/src/views/workCenter/annualRevisionPlanActivelyReport/modules/ContactEnterSendTaskForm.vue b/src/views/workCenter/annualRevisionPlanActivelyReport/modules/ContactEnterSendTaskForm.vue index 1b1194b6..d92d789a 100644 --- a/src/views/workCenter/annualRevisionPlanActivelyReport/modules/ContactEnterSendTaskForm.vue +++ b/src/views/workCenter/annualRevisionPlanActivelyReport/modules/ContactEnterSendTaskForm.vue @@ -99,7 +99,7 @@ export default { distributeFlag: [ { required: true, - message: this.$t('workCenter.enterpriseInitChangePlan.enterpriseStandardNum') + this.$t('cannotEmpty'), + message: this.$t('workCenter.revisionPlanActivelyReport.whetherToSendAContact') + this.$t('cannotEmpty'), trigger: 'change' } ], @@ -107,7 +107,7 @@ export default { workGroupUser: [ { required: true, - message: this.$t('workCenter.enterpriseInitChangePlan.workingGroupContactPerson') + this.$t('cannotEmpty'), + message: this.$t('workCenter.revisionPlanActivelyReport.workingGroupContactPerson') + this.$t('cannotEmpty'), trigger: 'change' } ], @@ -115,7 +115,7 @@ export default { contactUserLeaderLeader: [ { required: true, - message: this.$t('workCenter.enterpriseInitChangePlan.contactSupervisorSuperiorLeader') + this.$t('cannotEmpty'), + message: this.$t('workCenter.revisionPlanActivelyReport.contactSupervisorSuperiorLeader') + this.$t('cannotEmpty'), trigger: 'change' } ] @@ -158,25 +158,30 @@ export default { return data }, // 外层获取数据要过校验,返回false表示没有通过校验 - getDataValidate (callback) { + async getDataValidate () { + console.log('------getDataValidate------') // 可能是表单,也可能是表格,表单校验一定要填,有是否下发联络人 - this.$refs.ruleForm.validate(result => { + let data = {}// 返回的数据 + await this.$refs.ruleForm.validate(async result => { if (result) { - if (this.$refs.tableRef.dataSource && this.$refs.tableRef.dataSource.length > 0) { - const data = {} - data.formInline = this.formInline - data.dataSource = this.$refs.tableRef.dataSource - callback(data) + if (this.$refs.tableRef) { + // 存在表格说明是否下发联络人选择了否 + if (this.$refs.tableRef.dataSource && this.$refs.tableRef.dataSource.length > 0) { + data.formInline = this.formInline + data.dataSource = this.$refs.tableRef.dataSource + } else { + this.$message.warning(this.$t('addAtLeastOneRowOfData')) + data = false + } } else { - this.$message.warning(this.$t('addAtLeastOneRowOfData')) - const data = false - callback(data) + // 是否下发联络人选择了是 + data.formInline = this.formInline } } else { - const data = false - callback(data) + data = false } }) + return data } } } diff --git a/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue b/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue index 9cd61316..1a3b89c0 100644 --- a/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue +++ b/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue @@ -85,7 +85,7 @@
- +
@@ -232,6 +232,25 @@ export default { // 没有taskId说明是新建进来的,初始化人员信息 this.personnelInfoData = personData } + // 初始化节点 + const taskName = this.$route.query.taskName + if (taskName) { + if (taskName === '标准化工程师发起') { + this.currentNode = 1 + } else if (taskName === '各部所联络人 填写/下发任务') { + this.currentNode = 2 + } else if (taskName === '主起草单位主管级领导审批下发') { + this.currentNode = 3 + } else if (taskName === '主起草人填写信息') { + this.currentNode = 4 + } else if (taskName === '部所联络人汇总') { + this.currentNode = 5 + } else if (taskName === '主起草单位主管级领导批准') { + this.currentNode = 6 + } else { + this.currentNode = 7 + } + } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { this.onlyLook = this.$route.query.onlyLook @@ -302,24 +321,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile')) }) - const taskName = this.$route.query.taskName - if (taskName) { - if (taskName === '标准化工程师发起') { - this.currentNode = 1 - } else if (taskName === '部所联络人选取审批人') { - this.currentNode = 2 - } else if (taskName === '主起草单位主管级领导审批下发') { - this.currentNode = 3 - } else if (taskName === '主起草人填写信息') { - this.currentNode = 4 - } else if (taskName === '部所联络人汇总') { - this.currentNode = 5 - } else if (taskName === '主起草单位主管级领导批准') { - this.currentNode = 6 - } else { - this.currentNode = 7 - } - } if (this.currentNode === 1) { this.personnelInfoData = personData.map(item => { if (item.fieldName) {