From 370f59d7bd4cac3e1d92866a2b3063b5547c7c5f Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Thu, 9 Nov 2023 15:28:36 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9=E4=BC=81=E6=A0=87?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=90=84=E6=A8=A1=E5=9D=97=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PersonnelInfo.vue | 3 + src/enums/commonEnums.js | 6 + src/mixins/WorkCenterMixin.js | 23 +- .../RevisionPlanActivelyReportFlow.vue | 15 +- .../RevisionPlanStandardizationInitFlow.vue | 65 ++---- .../EnterpriseStandardAnnulFlow.vue | 111 ++++----- .../EnterpriseStandardChangeFlow.vue | 127 +++++------ .../PlanApprovalChangeFlow.vue | 215 ++---------------- .../EnterpriseStandardRecheckFlow.vue | 126 +++++----- .../EnterpriseStandardSealSaveFlow.vue | 86 +++---- .../EnterpriseStandardStartUseFlow.vue | 113 ++++----- 11 files changed, 351 insertions(+), 539 deletions(-) diff --git a/src/components/PersonnelInfo.vue b/src/components/PersonnelInfo.vue index ba9a9809..19a520d8 100644 --- a/src/components/PersonnelInfo.vue +++ b/src/components/PersonnelInfo.vue @@ -159,6 +159,9 @@ export default { font-family: PingFang SC-Regular, PingFang SC, sans-serif; color: #FFFFFF; line-height: 36px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } } diff --git a/src/enums/commonEnums.js b/src/enums/commonEnums.js index 27efd689..c7e26480 100644 --- a/src/enums/commonEnums.js +++ b/src/enums/commonEnums.js @@ -155,6 +155,12 @@ export const ProcessKey = { ES_ANNUAL_REPORT: { text: 'es-annual-report', value: 'es-annual-report' }, // 年度制修订-标准化部门主动发起 ES_ANNUAL_INIT: { text: 'es-annual-init', value: 'es-annual-init' }, + // 企标制修订流程 + // 企标更改流程 + // 企标复审流程 + // 企标废止流程 + // 企标封存流程 + // 已封存企标启用流程 // 标准法规入库/变更流程 FB_ENTRY_CHANGE: { text: 'fb-entry-change', value: 'fb-entry-change' } } diff --git a/src/mixins/WorkCenterMixin.js b/src/mixins/WorkCenterMixin.js index 0b9aab76..35d9fb0f 100644 --- a/src/mixins/WorkCenterMixin.js +++ b/src/mixins/WorkCenterMixin.js @@ -34,20 +34,15 @@ export const WorkCenterMixin = { } }) }, - /** - * 待办中进入需要初始化人员信息数据 - * @param isFirstNode 是否是第一个节点,第一个节点需要能编辑的可以编辑并且回显数据 - */ - initPersonInfoData (isFirstNode) { - if (!isFirstNode) { - this.personnelInfoData = this.personnelInfoData.map(item => { - return { - ...item, - userList: item.linkUserIds_dictText, - canChoose: 0 - } - }) - } + // 待办中进入不是第一个节点时需要初始化人员信息数据,并且都不可选 + initPersonInfoData () { + this.personnelInfoData = this.personnelInfoData.map(item => { + return { + ...item, + userList: item.linkUserIds_dictText, + canChoose: 0 + } + }) }, // 操作完成返回 goBack () { diff --git a/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue b/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue index f2630a89..8aa92429 100644 --- a/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue +++ b/src/views/workCenter/annualRevisionPlanActivelyReport/RevisionPlanActivelyReportFlow.vue @@ -191,7 +191,7 @@ export default { mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' }, // 流程信息不能编辑 processInfoDisabled () { @@ -237,6 +237,10 @@ export default { this.currentNode = 999 } } + // 如果不是第一个节点,人员信息全部不可选 + if (this.currentNode !== 1) { + this.initPersonInfoData() + } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { this.onlyLook = this.$route.query.onlyLook @@ -289,6 +293,7 @@ export default { } }, currentNode: 1, + currentNodeName: '', approvalInfoForm: this.$form.createForm(this), // 审批信息表单 personnelInfoData: [], // 人员信息数据 url: { @@ -308,14 +313,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile')) }) - // 初始化人员信息 - if (this.currentNode === 1) { - // 初始化人员信息数据 - this.initPersonInfoData(true) - } else { - // 初始化人员信息数据 - this.initPersonInfoData(false) - } // 初始化业务基本信息 if (this.currentNode === 1) { // 节点1需要回显数据 diff --git a/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue b/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue index bff54b9a..7456ee62 100644 --- a/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue +++ b/src/views/workCenter/annualRevisionPlanStandardizationInit/RevisionPlanStandardizationInitFlow.vue @@ -149,6 +149,8 @@ import { import Vue from 'vue' import { USER_INFO } from '@/store/mutation-types' import pick from 'lodash.pick' +import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' +import { ProcessKey } from '../../../enums/commonEnums' const personData = [ { @@ -215,9 +217,10 @@ export default { ProcessDetailList, PersonnelInfo }, + mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' }, // 流程信息不能编辑 processInfoDisabled () { @@ -225,12 +228,14 @@ export default { } }, mounted () { + // 获取人员信息结构 + this.getPersonInfoStructure(ProcessKey.ES_ANNUAL_INIT.value) if (this.$route.query.taskId) { + this.currentNodeName = this.$route.query.taskName // 有流程id说明是从流程中心来的,需要初始化数据 this.getProcessData(this.$route.query.taskId) } else { - // 没有taskId说明是新建进来的,初始化人员信息 - this.personnelInfoData = personData + this.currentNodeName = '标准化工程师发起' } // 初始化节点 const taskName = this.$route.query.taskName @@ -254,6 +259,10 @@ export default { this.currentNode = 999 } } + // 如果不是第一个节点,人员信息全部不可选 + if (this.currentNode !== 1) { + this.initPersonInfoData() + } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { this.onlyLook = this.$route.query.onlyLook @@ -306,11 +315,13 @@ export default { } }, currentNode: 1, + currentNodeName: '', approvalInfoForm: this.$form.createForm(this), // 审批信息表单 personnelInfoData: [], // 人员信息数据 url: { list: '' // 人员信息右侧表的分页查询接口 - } + }, + model: {} } }, methods: { @@ -324,27 +335,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile')) }) - if (this.currentNode === 1) { - this.personnelInfoData = personData.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 = personData.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 - } - }) - } this.$refs.baseInfoRef.initData(this.model.dataList) } else { this.$message.warning(res.message) @@ -362,13 +352,7 @@ export default { // 流程审批信息 const approvalInfoForm = this.approvalInfoForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } + const personnelObj = this.$refs.personnelInfogetDataObj() // 需要传给后端的 const param = {} param.common = { ...processInfoForm, ...approvalInfoForm } @@ -412,18 +396,8 @@ export default { handleStart () { if (this.loading) return // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName && item.canChoose) { - personnelObj[item.fieldName] = item.user - } - } - // 发起人,标准化工程师设置为当前登录人 - personnelObj.standardEngineer = Vue.ls.get(USER_INFO).id - // 校验是否填了所有能填的人员信息 - if (!Object.values(personnelObj).every(v => !!v)) { - this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) + const personnelObj = this.$refs.personnelInfo.getDataObjVerify() + if (!personnelObj) { return } this.processInfoForm.validateFields((err, values) => { @@ -545,9 +519,6 @@ export default { }) } }) - }, - goBack () { - this.$router.go(-1) } } } diff --git a/src/views/workCenter/enterpriseStandardAnnul/EnterpriseStandardAnnulFlow.vue b/src/views/workCenter/enterpriseStandardAnnul/EnterpriseStandardAnnulFlow.vue index 2a9e14f1..44a4e199 100644 --- a/src/views/workCenter/enterpriseStandardAnnul/EnterpriseStandardAnnulFlow.vue +++ b/src/views/workCenter/enterpriseStandardAnnul/EnterpriseStandardAnnulFlow.vue @@ -124,6 +124,7 @@ import { enStandardAnnulReject } from '@/api/workCenter' import BaseInfoForm from './modules/BaseInfoForm' +import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' // 人员信息 const personalInfo = [ // 人员信息的数据 @@ -169,25 +170,48 @@ export default { PersonnelInfo, UserSelectModal }, + mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' } }, mounted () { - if (this.$route.query.processId) { - this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点 + // 获取人员信息结构 + this.getPersonInfoStructure() + if (this.$route.query.taskId) { + this.currentNodeName = this.$route.query.taskName // 有流程id说明是从流程中心来的,需要初始化数据 this.getProcessData(this.$route.query.taskId) + } else { + this.currentNodeName = '发起人发起' + } + // 初始化节点 + 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 { + // 预留加签节点 + this.currentNode = 999 + } } if (this.currentNode === 1) { - this.personnelInfoData = personalInfo this.disabled = false } else { - this.personnelInfoData = personalInfo.map(item => { - return { ...item, canChoose: false, fieldName: undefined } - }) this.disabled = true + // 如果不是第一个节点,人员信息全部不可选 + this.initPersonInfoData() } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { @@ -202,7 +226,8 @@ export default { disabled: false, onlyLook: false, // 是否仅查看 currentNode: 1, // 当前节点 - model: [], + currentNodeName: '', + model: {}, processInfoForm: this.$form.createForm(this), labelCol: { xs: { span: 24 }, @@ -255,14 +280,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment')) }) - // 初始化人员信息 todo: 发起人还没处理 - this.personnelInfoData = personalInfo.map(item => { - if (item.fieldName) { - return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false } - } else { - return item - } - }) // 初始化业务基本信息中组件内容 } else { this.$message.warning(res.message) @@ -288,15 +305,7 @@ export default { // 流程审批信息 const approvalInfoForm = this.approvalInfoForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 需要传给后端的数据 - const arr = [] + const personnelObj = this.$refs.personnelInfo.getDataObj() // 业务基本信息 const baseInfo = this.$refs.baseInfoRef.getData() const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj } @@ -306,10 +315,14 @@ export default { this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) return } - arr.push(param) + // 需要传给后端的数据 + const paramObj = {} + paramObj.common = { ...processInfoForm, ...approvalInfoForm } + paramObj.flowUser = personnelObj + paramObj.dataList = [baseInfo.formInline] this.loading = true // 保存到草稿 - enStandardAnnulSave(arr).then(res => { + enStandardAnnulSave(paramObj).then(res => { if (res.success) { this.$message.success(res.message) } else { @@ -323,36 +336,30 @@ export default { handleStart () { if (this.loading) return // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 校验是否填了所有能填的人员信息 - if (!Object.values(personnelObj).every(v => !!v)) { - this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) + const personnelObj = this.$refs.personnelInfo.getDataObjVerify() + if (!personnelObj) { return } // 流程信息的校验 this.processInfoForm.validateFields((err, values) => { // 流程审批信息的校验 - this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { - this.$refs.baseInfoRef.getDataValidate(data => { - if (!err && !approvalErr && data) { - const arr = [] // 需要传给后端的数据 - enStandardAnnulApproval(arr).then(res => { - if (res.success) { - this.$message.success(res.message) - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - } - }) + this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => { + const data = await this.$refs.baseInfoRef.getDataValidate() + if (!err && !approvalErr && data) { + const paramObj = {} // 需要传给后端的数据 + paramObj.common = { ...values, ...approvalValues } + paramObj.flowUser = personnelObj + paramObj.dataList = [data.formInline] + enStandardAnnulApproval(paramObj).then(res => { + if (res.success) { + this.$message.success(res.message) + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } }) }) }, diff --git a/src/views/workCenter/enterpriseStandardChange/EnterpriseStandardChangeFlow.vue b/src/views/workCenter/enterpriseStandardChange/EnterpriseStandardChangeFlow.vue index 5f023064..dcf7b438 100644 --- a/src/views/workCenter/enterpriseStandardChange/EnterpriseStandardChangeFlow.vue +++ b/src/views/workCenter/enterpriseStandardChange/EnterpriseStandardChangeFlow.vue @@ -126,6 +126,7 @@ import { } from '@/api/workCenter' import MainDrafterInitBaseInfo from './modules/MainDrafterInitBaseInfo' import ApproveBaseInfo from './modules/ApproveBaseInfo' +import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' // 人员信息 const personalInfo = [ // 人员信息的数据 @@ -181,18 +182,21 @@ export default { PersonnelInfo, UserSelectModal }, + mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' } }, mounted () { + // 获取人员信息结构 + this.getPersonInfoStructure() if (this.$route.query.taskId) { + this.currentNodeName = this.$route.query.taskName // 有流程id说明是从流程中心来的,需要初始化数据 this.getProcessData(this.$route.query.taskId) } else { - // 没有taskId说明是新建进来的,初始化人员信息 - this.personnelInfoData = personalInfo + this.currentNodeName = '标准化工程师发起' } // 初始化节点 const taskName = this.$route.query.taskName @@ -216,6 +220,7 @@ export default { this.disabled = false } else { this.disabled = true + this.initPersonInfoData() } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { @@ -230,7 +235,8 @@ export default { disabled: false, onlyLook: false, // 是否仅查看 currentNode: 1, // 当前节点 - model: [], + currentNodeName: '', + model: {}, processInfoForm: this.$form.createForm(this), labelCol: { xs: { span: 24 }, @@ -273,8 +279,8 @@ export default { }, methods: { // 根据流程id获取数据并回显 - getProcessData (processId) { - enStandardChangeGetDataById({ processInstanceId: processId }).then(res => { + getProcessData (taskId) { + enStandardChangeGetDataById(taskId).then(res => { if (res.success) { this.model = res.result this.$nextTick(() => { @@ -283,17 +289,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'commitText', 'commitFile')) }) - // 初始化业务基本信息的申请类型和项目类别 - this.formInline.applicationCategory = this.model[0].applicationCategory - this.formInline.projectType = this.model[0].projectType - // 初始化人员信息 todo: 发起人还没处理 - this.personnelInfoData = personalInfo.map(item => { - if (item.fieldName) { - return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false } - } else { - return item - } - }) // 初始化业务基本信息中组件内容 } else { this.$message.warning(res.message) @@ -319,34 +314,40 @@ export default { // 流程审批信息 const approvalInfoForm = this.approvalInfoForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user + const personnelObj = this.$refs.personnelInfo.getDataObj() + // 需要传给后端的 + const paramObj = {} + paramObj.common = { ...processInfoForm, ...approvalInfoForm } + paramObj.flowUser = personnelObj + if (this.$refs.baseInfoRef) { + // 业务基本信息 + const baseInfo = this.$refs.baseInfoRef.getData() + const param = { ...processInfoForm, ...approvalInfoForm, ...personnelObj, ...baseInfo.formInline } + const flag = Object.values(param).some(v => !!v || v === 0) + if (!flag || (baseInfo.dataSource && baseInfo.dataSource.length <= 0)) { + // 提示至少填写一项 + this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) + return } - } - // 需要传给后端的数组 - const arr = [] - // 业务基本信息 - const baseInfo = this.$refs.baseInfoRef.getData() - const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj } - const flag = Object.values(param).some(v => !!v || v === 0) - if (!flag) { - // 提示至少填写一项 - this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) - return - } - if (baseInfo.dataSource && baseInfo.dataSource.length > 0) { - for (const item of baseInfo.dataSource) { - arr.push({ ...item, ...param }) + if (baseInfo.dataSource) { + paramObj.dataList = baseInfo.dataSource.map(item => { + return { ...item, ...baseInfo.formInline } + }) + } else { + paramObj.dataList = [baseInfo.formInline] } } else { - arr.push(param) + const param = { ...processInfoForm, ...approvalInfoForm, ...personnelObj } + const flag = Object.values(param).some(v => !!v || v === 0) + if (!flag) { + // 提示至少填写一项 + this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) + return + } } this.loading = true // 保存到草稿 - enStandardChangeSave(arr).then(res => { + enStandardChangeSave(paramObj).then(res => { if (res.success) { this.$message.success(res.message) this.goBack() @@ -361,37 +362,33 @@ export default { handleStart () { if (this.loading) return // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName && item.canChoose) { - personnelObj[item.fieldName] = item.user - } - } - // 校验是否填了所有能填的人员信息 - if (!Object.values(personnelObj).every(v => !!v)) { - this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) + const personnelObj = this.$refs.personnelInfo.getDataObjVerify() + if (!personnelObj) { return } // 流程信息的校验 this.processInfoForm.validateFields((err, values) => { // 流程审批信息的校验 - this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { - this.$refs.baseInfoRef.getDataValidate(data => { - if (!err && !approvalErr && data) { - const arr = [] // 需要传给后端的数据 - enStandardChangeApproval(arr).then(res => { - if (res.success) { - this.$message.success(res.message) - this.goBack() - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - } - }) + this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => { + const data = await this.$refs.baseInfoRef.getDataValidate() + if (!err && !approvalErr && data) { + const param = {} // 需要传给后端的数据 + param.common = { ...values, ...approvalValues } + param.flowUser = personnelObj + param.dataList = data.dataSource.map(item => { + return { ...item, ...data.formInline } + }) + enStandardChangeApproval(param).then(res => { + if (res.success) { + this.$message.success(res.message) + this.goBack() + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } }) }) }, diff --git a/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue b/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue index b600c531..23997bd7 100644 --- a/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue +++ b/src/views/workCenter/enterpriseStandardInitChange/PlanApprovalChangeFlow.vue @@ -275,137 +275,6 @@ import { USER_INFO } from '@/store/mutation-types' import pick from 'lodash.pick' import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' -// 标准立项的人员信息 -const approvalPersonalInfo = [ // 人员信息的数据 - { - id: 1, - nodeName: '主起草人发起', - nodeRoleName: '发起人', - canChoose: false, - userList: Vue.ls.get(USER_INFO).realname + '(' + Vue.ls.get(USER_INFO).username + ')', - fieldName: 'createUser' - }, - { - id: 2, - nodeName: '部所联络人校对', - nodeRoleName: '部所联络人', - canChoose: true, - chooseType: 'radio', - chooseSource: 'contactManage', - fieldName: 'contactUser' - }, - { - id: 3, - nodeName: '专家审批', - nodeRoleName: '专家', - canChoose: true, - chooseType: 'checkbox', - chooseSource: 'workGroup', - fieldName: 'standardExpert', - minLength: 2 - }, - { - id: 4, - nodeName: '发起人主管级领导审批', - nodeRoleName: '发起人主管级领导', - canChoose: true, - chooseType: 'radio', - fieldName: 'mainDraftUserLeader' - }, - { - id: 5, - nodeName: '发起人主管级上级领导审批', - nodeRoleName: '发起人主管级上级领导', - canChoose: true, - chooseType: 'radio', - fieldName: 'mainDraftUserLeaderLeader' - }, - { - id: 6, - nodeName: '标准化审批', - nodeRoleName: '标准化', - canChoose: true, - chooseType: 'radio', - fieldName: 'standardizationApprovalUser' - } -] -// 变更的人员信息 -const changePersonalInfo = [ - { - id: 1, - nodeName: '主起草人发起', - nodeRoleName: '发起人', - userList: Vue.ls.get(USER_INFO).realname + '(' + Vue.ls.get(USER_INFO).username + ')', - fieldName: 'createUser', - canChoose: false - }, - { - id: 2, - nodeName: '部所联络人校对', - nodeRoleName: '部所联络人', - canChoose: true, - chooseType: 'radio', - chooseSource: 'contactManage', - fieldName: 'contactUser' - }, - { - id: 3, - nodeName: '主起草人主管级领导审批', - nodeRoleName: '主起草人主管级领导', - canChoose: true, - chooseType: 'radio', - fieldName: 'mainDraftUserLeader' - }, - { - id: 4, - nodeName: '主起草人主管级上一级领导审批', - nodeRoleName: '主起草人主管级上一级领导', - canChoose: true, - chooseType: 'radio', - fieldName: 'mainDraftUserLeaderLeader' - }, - { - id: 5, - nodeName: '标准化审批', - nodeRoleName: '标准化', - canChoose: true, - chooseType: 'radio', - fieldName: 'standardizationApprovalUser' - }, - { - id: 6, - nodeName: '新起草部门主管级上一级领导下发', - nodeRoleName: '新起草部门主管级上一级领导', - canChoose: false, - chooseType: 'radio', - fieldName: 'newMainDraftUserLeaderLeader' - }, - { - id: 7, - nodeName: '新起草部门主管级领导确认', - nodeRoleName: '新起草部门主管级领导', - canChoose: false, - chooseType: 'radio', - fieldName: 'newMainDraftUserLeader' - }, - { - id: 8, - nodeName: '相关人员会签', - nodeRoleName: '相关人员', - canChoose: false, - chooseType: 'checkbox', - fieldName: 'relatedUser' - }, - { - id: 9, - nodeName: '抄送主起草人', - nodeRoleName: '主起草人', - canChoose: false, - chooseType: 'checkbox', - fieldName: 'createUser' - } -] - export default { name: 'PlanApprovalFlow', components: { @@ -572,13 +441,9 @@ export default { if (this.$route.query.processInstanceId) { param.processInstanceId = this.$route.query.processInstanceId } - console.log(param) getProcessNodeList(param).then(res => { if (res.success) { - console.log(res.result) // 处理人员信息数据 - // 筛选出是立项、责任部门变更,其他变更 - // 每个节点是否能选人 this.personnelInfoDataAll = res.result.map(item => { return { ...item, @@ -602,7 +467,6 @@ export default { resetPersonInfoStructure (type) { // 筛选出人员信息 this.personnelInfoData = this.personnelInfoDataAll.filter(item => item.branchType.split(',').includes(type)) - console.log(this.personnelInfoData) }, // 根据流程id获取数据并回显 getProcessData (taskId) { @@ -621,6 +485,19 @@ export default { this.formInline = Object.assign({}, baseInfoForm) baseInfoForm.projectType = this.model.dataList[0].projectType this.formInline = Object.assign({}, baseInfoForm) + // 初始化人员信息 + if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) { + // 立项 + this.resetPersonInfoStructure('1') + } else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value && + this.formInline.projectType !== ProjectType.RESPONSIBLE_DEPT_CHANGE.value) { + // 非责任部门变更 + this.resetPersonInfoStructure('2') + } else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value && + this.formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value) { + // 变更的责任部门变更 + this.resetPersonInfoStructure('3') + } // 初始化流程节点,此流程因为节点名称有重复,需要在此处根据applicationCatsegory做一些判断 const taskName = this.$route.query.taskName if (taskName) { @@ -647,6 +524,10 @@ export default { this.currentNode = 999 } } + if (this.currentNode !== 1) { + // 不是第一个节点需要处理人员信息都不可选 + this.initPersonInfoData() + } console.log(this.currentNode) // 根据流程节点初始化是否可以编辑 if (this.currentNode === 1) { @@ -654,57 +535,6 @@ export default { } else { this.disabled = true } - // 初始化人员信息 - 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], - 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 => { - if (item.fieldName) { - return { ...item, user: this.model.flowUser[item.fieldName], userList: this.model.flowUser[item.fieldName + '_dictText'], canChoose: false } - } else { - return item - } - }) - } // 初始化业务基本信息中组件内容 if (this.formInline.applicationCategory === ApplicationCategory.INITIATION.value) { // 是立项 @@ -790,15 +620,7 @@ export default { // 部分节点的选人表单 const userInfoForm = this.userForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 发起人设置为当前登录人 - personnelObj.createUser = Vue.ls.get(USER_INFO).id + const personnelObj = this.$refs.personnelInfo.getDataObj // 业务基础信息组件中的数据 let arr = [] // 业务基本信息-立项表单 @@ -898,6 +720,7 @@ export default { // 专家审批至少需要选两个专家 todo: 后端选多人流程进行不下去,暂时不限制传多人 // if (personnelObj.standardExpert.split(',').length < 2) { // this.$message.warning(this.$t('workCenter.enterpriseInitChangePlan.pleaseSelectLeastTwoExpert')) + // return // } console.log(this.formInline) this.processInfoForm.validateFields((err, values) => { diff --git a/src/views/workCenter/enterpriseStandardRecheck/EnterpriseStandardRecheckFlow.vue b/src/views/workCenter/enterpriseStandardRecheck/EnterpriseStandardRecheckFlow.vue index 4d7ee116..85be3545 100644 --- a/src/views/workCenter/enterpriseStandardRecheck/EnterpriseStandardRecheckFlow.vue +++ b/src/views/workCenter/enterpriseStandardRecheck/EnterpriseStandardRecheckFlow.vue @@ -140,6 +140,7 @@ import ContactInitBaseInfo from './modules/ContactInitBaseInfo' import StandardizationInitBaseInfo from './modules/StandardizationInitBaseInfo' import DrafterEnterOptionBaseInfo from './modules/DrafterEnterOptionBaseInfo' import RecheckApproveBaseInfo from './modules/RecheckApproveBaseInfo' +import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' // 人员信息 const personalInfo = [ // 人员信息的数据 @@ -188,27 +189,50 @@ export default { PersonnelInfo, UserSelectModal }, + mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' } }, mounted () { - if (this.$route.query.processId) { - this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点 + // 获取人员信息结构 + this.getPersonInfoStructure() + if (this.$route.query.taskId) { + this.currentNodeName = this.$route.query.taskName // 有流程id说明是从流程中心来的,需要初始化数据 - this.getProcessData(this.$route.query.processId) + this.getProcessData(this.$route.query.taskId) + } else { + this.currentNodeName = '发起人发起' + } + // 初始化节点 + 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 { + // 预留加签节点 + this.currentNode = 999 + } } if (this.currentNode === 1) { - this.personnelInfoData = personalInfo this.disabled = false // 是节点1的话还需要设置是联络人发起还是标准化发起 ?? // this.initRole = } else { - this.personnelInfoData = personalInfo.map(item => { - return { ...item, canChoose: false, fieldName: undefined } - }) this.disabled = true + // 如果不是第一个节点,人员信息全部不可选 + this.initPersonInfoData() } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { @@ -223,8 +247,9 @@ export default { disabled: false, onlyLook: false, // 是否仅查看 currentNode: 1, // 当前节点 + currentNodeName: '', initRole: 'standardization', // 发起角色,发起的时候角色不一样表单不一样,contact联络人发起,standardization标准化发起 - model: [], + model: {}, processInfoForm: this.$form.createForm(this), labelCol: { xs: { span: 24 }, @@ -267,8 +292,8 @@ export default { }, methods: { // 根据流程id获取数据并回显 - getProcessData (processId) { - enStandardRecheckGetDataById({ processInstanceId: processId }).then(res => { + getProcessData (taskId) { + enStandardRecheckGetDataById(taskId).then(res => { if (res.success) { this.model = res.result this.$nextTick(() => { @@ -277,17 +302,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment')) }) - // 初始化业务基本信息的申请类型和项目类别 - this.formInline.applicationCategory = this.model[0].applicationCategory - this.formInline.projectType = this.model[0].projectType - // 初始化人员信息 todo: 发起人还没处理 - this.personnelInfoData = personalInfo.map(item => { - if (item.fieldName) { - return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false } - } else { - return item - } - }) // 初始化业务基本信息中组件内容 } else { this.$message.warning(res.message) @@ -313,15 +327,7 @@ export default { // 流程审批信息 const approvalInfoForm = this.approvalInfoForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 需要传给后端的数据 - const arr = [] + const personnelObj = this.$refs.personnelInfo.getDataObj() // 业务基本信息 const baseInfo = this.$refs.baseInfoRef.getData() const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj } @@ -331,16 +337,14 @@ export default { this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) return } - if (baseInfo.dataSource && baseInfo.dataSource.length > 0) { - for (const item of baseInfo.dataSource) { - arr.push({ ...item, ...param }) - } - } else { - arr.push(param) - } + // 需要传给后端的数据 + const paramObj = {} + paramObj.common = { ...processInfoForm, ...approvalInfoForm } + paramObj.flowUser = personnelObj + paramObj.dataList = [baseInfo.formInline] this.loading = true // 保存到草稿 - enStandardRecheckSave(arr).then(res => { + enStandardRecheckSave(paramObj).then(res => { if (res.success) { this.$message.success(res.message) } else { @@ -354,36 +358,30 @@ export default { handleStart () { if (this.loading) return // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 校验是否填了所有能填的人员信息 - if (!Object.values(personnelObj).every(v => !!v)) { - this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) + const personnelObj = this.$refs.personnelInfo.getDataObjVerify() + if (!personnelObj) { return } // 流程信息的校验 this.processInfoForm.validateFields((err, values) => { // 流程审批信息的校验 - this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { - this.$refs.baseInfoRef.getDataValidate(data => { - if (!err && !approvalErr && data) { - const arr = [] // 需要传给后端的数据 - enStandardRecheckApproval(arr).then(res => { - if (res.success) { - this.$message.success(res.message) - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - } - }) + this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => { + const data = await this.$refs.baseInfoRef.getDataValidate() + if (!err && !approvalErr && data) { + const paramObj = {} // 需要传给后端的数据 + paramObj.common = { ...values, ...approvalValues } + paramObj.flowUser = personnelObj + paramObj.dataList = [data.formInline] + enStandardRecheckApproval(paramObj).then(res => { + if (res.success) { + this.$message.success(res.message) + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } }) }) }, diff --git a/src/views/workCenter/enterpriseStandardSealSave/EnterpriseStandardSealSaveFlow.vue b/src/views/workCenter/enterpriseStandardSealSave/EnterpriseStandardSealSaveFlow.vue index e73a5f2e..322e9d70 100644 --- a/src/views/workCenter/enterpriseStandardSealSave/EnterpriseStandardSealSaveFlow.vue +++ b/src/views/workCenter/enterpriseStandardSealSave/EnterpriseStandardSealSaveFlow.vue @@ -124,6 +124,7 @@ import { enStandardSealSaveReject, } from '@/api/workCenter' import BaseInfoForm from './modules/BaseInfoForm' +import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' // 人员信息 const personalInfo = [ // 人员信息的数据 @@ -169,25 +170,48 @@ export default { PersonnelInfo, UserSelectModal }, + mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' } }, mounted () { - if (this.$route.query.processId) { - this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点 + // 获取人员信息结构 + this.getPersonInfoStructure() + if (this.$route.query.taskId) { + this.currentNodeName = this.$route.query.taskName // 有流程id说明是从流程中心来的,需要初始化数据 this.getProcessData(this.$route.query.taskId) + } else { + this.currentNodeName = '发起人发起' + } + // 初始化节点 + 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 { + // 预留加签节点 + this.currentNode = 999 + } } if (this.currentNode === 1) { - this.personnelInfoData = personalInfo this.disabled = false } else { - this.personnelInfoData = personalInfo.map(item => { - return { ...item, canChoose: false, fieldName: undefined } - }) this.disabled = true + // 如果不是第一个节点,人员信息全部不可选 + this.initPersonInfoData() } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { @@ -202,7 +226,8 @@ export default { disabled: false, onlyLook: false, // 是否仅查看 currentNode: 1, // 当前节点 - model: [], + currentNodeName: '', + model: {}, processInfoForm: this.$form.createForm(this), labelCol: { xs: { span: 24 }, @@ -255,14 +280,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment')) }) - // 初始化人员信息 todo: 发起人还没处理 - this.personnelInfoData = personalInfo.map(item => { - if (item.fieldName) { - return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false } - } else { - return item - } - }) // 初始化业务基本信息中组件内容 } else { this.$message.warning(res.message) @@ -288,15 +305,7 @@ export default { // 流程审批信息 const approvalInfoForm = this.approvalInfoForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 需要传给后端的数据 - const arr = [] + const personnelObj = this.$refs.personnelInfo.getDataObj() // 业务基本信息 const baseInfo = this.$refs.baseInfoRef.getData() const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj } @@ -306,10 +315,14 @@ export default { this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) return } - arr.push(param) + // 需要传给后端的数据 + const paramObj = {} + paramObj.common = { ...processInfoForm, ...approvalInfoForm } + paramObj.flowUser = personnelObj + paramObj.dataList = [baseInfo.formInline] this.loading = true // 保存到草稿 - enStandardSealSaveSave(arr).then(res => { + enStandardSealSaveSave(paramObj).then(res => { if (res.success) { this.$message.success(res.message) } else { @@ -323,16 +336,8 @@ export default { handleStart () { if (this.loading) return // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 校验是否填了所有能填的人员信息 - if (!Object.values(personnelObj).every(v => !!v)) { - this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) + const personnelObj = this.$refs.personnelInfo.getDataObjVerify() + if (!personnelObj) { return } // 流程信息的校验 @@ -341,8 +346,11 @@ export default { this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { this.$refs.baseInfoRef.getDataValidate(data => { if (!err && !approvalErr && data) { - const arr = [] // 需要传给后端的数据 - enStandardSealSaveApproval(arr).then(res => { + const paramObj = {} // 需要传给后端的数据 + paramObj.common = { ...values, ...approvalValues } + paramObj.flowUser = personnelObj + paramObj.dataList = [data.formInline] + enStandardSealSaveApproval(paramObj).then(res => { if (res.success) { this.$message.success(res.message) } else { diff --git a/src/views/workCenter/enterpriseStandardStartUse/EnterpriseStandardStartUseFlow.vue b/src/views/workCenter/enterpriseStandardStartUse/EnterpriseStandardStartUseFlow.vue index f1ed4f43..2013f540 100644 --- a/src/views/workCenter/enterpriseStandardStartUse/EnterpriseStandardStartUseFlow.vue +++ b/src/views/workCenter/enterpriseStandardStartUse/EnterpriseStandardStartUseFlow.vue @@ -121,9 +121,10 @@ import { enStandardStartUseApproval, enStandardStartUseTurnTo, enStandardStartUseAgree, - enStandardStartUseReject, + enStandardStartUseReject } from '@/api/workCenter' import BaseInfoForm from './modules/BaseInfoForm' +import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' // 人员信息 const personalInfo = [ // 人员信息的数据 @@ -169,25 +170,48 @@ export default { PersonnelInfo, UserSelectModal }, + mixins: [WorkCenterMixin], computed: { pageTitle () { - return this.$t('flowCenter') + this.$route.meta.title + return this.$t('flowCenter') + this.$route.meta.title + '(' + this.currentNodeName + ')' } }, mounted () { - if (this.$route.query.processId) { - this.currentNode = 2 // todo: 先设置一个假数据,后端还不能返回当前节点 + // 获取人员信息结构 + this.getPersonInfoStructure() + if (this.$route.query.taskId) { + this.currentNodeName = this.$route.query.taskName // 有流程id说明是从流程中心来的,需要初始化数据 this.getProcessData(this.$route.query.taskId) + } else { + this.currentNodeName = '发起人发起' + } + // 初始化节点 + 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 { + // 预留加签节点 + this.currentNode = 999 + } } if (this.currentNode === 1) { - this.personnelInfoData = personalInfo this.disabled = false } else { - this.personnelInfoData = personalInfo.map(item => { - return { ...item, canChoose: false, fieldName: undefined } - }) this.disabled = true + // 如果不是第一个节点,人员信息全部不可选 + this.initPersonInfoData() } // 如果是查看进入的,不可编辑,不可操作 if (this.$route.query.onlyLook) { @@ -202,7 +226,8 @@ export default { disabled: false, onlyLook: false, // 是否仅查看 currentNode: 1, // 当前节点 - model: [], + currentNodeName: '', + model: {}, processInfoForm: this.$form.createForm(this), labelCol: { xs: { span: 24 }, @@ -255,14 +280,6 @@ export default { // 初始化流程审批信息,todo:需要判断是不是草稿进来的,草稿进来的才回显审批信息 // this.approvalInfoForm.setFieldsValue(pick(this.model[0], 'remarks', 'attachment')) }) - // 初始化人员信息 todo: 发起人还没处理 - this.personnelInfoData = personalInfo.map(item => { - if (item.fieldName) { - return { ...item, userList: this.model[0][item.fieldName + '_dictText'], canChoose: false } - } else { - return item - } - }) // 初始化业务基本信息中组件内容 } else { this.$message.warning(res.message) @@ -288,15 +305,7 @@ export default { // 流程审批信息 const approvalInfoForm = this.approvalInfoForm.getFieldsValue() // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 需要传给后端的数据 - const arr = [] + const personnelObj = this.$refs.personnelInfo.getDataObj() // 业务基本信息 const baseInfo = this.$refs.baseInfoRef.getData() const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj } @@ -306,10 +315,14 @@ export default { this.$message.warning(this.$t('pleaseFillInAtLeastOneItem')) return } - arr.push(param) + // 需要传给后端的数据 + const paramObj = {} + paramObj.common = { ...processInfoForm, ...approvalInfoForm } + paramObj.flowUser = personnelObj + paramObj.dataList = [baseInfo.formInline] this.loading = true // 保存到草稿 - enStandardStartUseSave(arr).then(res => { + enStandardStartUseSave(paramObj).then(res => { if (res.success) { this.$message.success(res.message) } else { @@ -323,36 +336,30 @@ export default { handleStart () { if (this.loading) return // 人员信息的数据, 处理成对象 - const personnelInfo = this.$refs.personnelInfo.stepsData - const personnelObj = {} - for (const item of personnelInfo) { - if (item.fieldName) { - personnelObj[item.fieldName] = item.user - } - } - // 校验是否填了所有能填的人员信息 - if (!Object.values(personnelObj).every(v => !!v)) { - this.$message.warning(this.$t('pleaseEnterPersonnelInfo')) + const personnelObj = this.$refs.personnelInfo.getDataObjVerify() + if (!personnelObj) { return } // 流程信息的校验 this.processInfoForm.validateFields((err, values) => { // 流程审批信息的校验 - this.approvalInfoForm.validateFields((approvalErr, approvalValues) => { - this.$refs.baseInfoRef.getDataValidate(data => { - if (!err && !approvalErr && data) { - const arr = [] // 需要传给后端的数据 - enStandardStartUseApproval(arr).then(res => { - if (res.success) { - this.$message.success(res.message) - } else { - this.$message.warning(res.message) - } - }).finally(() => { - this.loading = false - }) - } - }) + this.approvalInfoForm.validateFields(async (approvalErr, approvalValues) => { + const data = await this.$refs.baseInfoRef.getDataValidate() + if (!err && !approvalErr && data) { + const paramObj = {} // 需要传给后端的数据 + paramObj.common = { ...values, ...approvalValues } + paramObj.flowUser = personnelObj + paramObj.dataList = [data.formInline] + enStandardStartUseApproval(arr).then(res => { + if (res.success) { + this.$message.success(res.message) + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } }) }) },