From 776ee7c670845eac1b3b2c866cd672ea335b20f7 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Fri, 27 Oct 2023 13:51:44 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BC=81=E6=A0=87=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E7=AB=8B=E9=A1=B9=E3=80=81=E6=9B=B4=E6=94=B9=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PersonnelInfo.vue | 6 +- .../PlanApprovalChangeFlow.vue | 144 ++++++++++++------ .../processCenter/table/TodoList.vue | 2 +- 3 files changed, 104 insertions(+), 48 deletions(-) diff --git a/src/components/PersonnelInfo.vue b/src/components/PersonnelInfo.vue index 47aa4a23..59189c38 100644 --- a/src/components/PersonnelInfo.vue +++ b/src/components/PersonnelInfo.vue @@ -29,9 +29,9 @@
{{ step.userList }}
diff --git a/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue b/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue index 15220bb8..d56bf119 100644 --- a/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue +++ b/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue @@ -73,6 +73,7 @@ {{ $t('workCenter.enterpriseInitChangePlan.standardProjectEstablishment') }} {{ $t('workCenter.enterpriseInitChangePlan.change') }} @@ -442,47 +443,20 @@ export default { // } // } }, - watch: { - 'formInline.applicationCategory' (value) { - if (value) { - if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) { - if (this.currentNode === 1) { - this.personnelInfoData = approvalPersonalInfo - } else { - this.personnelInfoData = this.personnelInfoData.map(item => { - return { ...item, canChoose: false } - }) - } - } else { - if (this.currentNode === 1) { - this.personnelInfoData = changePersonalInfo - } else { - this.personnelInfoData = this.personnelInfoData.map(item => { - return { ...item, canChoose: false } - }) - } - } - } - if (this.formInline.projectType) { - this.formInline.projectType = undefined - } - } - }, + // watch: { + // // 也只有节点1才会改变,应该在初始化数据的时候不触发才对?? + // 'formInline.applicationCategory' (value) { + // + // } + // }, mounted () { console.log(this.$route.query.taskId) if (this.$route.query.taskId) { - this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点 // 有流程id说明是从流程中心来的,需要初始化数据 this.getProcessData(this.$route.query.taskId) - } - if (this.currentNode === 1) { - this.personnelInfoData = approvalPersonalInfo - this.disabled = false } else { - this.personnelInfoData = approvalPersonalInfo.map(item => { - return { ...item, canChoose: false, fieldName: undefined } - }) - this.disabled = true + // 没有taskId说明是新建进来的,初始化人员信息 + this.personnelInfoData = approvalPersonalInfo } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { @@ -553,7 +527,7 @@ export default { { required: true, message: this.$t('workCenter.enterpriseInitChangePlan.applicationType') + this.$t('cannotEmpty'), - trigger: 'change' + trigger: ['change', 'blur'] } ], // 项目类别 @@ -586,22 +560,88 @@ export default { // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile')) }) // 初始化业务基本信息的申请类型和项目类别 - this.formInline.applicationCategory = this.model.dataList[0].applicationCategory - this.formInline.projectType = this.model.dataList[0].projectType + const baseInfoForm = {} + baseInfoForm.applicationCategory = this.model.dataList[0].applicationCategory + this.formInline = Object.assign({}, baseInfoForm) + this.$nextTick(() => { + baseInfoForm.projectType = this.model.dataList[0].projectType + this.formInline = Object.assign({}, baseInfoForm) + }) + // 初始化流程节点,此流程因为节点名称有重复,需要在此处根据applicationCatsegory做一些判断 + const taskName = this.$route.query.taskName + if (taskName) { + if (taskName === '主起草人发起') { + this.currentNode = 1 + } else if (taskName === '部所联络人校对') { + this.currentNode = 2 + } else if (taskName === '专家审批' || taskName === '主起草人主管级领导审批') { + this.currentNode = 3 + } else if (taskName === '发起人主管级领导审批' || taskName === '主起草人主管级上一级领导审批') { + this.currentNode = 4 + } else if (taskName === '发起人主管级上级领导审批' || (taskName === '标准化审批' && this.formInline.applicationCategory === this.ApplicationCategory.CHANGE.value)) { + this.currentNode = 5 + } else if ((taskName === '标准化审批' && this.formInline.applicationCategory === this.ApplicationCategory.INITIATION.value) || taskName === '新起草部门主管级上一级领导下发') { + this.currentNode = 6 + } else if (taskName === '新起草部门主管级领导确认') { + this.currentNode = 7 + } else if (taskName === '相关人员会签') { + this.currentNode = 8 + } else { + this.currentNode = 9 + } + } + // 根据流程节点初始化是否可以编辑 + if (this.currentNode === 1) { + this.disabled = false + } else { + this.disabled = true + } // 初始化人员信息 todo: 发起人还没处理 - if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) { + if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value && this.currentNode === 1) { + // 立项的节点1 this.personnelInfoData = approvalPersonalInfo.map(item => { if (item.fieldName) { - return { ...item, user: this.model.flowUser [item.fieldName], userList: this.model.flowUser [item.fieldName + '_dictText'], canChoose: false } + return { + ...item, + user: this.model.flowUser[item.fieldName], + user_dictText: this.model.flowUser[item.fieldName + '_dictText'] + } + } else { + return item + } + }) + } else if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) { + // 立项的其他节点 + this.personnelInfoData = approvalPersonalInfo.map(item => { + if (item.fieldName) { + return { + ...item, + user: this.model.flowUser[item.fieldName], + userList: this.model.flowUser[item.fieldName + '_dictText'], + canChoose: false + } + } else { + return item + } + }) + } else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value && this.currentNode === 1) { + // 变更的节点1 + this.personnelInfoData = changePersonalInfo.map(item => { + if (item.fieldName) { + return { + ...item, + user: this.model.flowUser[item.fieldName], + user_dictText: this.model.flowUser[item.fieldName + '_dictText'] + } } else { return item } }) } else { + // 变更的其他节点 this.personnelInfoData = changePersonalInfo.map(item => { - console.log(item) if (item.fieldName) { - return { ...item, user: this.model.flowUser [item.fieldName], userList: this.model.flowUser [item.fieldName + '_dictText'], canChoose: false } + return { ...item, user: this.model.flowUser[item.fieldName], userList: this.model.flowUser[item.fieldName + '_dictText'], canChoose: false } } else { return item } @@ -647,6 +687,19 @@ export default { switchChange (value) { this.switchValue = value }, + // 申请类型改变 + applicationCategoryChange (value) { + if (value) { + if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) { + this.personnelInfoData = approvalPersonalInfo + } else { + this.personnelInfoData = changePersonalInfo + } + } + if (this.formInline.projectType) { + this.formInline.projectType = undefined + } + }, // 业务基本信息组件中获取到流程名称改变后的值 processNameChange (value) { const param = { prcName: value } @@ -749,7 +802,7 @@ export default { const param = {} // 传给后端的参数 param.common = { ...processInfoForm, ...approvalInfoForm } // 流程信息和流程审批信息 param.dataList = arr // 业务基础信息数组 - param.flowUser = personnelObj // 人员信息 + param.flowUser = personnelObj // 人员信息 // 保存到草稿 enterprisePlanApprovalSave(param).then(res => { if (res.success) { @@ -781,6 +834,7 @@ export default { this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) return } + console.log(this.formInline) this.processInfoForm.validateFields((err, values) => { this.$refs.ruleForm.validate(valid => { this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { @@ -832,6 +886,7 @@ export default { // 是变更-合并 this.$refs.changeBaseInfo.$refs.ruleForm.validate(changeBaseValid => { if (valid && changeBaseValid && !err && !approvalErr) { + this.loading = true const changeBaseInfo = this.$refs.changeBaseInfo.formInline if (changeBaseInfo.projectTypeOne !== changeBaseInfo.projectTypeTwo) { // 合并时候的两个计划需要限定修订+修订,或者制定+制定 @@ -864,11 +919,12 @@ export default { const param = {} // 需要传给后端的数据 param.common = { ...values, ...approvalValues } // 流程信息和流程审批信息 param.dataList = arr - param.flowUser = personnelObj + param.flowUser = personnelObj let func if (this.$route.query.taskId) { // 有taskId说明是驳回的提交 func = enterprisePlanApprovalAgree + param.common.taskId = this.$route.query.taskId } else { func = enterprisePlanApproval } diff --git a/src/views/workCenter/processCenter/table/TodoList.vue b/src/views/workCenter/processCenter/table/TodoList.vue index ef7cf90c..0c148d67 100644 --- a/src/views/workCenter/processCenter/table/TodoList.vue +++ b/src/views/workCenter/processCenter/table/TodoList.vue @@ -147,7 +147,7 @@ export default { this.$router.push({ path: path, query: { - currentNode: record.currentNode, + taskName: record.taskName, processId: record.id, // 流程id taskId: record.taskId // 任务id }