From ecbfa334237d217f9c5b9499bece0eca1a511dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Wed, 9 Aug 2023 17:44:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8A=A5=E4=BF=AE=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inventory/DeviceInspectPlanProjectSet.vue | 85 +++++-- src/views/inventory/DeviceProjectSelect.vue | 35 ++- .../inventory/DeviceRepairOrderModify.vue | 237 +++++++++++++----- src/views/inventory/DeviceRepairOrderNew.vue | 81 +++++- 4 files changed, 337 insertions(+), 101 deletions(-) diff --git a/src/views/inventory/DeviceInspectPlanProjectSet.vue b/src/views/inventory/DeviceInspectPlanProjectSet.vue index 77849d8c..86ab7937 100644 --- a/src/views/inventory/DeviceInspectPlanProjectSet.vue +++ b/src/views/inventory/DeviceInspectPlanProjectSet.vue @@ -33,6 +33,7 @@ import {addDeviceInspectPlanDelect,uploadDeviceInspectPlanDelect} from "@/api/inventory/deviceInspectPlanDelect"; import {isBlank} from "@/utils/strUtil"; import {saveDeviceInspectPlan} from "@/api/inventory/deviceInspectPlan"; +import {addDeviceRepairOrderDetail, updateDeviceRepairOrderDetail} from "@/api/inventory/deviceRepairOrderDetail"; export default { props: { @@ -40,6 +41,10 @@ export default { type: Object, required: true }, + type: { + type: Object, + required: true + }, closeDialog: { type: Function, required: true @@ -57,31 +62,61 @@ export default { }, methods: { onModifySubmit() { - this.$refs["formRef"].validate((valid) => { - if (valid) { - if (isBlank(this.inputQuery.id)) { - addDeviceInspectPlanDelect(this.inputQuery).then((res) => { - if (res.code == 20000) { - this.closeDialog(); - } else { - this.$message.error(res.message); - } - }).catch((error) => { - this.$message.error(error.message); - }) - }else{ - uploadDeviceInspectPlanDelect(this.inputQuery).then((res) => { - if (res.code == 20000) { - this.closeDialog(); - } else { - this.$message.error(res.message); - } - }).catch((error) => { - this.$message.error(error.message); - }) - } - } - }); + //报修接口 + if(this.type == "repair"){ + this.$refs["formRef"].validate((valid) => { + if (valid) { + if (isBlank(this.inputQuery.id)) { + addDeviceRepairOrderDetail(this.inputQuery).then((res) => { + if (res.code == 20000) { + this.closeDialog(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + }else{ + updateDeviceRepairOrderDetail(this.inputQuery).then((res) => { + if (res.code == 20000) { + this.closeDialog(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + } + } + }); + }else{ + //巡检计划 + this.$refs["formRef"].validate((valid) => { + if (valid) { + if (isBlank(this.inputQuery.id)) { + addDeviceInspectPlanDelect(this.inputQuery).then((res) => { + if (res.code == 20000) { + this.closeDialog(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + }else{ + uploadDeviceInspectPlanDelect(this.inputQuery).then((res) => { + if (res.code == 20000) { + this.closeDialog(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + } + } + }); + } } }, created() { diff --git a/src/views/inventory/DeviceProjectSelect.vue b/src/views/inventory/DeviceProjectSelect.vue index d9291382..1707505d 100644 --- a/src/views/inventory/DeviceProjectSelect.vue +++ b/src/views/inventory/DeviceProjectSelect.vue @@ -95,6 +95,7 @@ import deviceRepairOrderModify from "@/views/inventory/DeviceRepairOrderModify.v import DeviceProjectSetDialog from "@/views/inventory/DeviceProjectSetDialog" import {isBlank} from "@/utils/strUtil"; import {addDeviceInspectPlanDelect} from "@/api/inventory/deviceInspectPlanDelect"; +import {addDeviceRepairOrderDetail} from "@/api/inventory/deviceRepairOrderDetail"; export default { @@ -108,6 +109,10 @@ export default { type: Object, required: true }, + repairType: { + type: Object, + required: true + }, closeDialog: { type: Function, required: true @@ -244,15 +249,27 @@ export default { } this.selectQuery.remark = this.selectQuery.remak this.selectQuery.orderIdFk = this.inputQuery.orderIdFk - addDeviceInspectPlanDelect(this.selectQuery).then((res) => { - if (res.code == 20000) { - this.closeDialog(); - } else { - this.$message.error(res.message); - } - }).catch((error) => { - this.$message.error(error.message); - }) + if(this.repairType == 'repair'){ + addDeviceRepairOrderDetail(this.selectQuery).then((res) => { + if (res.code == 20000) { + this.closeDialog(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + }else{ + addDeviceInspectPlanDelect(this.selectQuery).then((res) => { + if (res.code == 20000) { + this.closeDialog(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + } }, selectDetail(row) { this.selectQuery = row diff --git a/src/views/inventory/DeviceRepairOrderModify.vue b/src/views/inventory/DeviceRepairOrderModify.vue index b53235a4..90341427 100644 --- a/src/views/inventory/DeviceRepairOrderModify.vue +++ b/src/views/inventory/DeviceRepairOrderModify.vue @@ -92,60 +92,76 @@ - - - - - - - - - - - - - - - - - - {{ choiceFile }} - - 只能上传 jpg,png,pdf,doc 文件,且不超过 10 MB - + + + - + + + + 选入 + + + 新增 + + + + + + + + + + 编辑 + + 删除 + + + + + + + + + + + + + + + + + @@ -228,9 +245,13 @@ import {isBlank} from "@/utils/strUtil"; import {getDeptListByUser} from "@/api/auth/authDept"; import {getInvListByUser} from "@/api/system/invWarehouse"; -import {saveDeviceRepairOrder} from "@/api/inventory/deviceRepairOrder"; import {getDeptDeviceList} from "@/api/inventory/deptDevice"; import store from "@/store"; +import {saveDeviceRepairOrder} from "@/api/inventory/deviceRepairOrder" +import deviceInspectPlanProjectSet from "@/views/inventory/DeviceInspectPlanProjectSet" +import deviceProjectSelect from "@/views/inventory/DeviceProjectSelect" +import {selectDeviceInspectPlanDelect} from "@/api/inventory/deviceInspectPlanDelect"; +import {deleteRepairOrderDetail, filterByorderIdFk} from "@/api/inventory/deviceRepairOrderDetail"; export default { @@ -258,6 +279,7 @@ export default { page: 1, limit: 10 }, + loading: false, deviceList: [], deviceTotal: 0, deptName: null, @@ -277,7 +299,11 @@ export default { urgencyType: [{required: true, message: '请选择紧急程度', trigger: 'blur'}], planTime: [{required: true, message: '请选择计划完成日期', trigger: 'blur'}], }, - check: true + check: true, + detailList: [], + inputQuery: {}, + repairOrderSetVisible: false, + inspectSelectPlanSetVisible: false, }; }, methods: { @@ -327,10 +353,7 @@ export default { this.$message.error("请选择紧急程度") return; } - if (isBlank(this.repairOrder.planTime)) { - this.$message.error("请选择计划完成日期") - return; - } + let formName = isBlank(this.repairOrder.id) ? "add" : "edit"; saveDeviceRepairOrder(this.repairOrder, formName).then((res) => { if (res.code === 20000) { @@ -482,7 +505,106 @@ export default { }, uploadHandleError() { }, - + selectPlanFunction(row){ + if (this.repairOrder.id != null) { + if(isBlank(row)){ + this.inputQuery = {}; + this.inputQuery.orderIdFk = this.repairOrder.orderId + }else{ + this.inputQuery = row + } + this.inspectSelectPlanSetVisible = true; + } else { + this.$refs["dataForm"].validate((valid) => { + if (valid) { + let formName = isBlank(this.repairOrder.id) ? "add" : "edit"; + if (formName == "add") { + this.repairOrder.planStatus = 1; + } + saveDeviceRepairOrder(this.repairOrder, formName).then((res) => { + if (res.code === 20000) { + this.repairOrder.id = res.data.id; + this.repairOrder.orderId = res.data.orderId; + this.inputQuery = {}; + this.inputQuery.orderIdFk = this.repairOrder.orderId + this.inspectSelectPlanSetVisible = true; + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }); + } + }) + } + }, + setPlanFunction(row) { + if (this.repairOrder.id != null) { + if(isBlank(row)){ + this.inputQuery = {}; + this.inputQuery.orderIdFk = this.repairOrder.orderId + }else{ + this.inputQuery = row + } + this.repairOrderSetVisible = true; + } else { + this.$refs["dataForm"].validate((valid) => { + if (valid) { + let formName = isBlank(this.repairOrder.id) ? "add" : "edit"; + if(formName == "add"){ + this.repairOrder.planStatus = 1; + } + saveDeviceRepairOrder(this.repairOrder, formName).then((res) => { + if (res.code === 20000) { + this.repairOrder.id = res.data.id; + this.repairOrder.orderId = res.data.orderId; + this.inputQuery = {}; + this.inputQuery.orderIdFk = this.repairOrder.orderId + this.repairOrderSetVisible = true; + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }); + } + }) + } + }, + delectPlanFunction(row) { + deleteRepairOrderDetail({id: row.id}).then((res) => { + if (res.code == 20000) { + this.selectDevicerepairOrderDelect({orderIdFk: row.orderIdFk}) + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + }, + repairOrderSetCloseDialog() { + this.repairOrderSetVisible = false; + this.inspectSelectPlanSetVisible = false; + this.selectDevicerepairOrderDelect({orderIdFk: this.inputQuery.orderIdFk}) + }, + selectDevicerepairOrderDelect(obj) { + filterByorderIdFk(obj).then((res) => { + this.loading = false; + if (res.code === 20000) { + this.detailList = res.data || []; + } else { + this.$message.error(res.message); + this.detailList = []; + } + }).catch((error) => { + this.loading = false; + this.$message.error(error.message); + this.detailList = []; + }) + }, + }, + components:{ + deviceInspectPlanProjectSet,deviceProjectSelect }, created() { this.uploadUrl = this.BASE_URL + "/udiwms/upload/register/file"; @@ -492,6 +614,9 @@ export default { }; this.repairOrder.uploadImage = null; this.getDeptList(); + if(this.repairOrder.id !=null){ + this.selectDevicerepairOrderDelect({orderIdFk: this.repairOrder.orderId}) + } }, } diff --git a/src/views/inventory/DeviceRepairOrderNew.vue b/src/views/inventory/DeviceRepairOrderNew.vue index d16d8f6b..09062c72 100644 --- a/src/views/inventory/DeviceRepairOrderNew.vue +++ b/src/views/inventory/DeviceRepairOrderNew.vue @@ -82,7 +82,7 @@ - @@ -107,14 +107,7 @@ - - - - - {{ scope.row.uploadImage }} - - {{ statusMap[scope.row.status] }} @@ -155,6 +148,26 @@ > + + + + + + + + 详情 + + + + + + + + + + + + @@ -183,6 +211,9 @@ import {getRepairList, submitAudit, deleteRepairOrder} from "@/api/inventory/dev import deviceRepairOrderModify from "@/views/inventory/DeviceRepairOrderModify.vue"; import ElImageViewer from "element-ui/packages/image/src/image-viewer"; import {previewImage} from "@/api/purchase/supCompany"; +import {selectDeviceInspectPlanDelect} from "@/api/inventory/deviceInspectPlanDelect"; +import DeviceInspectPlanProjectSet from "@/views/inventory/DeviceInspectProjectSelect"; +import {filterByorderIdFk} from "@/api/inventory/deviceRepairOrderDetail"; export default { @@ -234,7 +265,10 @@ export default { code: null, msg: null }, - showSearch: true + showSearch: true, + detailList: [], + detailQuery: {}, + deviceProjectSelectVisible: false, }; }, methods: { @@ -393,10 +427,35 @@ export default { document.body.style.overflow = 'auto'; document.removeEventListener("touchmove", m, true); }, - + datailSelect(row){ + this.detailQuery = row + this.deviceProjectSelectVisible = true + }, + handleDetail(row){ + this.orderIds = row.orderId; + this.selectDeviceReceiveOrderDelect({orderIdFk:row.orderId}) + }, + selectDeviceReceiveOrderDelect(obj) { + filterByorderIdFk(obj).then((res) => { + this.loading = false; + if (res.code === 20000) { + this.detailList = res.data || []; + } else { + this.$message.error(res.message); + this.detailList = []; + } + }).catch((error) => { + this.loading = false; + this.$message.error(error.message); + this.detailList = []; + }) + }, + detailCloseDialogc() { + this.deviceProjectSelectVisible = false + }, }, components: { - deviceRepairOrderModify, ElImageViewer + deviceRepairOrderModify, ElImageViewer ,DeviceInspectPlanProjectSet }, filters: { statusFilterType(status) {