From 7d87a13ea0adb42dd62a48987b22b464c6e95ef0 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Thu, 17 Oct 2024 17:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/Components/TicketManagerItem.vue | 176 +++++++++++++++++- .../repair/tickets/Components/TicketWares.vue | 2 +- .../tickets/Components/TicketWaresShow.vue | 5 +- 3 files changed, 176 insertions(+), 7 deletions(-) diff --git a/src/views/repair/tickets/Components/TicketManagerItem.vue b/src/views/repair/tickets/Components/TicketManagerItem.vue index 16b91ac..3f10e59 100644 --- a/src/views/repair/tickets/Components/TicketManagerItem.vue +++ b/src/views/repair/tickets/Components/TicketManagerItem.vue @@ -56,7 +56,7 @@ 申请领料 - 申请退料 + + + + + + + + + + {{ scope.row.waresCount }} + + + + + + {{ scope.row.remark }} + + + + + + + + + + @@ -82,6 +116,9 @@ import {getPageType, updateTake} from "@/api/repair/tickets/Tickets"; import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue"; import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue"; import TWOperate from "@/views/repair/tickets/form/TWOperate.vue"; +import {listTwItem} from "@/api/repair/tickets/TWItem"; +import {createUniqueCodeByHead} from "@/utils/createUniqueCode"; +import {updateTicketWares} from "@/api/repair/tickets/TicketWares"; export default { name: "TicketManagerItem", @@ -108,7 +145,17 @@ export default { showSearch: true, loading: false, list: [], - total: 0 + total: 0, + backVisible: false, + partList: [], + backLoading: false, + // 保存进入编辑的cell + clickCellMap: {}, + // 需要编辑的属性 + editProp: ['remark', 'waresCount'], + selections: [], + formData: {}, + remark: null } }, mounted() { @@ -162,8 +209,20 @@ export default { } }, // 退料 - handleBack(row){ - + async handleBack(row){ + this.formData = {} + this.formData = row + this.remark = null + this.backVisible = true + try { + this.backLoading = true + const res = await listTwItem({twId: row.twId}) + this.partList = res.data + // 未领料的不要 + this.partList = this.partList.filter(item => item.waresStatus === '01') + }finally { + this.backLoading = false + } }, // 重新指派 handleReTake(row){ @@ -186,14 +245,123 @@ export default { case 'handleGet': this.handleGet(row) break + case 'handleBack': + this.handleBack(row) + break default: break } + }, + /** 鼠标移入cell */ + handleCellEnter(row, column, cell, event) { + const property = column.property + if (this.editProp.includes(property)) { + cell.querySelector('.item__txt').classList.add('item__txt--hover') + } + }, + /** 鼠标移出cell */ + handleCellLeave(row, column, cell, event) { + const property = column.property + if (this.editProp.includes(property)) { + cell.querySelector('.item__txt').classList.remove('item__txt--hover') + } + }, + /** 点击cell */ + handleCellClick(row, column, cell, event) { + const property = column.property + if (this.editProp.includes(property)) { + // 保存cell + this.saveCellClick(row, cell) + cell.querySelector('.item__txt').style.display = 'none' + cell.querySelector('.item__input').style.display = 'inline' + cell.querySelector('input').focus() + } + }, + /** 取消编辑状态 */ + cancelEditable(cell) { + cell.querySelector('.item__txt').style.display = 'inline' + cell.querySelector('.item__input').style.display = 'none' + }, + /** 保存进入编辑的cell */ + saveCellClick(row, cell) { + const id = row.id + if (this.clickCellMap[id] !== undefined) { + if (!this.clickCellMap[id].includes(cell)) { + this.clickCellMap[id].push(cell) + } + } else { + this.clickCellMap[id] = [cell] + } + }, + /** 保存数据 */ + save(row) { + // 更新表格的数据 + row.totalPrice = row.count * row.newPrice + const id = row.id + // 取消本行所有cell的编辑状态 + this.clickCellMap[id].forEach(cell => { + this.cancelEditable(cell) + }) + this.clickCellMap[id] = [] + }, + rowSelect(val){ + this.selections = val + }, + async doBack(flag){ + const data = { + no: createUniqueCodeByHead("TLSQ"), + ticketId: this.formData.id, + type: "02", + status: "01", + remark: this.remark, + adviserId: this.formData.adviserId, + adviserName: this.formData.adviserName + } + if (flag){ + data.items = this.partList + }else { + data.items = this.selections + } + await updateTicketWares(data) + this.backVisible = false + this.$modal.msgSuccess("申请成功"); + await this.listTickets() } } } diff --git a/src/views/repair/tickets/Components/TicketWares.vue b/src/views/repair/tickets/Components/TicketWares.vue index fd17436..a55cee8 100644 --- a/src/views/repair/tickets/Components/TicketWares.vue +++ b/src/views/repair/tickets/Components/TicketWares.vue @@ -52,7 +52,7 @@ - + diff --git a/src/views/repair/tickets/Components/TicketWaresShow.vue b/src/views/repair/tickets/Components/TicketWaresShow.vue index ab56134..446fa79 100644 --- a/src/views/repair/tickets/Components/TicketWaresShow.vue +++ b/src/views/repair/tickets/Components/TicketWaresShow.vue @@ -151,7 +151,7 @@ {{ scope.$index + 1 }} - +