From dc3153b1af2de5f7388c38f8dfe7bebb95fe4177 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Tue, 22 Oct 2024 23:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=B7=A5=E5=8D=95=E5=8F=8A?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/Components/TicketWaresShow.vue | 1 - .../repair/tickets/form/UpdateRecord.vue | 148 ++++++++++++------ .../repair/tickets/form/UpdateRepair.vue | 2 +- 3 files changed, 101 insertions(+), 50 deletions(-) diff --git a/src/views/repair/tickets/Components/TicketWaresShow.vue b/src/views/repair/tickets/Components/TicketWaresShow.vue index 189ea8d..112e9d0 100644 --- a/src/views/repair/tickets/Components/TicketWaresShow.vue +++ b/src/views/repair/tickets/Components/TicketWaresShow.vue @@ -288,7 +288,6 @@ export default { remark: item.remark } })] - console.log(this.formData) await auditTicketWares(this.formData) this.dialogVisible = false this.$modal.msgSuccess("审核成功") diff --git a/src/views/repair/tickets/form/UpdateRecord.vue b/src/views/repair/tickets/form/UpdateRecord.vue index ab5d5ee..4b1d114 100644 --- a/src/views/repair/tickets/form/UpdateRecord.vue +++ b/src/views/repair/tickets/form/UpdateRecord.vue @@ -1,12 +1,30 @@ @@ -49,16 +78,16 @@ import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue"; export default { name: "UpdateRecord", components: {UpdateRepair}, - data(){ + data() { return { dialogVisible: false, - formData:{ + formData: { // 主表信息 id: null, ticketsWorkStatus: null, remark: null, // 子表信息 - item:{ + item: { id: null, itemStatus: null, }, @@ -66,8 +95,8 @@ export default { image: null, recordType: null, }, - formRules:{ - 'item.id':[{required: true, message: "维修项目不能为空", trigger: 'blur'}] + formRules: { + 'item.id': [{required: true, message: "维修项目不能为空", trigger: 'blur'}] }, formLoading: false, projectList: [], @@ -78,104 +107,127 @@ export default { clickRow: null } }, - methods:{ - init(){ + methods: { + init() { this.formData = { // 主表信息 id: null, - ticketsWorkStatus: null, - remark: null, - // 子表信息 - item:{ + ticketsWorkStatus: null, + remark: null, + // 子表信息 + item: { id: null, - itemStatus: null, + itemStatus: null, }, // 记录信息 image: null, - recordType: null, + recordType: null, } this.projectList = [] this.clickRow = null }, - async open(row){ + async open(row) { this.init() this.clickRow = row + // 是否需要总检 this.isEndCheck = row.endCheck === '1' this.formData.id = row.id this.formData.recordType = row.clickType await this.listProject(row.id) this.dialogVisible = true }, - async listProject(ticketId){ + async listProject(ticketId) { try { this.formLoading = true const res = await getProjectList(ticketId) this.projectList = res.data this.formData.ticketsWorkStatus = "02" this.formData.item.itemStatus = "02" - if (this.formData.recordType === 'kssg') { - this.projectList = this.projectList.filter(item => item.itemStatus === '01') - }else if (this.formData.recordType === 'sgz'){ - this.projectList = this.projectList.filter(item => item.itemStatus === '02') - }else { - // 因为自己手里有一个项目,所以是>1 - this.isNext = this.projectList.filter(item => item.itemStatus !== '03').length > 1 + // 下面 01:未派工、02:施工中、03:已完成 + // 开始施工展示所有的项目,方便返工 + // 施工中的项目只展示施工中的项目,一是没施工就有施工记录不合理,二是防止项目太多员工选错,三已完成的项目需要重新就重新开始施工 + // 施工完成同施工中 + if (this.formData.recordType !== 'kssg') { this.projectList = this.projectList.filter(item => item.itemStatus === '02') + // 施工完成需要特殊计算一些东西 + // 项目全完成需要总检、项目全完成不需要总检、项目没有全完成 + if (this.formData.recordType !== 'sgz') { + // 因为自己手里有一个项目,所以是>1 + this.isNext = this.projectList.filter(item => item.itemStatus !== '03').length > 1 + } } - }finally { + } finally { this.formLoading = false } }, - async doUpdate(){ + async doUpdate(nextName = null) { try { - if (this.formData.recordType === 'zj'){ + if (nextName){ + this.formData['nextName'] = nextName + } + if (this.formData.recordType === 'zj') { this.formData.ticketsWorkStatus = '03' this.formData['isFinish'] = '1' } - if (this.formData.recordType !== 'zj'){ + if (this.formData.recordType !== 'zj') { await this.$refs.formRef.validate() this.formLoading = true await updateStatus(this.formData) - this.$modal.msgSuccess("操作成功") + if (!nextName) { + this.$modal.msgSuccess("操作成功") + } this.dialogVisible = false this.$emit("success") - }else { + } else { this.formLoading = true await updateStatus(this.formData) - this.$modal.msgSuccess("操作成功") + if (nextName) { + this.$modal.msgSuccess("操作成功") + } this.dialogVisible = false this.$emit("success") } - }catch { + } catch { } }, - async doFinish(){ - try{ + async doFinish() { + try { await this.$refs.formRef.validate() this.formLoading = true // 不论是什么按钮,这个工单子项是完了的 this.formData.item.itemStatus = "03" // 整体完成并指派下一个人 - if (this.isNext){ + if (this.isNext) { + this.formData['finishType'] = "01" await this.$refs.updateRepair.open(this.clickRow) return } // 整体完成并移交总检 - if (this.isEndCheck){ + if (this.isEndCheck) { + this.formData['finishType'] = "02" this.formData.ticketsWorkStatus = "05" await this.doUpdate(); return } // 整体完成,只有没有项目,不需要总检,这个工单才是完了 this.formData.ticketsWorkStatus = "03" + this.formData['finishType'] = "03" this.formData['isFinish'] = '1' await this.doUpdate() - }catch{} + } catch { + } } } } diff --git a/src/views/repair/tickets/form/UpdateRepair.vue b/src/views/repair/tickets/form/UpdateRepair.vue index 2e0f350..60edd6f 100644 --- a/src/views/repair/tickets/form/UpdateRepair.vue +++ b/src/views/repair/tickets/form/UpdateRepair.vue @@ -208,7 +208,7 @@ export default { await updateRepair(this.formData) this.$modal.msgSuccess("指派成功") this.dialogVisible = false - this.$emit("success") + this.$emit("success", this.formData.nowRepairName) } catch { }