diff --git a/src/api/repair/other/index.js b/src/api/repair/other/index.js index 9b75613..5fde139 100644 --- a/src/api/repair/other/index.js +++ b/src/api/repair/other/index.js @@ -27,3 +27,10 @@ export function deleteOther(id){ method: "delete" }) } + +export function getOtherByName(name){ + return request({ + url: preUrl + "/getByName?name=" + name, + method: "get" + }) +} diff --git a/src/api/repair/project/index.js b/src/api/repair/project/index.js index 4a65d85..2da4f4b 100644 --- a/src/api/repair/project/index.js +++ b/src/api/repair/project/index.js @@ -51,3 +51,10 @@ export function exportRepairProjectExcel(params) { responseType: 'blob' }) } + +export function getProjectByName(name){ + return request({ + url: "/repair/project/getByName?name=" + name, + method: "get", + }) +} diff --git a/src/api/repair/wares/index.js b/src/api/repair/wares/index.js index 32a9707..8cf5c10 100644 --- a/src/api/repair/wares/index.js +++ b/src/api/repair/wares/index.js @@ -43,3 +43,10 @@ export function getWaresPage(params) { }) } +export function getWaresByName(name){ + return request({ + url: "/repair/wares/getByName?name=" + name, + method: "get" + }) +} + diff --git a/src/views/repair/other/OtherForm.vue b/src/views/repair/other/OtherForm.vue index 275670e..2dafcd6 100644 --- a/src/views/repair/other/OtherForm.vue +++ b/src/views/repair/other/OtherForm.vue @@ -45,7 +45,7 @@ export default { try { await updateOther(this.formData) this.$modal.msgSuccess(this.formData.id ? "修改成功" : "新增成功") - this.$emit("success") + this.$emit("success", this.formData.name) } finally { this.dialogVisible = false this.formLoading = false diff --git a/src/views/repair/project/form/RepairProjectForm.vue b/src/views/repair/project/form/RepairProjectForm.vue index 9059373..8f2a6bf 100644 --- a/src/views/repair/project/form/RepairProjectForm.vue +++ b/src/views/repair/project/form/RepairProjectForm.vue @@ -197,7 +197,7 @@ export default { await RepairProjectApi.updateRepairProject(data); this.$modal.msgSuccess("修改成功"); this.dialogVisible = false; - this.$emit('success'); + this.$emit('success', this.formData.name); return; } // 添加的提交 diff --git a/src/views/repair/tickets/Components/TicketItem.vue b/src/views/repair/tickets/Components/TicketItem.vue index 380a41b..6cd385b 100644 --- a/src/views/repair/tickets/Components/TicketItem.vue +++ b/src/views/repair/tickets/Components/TicketItem.vue @@ -21,14 +21,14 @@ {{ scope.row.name ? scope.row.name : scope.row.goods }} - - - - - - - - + + + + + + + + @@ -113,7 +113,7 @@ - + @@ -128,6 +128,10 @@ import RepairProjectForm from "@/views/repair/project/form/RepairProjectForm.vue import ProjectChoose from "@/views/repair/Components/ProjectChoose.vue"; import OtherChoose from "@/views/repair/Components/OtherChoose.vue"; import OtherForm from "@/views/repair/other/OtherForm.vue"; +import request from "@/utils/request"; +import {getOtherByName} from "@/api/repair/other"; +import {getProjectByName} from "@/api/repair/project"; +import {getWares, getWaresByName} from "@/api/repair/wares"; export default { name: "TicketItem", @@ -141,14 +145,18 @@ export default { default: 'project', required: true }, - inListData:{ - type:Array, - default: () => {return []}, + inListData: { + type: Array, + default: () => { + return [] + }, required: false }, couponList: { type: Array, - default: () => {return []}, + default: () => { + return [] + }, required: false } }, @@ -156,7 +164,7 @@ export default { return { loading: false, list: [{ - coupon:{ + coupon: { id: null } }], @@ -177,14 +185,14 @@ export default { handler(val) { this.$emit("tableData", val) const coupons = val.filter(item => item.coupon).map(item => item.coupon) - if (coupons && coupons.length > 0){ + if (coupons && coupons.length > 0) { this.$emit("changeCoupon", coupons) } }, deep: true }, - inListData(val){ - if (val && val.length > 0){ + inListData(val) { + if (val && val.length > 0) { // console.log(val) // this.list = val.map(item => { // return { @@ -333,17 +341,43 @@ export default { break } }, - returnProject(row) { - // this.list.push(row) - - }, - returnPart(row) { + async returnProject(name) { + const res = await getProjectByName(name) + const data = res.data + if (data) { + this.list.splice(this.list.length - 1, 0, { + ...data, + count: 1, + totalPrice: data.price + }) + } // this.list.push(row) }, - returnOther() { + async returnPart(name) { + const res = await getWaresByName(name) + const data = res.data + if (data) { + this.list.splice(this.list.length - 1, 0, { + ...data, + count: 1, + totalPrice: data.price + }) + } + // this.list.push(row) }, - getCouponName(id){ + async returnOther(name) { + const res = await getOtherByName(name) + const data = res.data + if (data) { + this.list.splice(this.list.length - 1, 0, { + ...data, + count: 1, + totalPrice: data.price + }) + } + }, + getCouponName(id) { // this. } } diff --git a/src/views/repair/wares/WaresForm.vue b/src/views/repair/wares/WaresForm.vue index 3e21010..49e3ceb 100644 --- a/src/views/repair/wares/WaresForm.vue +++ b/src/views/repair/wares/WaresForm.vue @@ -290,7 +290,7 @@ export default { await WaresApi.updateWares(data); this.$modal.msgSuccess("修改成功"); this.dialogVisible = false; - this.$emit('success'); + this.$emit('success', this.formData.name); return; } // 添加的提交