From a67c3cf589fdaa73adae2c2d3304c70fc641bec9 Mon Sep 17 00:00:00 2001 From: danshihao Date: Thu, 23 Nov 2023 18:10:08 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=81=E6=A0=87=E7=A8=BD=E6=9F=A5?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/lang/workCenter/en.js | 1 - src/common/lang/workCenter/zh.js | 1 - .../selection/WorkGroupSelectionModal.vue | 15 +- .../EnterpriseStandardInspectionPlanFlow.vue | 266 ++++++++++-------- .../modules/InspectionPlanTable.vue | 2 +- vue.config.js | 3 +- 6 files changed, 162 insertions(+), 126 deletions(-) diff --git a/src/common/lang/workCenter/en.js b/src/common/lang/workCenter/en.js index dac88867..260c7d9c 100644 --- a/src/common/lang/workCenter/en.js +++ b/src/common/lang/workCenter/en.js @@ -217,7 +217,6 @@ module.exports = { }, // 企标稽查计划 esInspectionPlan: { - node1: '稽查联络人发起计划', inspectionPlan: '稽查计划', inspectionBasisStandardNumber: '稽查依据标准号', inspectionBasisStandardName: '稽查依据标准名称', diff --git a/src/common/lang/workCenter/zh.js b/src/common/lang/workCenter/zh.js index 12cf4709..2d8676ba 100644 --- a/src/common/lang/workCenter/zh.js +++ b/src/common/lang/workCenter/zh.js @@ -243,7 +243,6 @@ module.exports = { }, // 企标稽查计划 esInspectionPlan: { - node1: '稽查联络人发起计划', inspectionPlan: '稽查计划', inspectionBasisStandardNumber: '稽查依据标准号', inspectionBasisStandardName: '稽查依据标准名称', diff --git a/src/components/selection/WorkGroupSelectionModal.vue b/src/components/selection/WorkGroupSelectionModal.vue index 01212ec7..43f544c5 100644 --- a/src/components/selection/WorkGroupSelectionModal.vue +++ b/src/components/selection/WorkGroupSelectionModal.vue @@ -15,6 +15,7 @@ { + searchTree(data) + }) return nodes }, // 处理工作组树数据结构 @@ -129,6 +132,7 @@ export default { item.title = item.name item.value = item.id item.key = item.id + item.disabled = item.subset && item.subset.length item.children = this.dealTreeData(item.subset) return item }) @@ -335,4 +339,13 @@ export default { background: #fff; border-radius: 0 0 2px 2px; } +.select-work-group-tree { + /deep/.ant-tree-checkbox-disabled { + display: none; + } + /deep/li.ant-tree-treenode-disabled > .ant-tree-node-content-wrapper span { + color: rgba(0, 0, 0, .65) + } +} + diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue index fc2fd535..40fe63a3 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue @@ -36,7 +36,7 @@ @@ -55,28 +55,27 @@
{{ $t('basicServiceInformation') }}
- + - - +
+
+ v-decorator="['pass', validatorRules.isCountersign]" /> - - - +
+
- - +
+
{{ $t('processApprovalInformation') }}
@@ -98,7 +97,7 @@
@@ -133,7 +132,6 @@ import { approvalInspectPlan, getInspectPlanDetail, getInspectPlanProjectId, - refusalInspectPlan, saveInspectPlan, startInspectPlan, transferInspectPlan } from '@api/workCenter' @@ -146,8 +144,8 @@ export default { data () { return { // 当前流程信息 - info: {}, EsInspectionPlan, + info: {}, loading: false, switchValue: 'base', disabled: false, @@ -168,6 +166,7 @@ export default { sm: { span: 22 } }, currentNode: '', + currentNodeName: '', // 项目id projectId: '', btn: 0, @@ -216,20 +215,32 @@ export default { return this.$t('flowCenter') + this.$route.meta.title + '(' + this.subTitle + ')' }, subTitle () { - return this.$route.query.taskName || this.$t('workCenter.esInspectionPlan.node1') + return this.$route.query.taskName || EsInspectionPlan.initiate.text }, processDisabled () { return this.currentNode !== EsInspectionPlan.initiate.value + }, + // 会签人员回显 + involveNameStr () { + return (this.info.map && this.info.map.involveListDictText) || '' } }, created () { + const { projectId, nodeId, taskName } = this.$route.query + // 发起、草稿进来没有nodeId,就默认发起节点 + this.currentNode = nodeId || EsInspectionPlan.initiate.value + this.currentNodeName = taskName || EsInspectionPlan.initiate.text + this.projectId = projectId // 查询人员信息 - this.getPersonInfoStructure(ProcessKey.ES_Inspection_Plan.value) + this.getPersonInfoStructure(ProcessKey.ES_Inspection_Plan.value, () => { + this.initPersonInfoData(this.currentNode === EsInspectionPlan.initiate.value) + }) // 如果是待办进来,就获取详情数据 if (this.$route.query.projectId) { this.loadPage() return } + // 如果是新建进来,就获取项目id this.getProjectId() }, methods: { @@ -238,12 +249,12 @@ export default { */ getProjectId () { this.loading = true + this.currentNode = EsInspectionPlan.initiate.value + this.btn = EsInspectionPlan.initiate.btn // 否则就是创建一个新的流程 getInspectPlanProjectId().then(res => { if (res) { this.projectId = res + '' - this.currentNode = EsInspectionPlan.initiate.value - this.btn = EsInspectionPlan.initiate.btn } }).finally(() => { this.loading = false @@ -253,14 +264,7 @@ export default { * 获取页面详情 */ loadPage () { - let { projectId, taskId, nodeId } = this.$route.query - // 草稿进来没有nodeId,就默认发起节点 - if (!nodeId) { - nodeId = EsInspectionPlan.initiate.value - } - this.currentNode = nodeId - this.projectId = projectId - this.initPersonInfoData(this.currentNode === EsInspectionPlan.initiate.value) + const { projectId, taskId } = this.$route.query switch (this.currentNode) { case EsInspectionPlan.initiate.value: this.btn = EsInspectionPlan.initiate.btn @@ -285,110 +289,101 @@ export default { }).then(res => { if (res.success) { const data = res.result || {} + const processAll = data.processAll || {} + const map = data.map || {} + const processApprovalRecord = data.processApprovalRecord || {} this.info = data - this.$nextTick(() => { - this.processInfoForm.setFieldsValue({ - prcName: data.processAll.prcName, - dueTime: data.processAll.dueTime, - prcMes: data.processAll.prcMes - }) + // 页面回显 + this.processInfoForm && this.processInfoForm.setFieldsValue({ + prcName: processAll.prcName, + dueTime: processAll.dueTime, + prcMes: processAll.prcMes }) - this.$nextTick(() => { - this.approvalInfoForm.setFieldsValue({ - commitText: data.processApprovalRecord.commitText, - commitFile: data.processApprovalRecord.commitFile - }) + this.countersignForm && this.countersignForm.setFieldsValue({ + pass: this.convertPass(map.pass) + }) + this.approvalInfoForm && this.approvalInfoForm.setFieldsValue({ + commitText: processApprovalRecord.commitText, + commitFile: processApprovalRecord.commitFile }) } }).finally(() => { this.loading = false }) }, - switchChange (value) { - this.switchValue = value + // 获取人员信息 + getPersonInfo (isValidate = true) { + let personnelObj = {} + const funName = isValidate ? 'getDataObjVerify' : 'getDataObj' + // 节点1:所有的人员信息 + if (this.currentNode === EsInspectionPlan.initiate.value) { + // 人员信息的数据, 处理成对象 + personnelObj = this.$refs.personnelInfo[funName]() + if (!personnelObj) { + return false + } + // List拆成数组 + for (const key in personnelObj) { + if (personnelObj[key] && key.includes('List')) { + personnelObj[key] = personnelObj[key].split(',') + } + } + // 通过表格中的所属部门人员获取稽查征求意见对象 + const userList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation.split(',')).flat(Infinity) + personnelObj.opinionFillList = Array.from(new Set(userList)) + } + // else if (this.currentNode === EsInspectionPlan.liaisonCollect.value) { + // // 节点3:只给后端leader + // const map = this.$refs.personnelInfo[funName]() + // personnelObj.leader = map.leader + // } + return personnelObj }, // 获取页面参数 - getPageParams (isValidate = true) { - return new Promise((resolve, reject) => { - const params = {} - if (isValidate) { - // 发起节点才获取人员信息 - let personnelObj = {} - if (this.currentNode === EsInspectionPlan.initiate.value) { - // 人员信息的数据, 处理成对象 - personnelObj = this.$refs.personnelInfo.getDataObjVerify() - if (!personnelObj) { - return reject(new Error()) - } - // List拆成数组 - for (const key in personnelObj) { - if (personnelObj[key] && key.includes('List')) { - personnelObj[key] = personnelObj[key].split(',') - } - } - // 通过表格中的所属部门人员获取稽查征求意见对象 - personnelObj.opinionFillList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation) - } - // 校验表单 - this.validateFormList( - this.processInfoForm, - this.countersignForm, - this.approvalInfoForm - ).then(res => { - params.processAll = Object.assign({}, this.info.processAll, res[0]) - if (params.processAll.dueTime && !params.processAll.dueTime.includes(' 00:00:00')) { - params.processAll.dueTime = params.processAll.dueTime + ' 00:00:00' - } - params.processAll.projectId = this.projectId - params.processAll.taskId = this.$route.query.taskId + async getPageParams (isValidate = true) { + if (this.$refs.inspectionPlanTable.dataSource.length === 0) { + this.$message.warning(this.$t('addAtLeastOneRowOfData')) + throw new Error('base') + } + const params = {} + // 收集所有表单信息 + let formDataList = [] + if (isValidate) { + formDataList = await this.validateFormList(this.processInfoForm, this.countersignForm, this.approvalInfoForm) + } else { + formDataList = [ + this.processInfoForm.getFieldsValue(), + this.countersignForm.getFieldsValue(), + this.approvalInfoForm.getFieldsValue() + ] + } + // 收集人员信息 + const getPersonInfo = this.getPersonInfo(isValidate) + if (!getPersonInfo) { + throw new Error('user') + } - params.processApprovalRecord = Object.assign({}, this.info.processApprovalRecord, res[2]) - params.processApprovalRecord.projectId = this.projectId - params.map = {} - Object.assign(params.map, res[1], personnelObj) - if (params.map.pass) { - params.map.pass = params.map.pass + '' === '1' - } - if (params.map.involveList && typeof params.map.involveList === 'string') { - params.map.involveList = params.map.involveList.split(',') - } - resolve(params) - }).catch(err => { - reject(err) - }) - } else { - // 发起节点才获取人员信息 - let personnelObj = {} - if (this.currentNode === EsInspectionPlan.initiate.value) { - // 人员信息的数据, 处理成对象 - personnelObj = this.$refs.personnelInfo.getDataObj() - // List拆成数组 - for (const key in personnelObj) { - if (personnelObj[key] && key.includes('List')) { - personnelObj[key] = personnelObj[key].split(',') - } - } - // 通过表格中的所属部门人员获取稽查征求意见对象 - personnelObj.opinionFillList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation) - } - params.processAll = Object.assign({}, this.info.processAll, this.processInfoForm.getFieldsValue()) - if (params.processAll.dueTime && !params.processAll.dueTime.includes(' 00:00:00')) { - params.processAll.dueTime = params.processAll.dueTime + ' 00:00:00' - } - params.processAll.projectId = this.projectId - params.processApprovalRecord = Object.assign({}, this.info.processApprovalRecord, this.approvalInfoForm.getFieldsValue()) - params.processApprovalRecord.projectId = this.projectId - params.map = {} - Object.assign(params.map, this.countersignForm.getFieldsValue(), personnelObj) - if (params.map.pass) { - params.map.pass = params.map.pass + '' === '1' - } - if (params.map.involveList && typeof params.map.involveList === 'string') { - params.map.involveList = params.map.involveList.split(',') - } - resolve(params) - } + // 开始处理信息 + // 流程信息 + params.processAll = Object.assign({}, this.info.processAll, formDataList[0], { + projectId: this.projectId, + taskId: this.$route.query.taskId }) + + // 处理其他参数 + params.map = Object.assign({}, formDataList[1], getPersonInfo) + if (params.map.pass) { + params.map.pass = this.convertPass(params.map.pass) + } + if (params.map.involveList && typeof params.map.involveList === 'string') { + params.map.involveList = params.map.involveList.split(',') + } + + // 流程审批信息 + params.processApprovalRecord = Object.assign({}, this.info.processApprovalRecord, formDataList[2], { + projectId: this.projectId + }) + return params }, /** * 转办弹框 @@ -433,6 +428,8 @@ export default { } else { this.$message.warn(res.message) } + }).catch((err) => { + console.log(err) }).finally(() => { this.loading = false }) @@ -463,6 +460,8 @@ export default { } else { this.$message.warn(res.message) } + }).catch((err) => { + this.switchChange(err.message) }).finally(() => { this.loading = false }) @@ -483,6 +482,8 @@ export default { } else { this.$message.warn(res.message) } + }).catch((err) => { + this.switchChange(err.message) }).finally(() => { this.loading = false }) @@ -495,7 +496,7 @@ export default { this.loading = true this.getPageParams().then(res => { res.map.pass = false - return refusalInspectPlan(res) + return approvalInspectPlan(res) }).then(res => { if (res.success) { this.$message.success(res.message) @@ -503,6 +504,8 @@ export default { } else { this.$message.warn(res.message) } + }).catch((err) => { + this.switchChange(err.message) }).finally(() => { this.loading = false }) @@ -511,12 +514,31 @@ export default { changeIsCountersign (val) { if (val === '1') { this.isCountersign = true - } else if (val === '2') { + // 回显列表 + this.info.map && this.info.map.involveList && this.countersignForm && this.countersignForm.setFieldsValue({ + involveList: this.info.map.involveList + }) + } else if (val === '0') { this.isCountersign = false } else { this.isCountersign = null } }, + // pass数据字典值和布尔值互相转换 + convertPass (pass) { + switch (pass + '') { + case '1': + return true + case '0': + return false + case 'true': + return '1' + case 'false': + return '0' + default: + return null + } + }, /** * 验证所有表单 * @param formList - 多个需要校验的表单实例 @@ -536,7 +558,9 @@ export default { }) ) } - return Promise.all(promiseList) + return Promise.all(promiseList).catch(() => { + throw new Error('base') + }) } } } diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue index bf48cda8..e8ad4bf3 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue @@ -4,7 +4,7 @@ {{ $t('newlyAdded') }} - + {{ $t('import') }} diff --git a/vue.config.js b/vue.config.js index b5e5e6cc..8daa3395 100644 --- a/vue.config.js +++ b/vue.config.js @@ -86,7 +86,8 @@ module.exports = { } }, */ '/laws-sinotruk': { - target: 'http://localhost:8184', + host: '0.0.0.0', + target: 'http://192.168.137.128:8184', ws: false, changeOrigin: true, pathRewrite: {