From f9725d1fc2a59fd1c1063bbd2cfca6bcb7b6a743 Mon Sep 17 00:00:00 2001 From: danshihao Date: Wed, 3 Jan 2024 14:41:13 +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-=E4=B8=9A=E5=8A=A1=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=89=8D=E7=AB=AF=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseStandardInspectionPlanFlow.vue | 4 +- .../modules/InspectionPlanDrawer.vue | 64 ++++++++++++------- .../modules/InspectionPlanTable.vue | 32 ++++++++-- .../modules/WriteOpinionModal.vue | 57 +++++++++-------- 4 files changed, 101 insertions(+), 56 deletions(-) diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue index c9585eff..b33ef433 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/EnterpriseStandardInspectionPlanFlow.vue @@ -345,11 +345,13 @@ export default { async getPageParams (isValidate = true) { // 去除备注必填 this.validatorRules.remarks.rules[0].required = false - if (this.$refs.inspectionPlanTable.dataSource.length === 0) { + if (isValidate && this.$refs.inspectionPlanTable.dataSource.length === 0) { this.$message.warning(this.$t('addAtLeastOneRowOfData')) throw new Error('base') } const params = {} + // 业务表信息 + params.processEsInspectPlanList = this.$refs.inspectionPlanTable.dataSource // 收集所有表单信息 let formDataList = [] if (isValidate) { diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanDrawer.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanDrawer.vue index c2891442..e3df4580 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanDrawer.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanDrawer.vue @@ -28,7 +28,7 @@ @@ -52,7 +52,7 @@ @@ -64,19 +64,20 @@ @@ -104,7 +105,6 @@ import StandardSelection from '@comp/selection/StandardSelection' import UserSelection from '@comp/selection/UserSelection' import { getWorkGroupTreeList } from '@api/api' import WorkGroupSelection from '@comp/selection/WorkGroupSelection' -import { addInspectPlanTable, editInspectPlanTable } from '@api/workCenter' import { EsInspectionPlan, StandardSource } from '@/enums/commonEnums' export default { @@ -228,7 +228,9 @@ export default { } ] } - } + }, + // 如果是编辑用到下标记录数据 + index: -1 } }, created () { @@ -244,6 +246,16 @@ export default { } }, methods: { + // 选择人员回调 + nameChangeCallback (name, field) { + console.log(name, field) + this.model[field] = name + }, + // 选择部门回调 + backDepartCallback (data, field) { + console.log(data, field) + this.model[field] = data ? data.map(item => item.text).join(',') : '' + }, add () { const obj = {} // 如果是节点2,征求意见对象默认回显自己,并且禁用 @@ -253,7 +265,8 @@ export default { } this.edit(obj) }, - edit (record) { + edit (record, index) { + this.index = index this.visible = true this.form.resetFields() this.model = Object.assign({}, record) @@ -265,22 +278,26 @@ export default { if (this.confirmLoading) return this.form.validateFields((err, values) => { if (!err) { - const params = Object.assign({ - projectId: this.projectId - }, this.model, values) - this.confirmLoading = true - const fn = params.id ? editInspectPlanTable : addInspectPlanTable - fn(params).then(res => { - if (res.success) { - this.$emit('ok', params) - this.$message.success(res.message) - this.close() - } else { - this.$message.warn(res.message) - } - }).finally(() => { - this.confirmLoading = false - }) + // 调整前端存储 + const row = Object.assign({}, this.model, values) + this.$emit('ok', row, this.index) + this.close() + // const params = Object.assign({ + // projectId: this.projectId + // }, this.model, values) + // this.confirmLoading = true + // const fn = params.id ? editInspectPlanTable : addInspectPlanTable + // fn(params).then(res => { + // if (res.success) { + // this.$emit('ok', params) + // this.$message.success(res.message) + // this.close() + // } else { + // this.$message.warn(res.message) + // } + // }).finally(() => { + // this.confirmLoading = false + // }) } }) }, @@ -288,6 +305,7 @@ export default { this.close() }, close () { + this.index = -1 this.model = {} this.visible = false }, diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue index 9f0b2b42..0c84835f 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/InspectionPlanTable.vue @@ -59,9 +59,9 @@ - + - + @@ -274,6 +274,22 @@ export default { this.filters.taskId = this.$route.query.taskId }, methods: { + // 编辑弹框 + handleEdit (record, index) { + this.$refs.modalForm.edit(record, index) + this.$refs.modalForm.title = this.$t('edit') + this.$refs.modalForm.disableSubmit = false + }, + // 添加回调 + handleAddOrEditCallback (row, index) { + console.log(row, index) + // index -1就是添加 + if (index === -1) { + this.dataSource.push(row) + } else { + this.dataSource.splice(index, 1, row) + } + }, // 是否显示意见 isShowOpinion (record) { const list = record.processEsInspectPlanOpinionList || [] @@ -315,8 +331,16 @@ export default { this.$refs.writeOpinionModal.show(record) }, // 填写意见 - handleWriteOpinion (record) { - this.$refs.writeOpinionModal.show(record) + handleWriteOpinion (record, index) { + this.$refs.writeOpinionModal.show(record, index) + }, + // 填写意见回调 + handleWriteOpinionCallback (data, index) { + this.dataSource.splice(index, 1, { + ...this.dataSource[index], + // 填写意见的数据 + processEsInspectPlanOpinion: data + }) }, // 查看所属部门意见 showDepartOpinion (record) { diff --git a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal.vue b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal.vue index 4f797d9b..dbf0f637 100644 --- a/src/views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal.vue +++ b/src/views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal.vue @@ -34,7 +34,7 @@ - @@ -45,13 +45,11 @@