diff --git a/src/api/repair/tickets/Tickets.js b/src/api/repair/tickets/Tickets.js index 6c2b6fd..50f16ad 100644 --- a/src/api/repair/tickets/Tickets.js +++ b/src/api/repair/tickets/Tickets.js @@ -82,9 +82,9 @@ export function getUserRole(){ } // 接单 -export function updateTake(id){ +export function updateTake(id, image){ return request({ - url: preUrl + "/take?id=" + id, + url: preUrl + "/take?id=" + id + "&image=" + image, method: "get", }) } diff --git a/src/views/repair/tickets/Components/TicketManagerItem.vue b/src/views/repair/tickets/Components/TicketManagerItem.vue index cfaa51d..b5c43a2 100644 --- a/src/views/repair/tickets/Components/TicketManagerItem.vue +++ b/src/views/repair/tickets/Components/TicketManagerItem.vue @@ -44,16 +44,20 @@ 查看 - + 编辑工单 - + 删除 - + 作废 - + 维修记录设置 接单 - + 通知施工 施工完成 - - - + + + 重新指派 - + 申请配件 更多 - 申请配件 - - - + + + - + - + @@ -150,7 +158,7 @@ - + - + + + + + + + + + + + + + + @@ -189,7 +217,7 @@ export default { default: '', required: true }, - isType:{ + isType: { type: String, } }, @@ -218,6 +246,11 @@ export default { remark: null, leader: false, nowUser: null, + beginDialog: false, + beginData: { + id: null, + image: null, + }, } }, mounted() { @@ -226,13 +259,13 @@ export default { this.getNowUser() }, methods: { - async getNowUser(){ + async getNowUser() { const res = await getUserProfile() this.nowUser = res.data }, - async isLeader(){ - const res = await getIfLeader() - this.leader = res.data + async isLeader() { + const res = await getIfLeader() + this.leader = res.data }, async listTickets() { try { @@ -270,18 +303,36 @@ export default { }, // 接单 async handleTake(row) { + this.beginData.id = row.id + this.beginDialog = true + }, + async doTake(){ try { + if (!this.beginData.image){ + this.$modal.msgError("附件不能为空") + return + } this.loading = true - await this.$modal.confirm("确认接单吗?") - await updateTake(row.id) + if (this.beginData.image){ + const data = this.beginData.image.split(",") + this.beginData.image = data.map(item => { + return item.replace(process.env.VUE_APP_FILE_API, "") + }).join(",") + } + await updateTake(this.beginData.id, this.beginData.image) + this.beginDialog = false this.$modal.msgSuccess("接单成功") + this.beginData = { + id: null, + image: null + } await this.listTickets() - }finally { + } finally { this.loading = false } }, // 退料 - async handleBack(row){ + async handleBack(row) { this.formData = {} this.formData = row this.remark = null @@ -290,12 +341,12 @@ export default { this.backLoading = true const res = await getTicketsById(row.id) this.partList = res.data.wares - }finally { + } finally { this.backLoading = false } }, // 重新指派 - handleReTake(row){ + handleReTake(row) { row = { ...row, // 还要判断是不是班组长 @@ -304,12 +355,12 @@ export default { this.$refs.updateRepair.open(row) }, // 指派员工,通知施工 - handleNotify(row){ + handleNotify(row) { this.$refs.updateRepair.open(row) }, // 更多操作 - handleCommand(command, index, row){ - switch (command){ + handleCommand(command, index, row) { + switch (command) { case 'handleReTake': this.handleReTake(row) break @@ -378,10 +429,10 @@ export default { }) this.clickCellMap[id] = [] }, - rowSelect(val){ + rowSelect(val) { this.selections = val }, - async doBack(flag){ + async doBack(flag) { const data = { no: createUniqueCodeByHead("TLSQ"), ticketId: this.formData.id, @@ -391,9 +442,9 @@ export default { adviserId: this.formData.adviserId, adviserName: this.formData.adviserName } - if (flag){ + if (flag) { data.items = this.partList - }else { + } else { data.items = this.selections } await updateTicketWares(data) @@ -401,7 +452,7 @@ export default { this.$modal.msgSuccess("申请成功"); await this.listTickets() }, - handleRecord(row, type){ + handleRecord(row, type) { row = { ...row, clickType: type @@ -409,22 +460,23 @@ export default { this.$refs.updateRecord.open(row) }, // 设置维修图片可不可见 - handleEditRecord(row){ + handleEditRecord(row) { this.$refs.recordSet.open(row.id) }, - handleEditTicket(row){ + handleEditTicket(row) { this.$refs.editTickets.open(row) }, - async handleRemove(row){ + async handleRemove(row) { try { const id = row.id - if (id){ + if (id) { await this.$modal.confirm("确认删除工单" + row.ticketNo + "吗?") await removeTicketById(id) await this.listTickets() this.$modal.msgSuccess("删除成功") } - }catch{} + } catch { + } }, async handleVoid(row) { this.$prompt('作废备注', '提示', {