From 049df4813810673cfd6d7c2f2b45a38f59544df0 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Mon, 6 May 2024 11:10:16 +0800 Subject: [PATCH] =?UTF-8?q?2024-5-6=20=E8=AE=BE=E5=A4=87=E6=A8=A1=E5=9D=97?= =?UTF-8?q?-=E5=B7=A1=E6=A3=80=E5=B7=A5=E5=8D=95-=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=88=E6=90=9C=E7=B4=A2=E6=A1=86=E3=80=81?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA=E3=80=81=E5=88=97=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=AD=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/deviceOrder/index.vue | 966 ++++++++++++++++--------- 1 file changed, 618 insertions(+), 348 deletions(-) diff --git a/src/views/device/deviceOrder/index.vue b/src/views/device/deviceOrder/index.vue index e3af9034..a02ec13b 100644 --- a/src/views/device/deviceOrder/index.vue +++ b/src/views/device/deviceOrder/index.vue @@ -1,6 +1,13 @@ @@ -666,17 +893,17 @@ import { getDeviceOrder, delDeviceOrder, addDeviceOrder, - updateDeviceOrder + updateDeviceOrder, } from "@/api/device/deviceOrder"; -import {getWorkCenter} from "@/api/device/plan"; -import {getInspectionWork} from "@/api/device/inspectionWork"; +import { getWorkCenter } from "@/api/device/plan"; +import { getInspectionWork } from "@/api/device/inspectionWork"; export default { name: "DeviceOrder", - dicts: ['device_order_status', 'device_loop_type','device_reach_standard'], + dicts: ["device_order_status", "device_loop_type", "device_reach_standard"], data() { return { - standardListVo:[], + standardListVo: [], // 初始化VO workVO: { order: { @@ -691,7 +918,8 @@ export default { orderStart: null, orderEnd: null, planPerson: null, - }, equ: { + }, + equ: { equipmentCode: null, equipmentName: null, equipmentLocation: null, @@ -699,40 +927,45 @@ export default { equipmentTypeName: null, workshopCode: null, workshopName: null, - }, detailList: [] + }, + detailList: [], }, // 工单详情弹窗 workDetail: false, // 日期范围选择快捷 pickerOptions: { - shortcuts: [{ - text: '最近一周', - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); - picker.$emit('pick', [start, end]); - } - }, { - text: '最近一个月', - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); - picker.$emit('pick', [start, end]); - } - }, { - text: '最近三个月', - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); - picker.$emit('pick', [start, end]); - } - }] + shortcuts: [ + { + text: "最近一周", + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); + picker.$emit("pick", [start, end]); + }, + }, + { + text: "最近一个月", + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit("pick", [start, end]); + }, + }, + { + text: "最近三个月", + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); + picker.$emit("pick", [start, end]); + }, + }, + ], }, // 工作中心 - workCenterList:[], + workCenterList: [], // 记录 recordList: [], // 遮罩层 @@ -759,7 +992,7 @@ export default { pageSize: 10, planId: null, planCode: null, - planType: 'inspection', + planType: "inspection", orderCode: null, planWorkshop: null, planProdLine: null, @@ -770,6 +1003,7 @@ export default { orderStart: null, orderEnd: null, equipmentCode: null, + equipmentName: null, orderStatus: null, orderCost: null, planPerson: null, @@ -791,10 +1025,10 @@ export default { }, // 表单参数 form: { - equ: {equipmentName: null}, + equ: { equipmentName: null }, }, // 表单校验 - rules: {} + rules: {}, }; }, created() { @@ -807,30 +1041,29 @@ export default { this.loading = true; this.reset(); this.standardListVo = []; - const orderId = row.orderId || this.ids - getInspectionWork(orderId).then(response => { + const orderId = row.orderId || this.ids; + getInspectionWork(orderId).then((response) => { this.workVO = response.data; for (let i = 0; i < this.workVO.detailList.length; i++) { - for (let j = 0; j < this.workVO.detailList[i].standardList.length; j++) { - this.workVO.detailList[i].standardList[j].itemName = this.workVO.detailList[i].itemName; + for (let j = 0;j < this.workVO.detailList[i].standardList.length;j++) { + this.workVO.detailList[i].standardList[j].itemName =this.workVO.detailList[i].itemName; this.standardListVo.push(this.workVO.detailList[i].standardList[j]); } } this.loading = false; this.workDetail = true; }); - }, // 获取工作中心 setWorkCenter() { - getWorkCenter().then(response => { + getWorkCenter().then((response) => { this.workCenterList = response.data; - }) + }); }, /** 查询计划工单列表 */ getList() { this.loading = true; - listDeviceOrder(this.queryParams).then(response => { + listDeviceOrder(this.queryParams).then((response) => { this.deviceOrderList = response.rows; this.total = response.total; this.loading = false; @@ -847,7 +1080,7 @@ export default { orderId: null, planId: null, planCode: null, - planType: 'inspection', + planType: "inspection", orderCode: null, planWorkshop: null, planProdLine: null, @@ -858,6 +1091,7 @@ export default { orderStart: null, orderEnd: null, equipmentCode: null, + equipmentName: null, orderStatus: null, orderCost: null, planPerson: null, @@ -872,11 +1106,11 @@ export default { createTime: null, updateBy: null, updateTime: null, - equ: {equipmentName: null}, + equ: { equipmentName: null }, loopStartArray: [], orderStartArray: [], orderEndArray: [], - loopEndArray: [] + loopEndArray: [], }; this.resetForm("form"); }, @@ -891,14 +1125,15 @@ export default { this.queryParams.orderStartArray = []; this.queryParams.orderEndArray = []; this.queryParams.loopEndArray = []; + this.queryParams.planLoopType = null; this.resetForm("queryForm"); this.handleQuery(); }, // 多选框选中数据 handleSelectionChange(selection) { - this.ids = selection.map(item => item.orderId) - this.single = selection.length !== 1 - this.multiple = !selection.length + this.ids = selection.map((item) => item.orderId); + this.single = selection.length !== 1; + this.multiple = !selection.length; }, /** 新增按钮操作 */ handleAdd() { @@ -911,15 +1146,26 @@ export default { this.loading = true; this.reset(); this.recordList = []; - const orderCode = row.orderCode || this.ids - getDeviceOrder(orderCode).then(response => { + const orderCode = row.orderCode || this.ids; + getDeviceOrder(orderCode).then((response) => { this.form = response.data; if (response.data.timeArray[0] == null) { response.data.timeArray = []; } for (let i = 0; i < this.form.detailList.length; i++) { - for (let j = 0; j < this.form.detailList[i].standardList.length; j++) { + for (let j = 0;j < this.form.detailList[i].standardList.length;j++) { this.form.detailList[i].standardList[j].itemName = this.form.detailList[i].itemName; + //显示已经传入的图片 + if (response.data.detailList[i].standardList[j].picturePaths != null) { + var newFiles = []; + response.data.detailList[i].standardList[j].picturePaths.forEach((item) => { + var newFile = {}; + newFile.name = item.fileName; + newFile.url = item.fileAddress; + newFiles.push(newFile); + }); + this.form.detailList[i].standardList[j].picturePath = newFiles; + } this.recordList.push(this.form.detailList[i].standardList[j]); } } @@ -930,16 +1176,24 @@ export default { }, /** 提交按钮 */ submitForm() { - this.$refs["form"].validate(valid => { + this.$refs["form"].validate((valid) => { + for (let i = 0; i < this.form.detailList.length; i++) { + for (let j = 0;j < this.form.detailList[i].standardList.length;j++) { + if (Array.isArray(this.form.detailList[i].standardList[j].picturePath)) { + this.form.detailList[i].standardList[j].picturePath = this.listToString(this.form.detailList[i].standardList[j].picturePath); + } + } + } + if (valid) { if (this.form.orderId != null) { - updateDeviceOrder(this.form).then(response => { + updateDeviceOrder(this.form).then((response) => { this.$modal.msgSuccess("提交成功"); this.open = false; this.getList(); }); } else { - addDeviceOrder(this.form).then(response => { + addDeviceOrder(this.form).then((response) => { this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); @@ -948,21 +1202,30 @@ export default { } }); }, + // 对象转成指定字符串分隔 + listToString(list, separator) { + let strs = ""; + separator = separator || ","; + for (let i in list) { + strs += list[i].url + separator; + } + return strs != "" ? strs.substr(0, strs.length - 1) : ""; + }, /** 删除按钮操作 */ handleDelete(row) { const orderIds = row.orderId || this.ids; - var orderCodes = ''; + var orderCodes = ""; // 处理信息 for (let i = 0; i < this.deviceOrderList.length; i++) { for (let j = 0; j < orderIds.length; j++) { if (orderIds[j] == this.deviceOrderList[i].orderId) { - orderCodes = orderCodes + this.deviceOrderList[i].orderCode + ','; + orderCodes = orderCodes + this.deviceOrderList[i].orderCode + ","; } } } - if (orderCodes == '') { + if (orderCodes == "") { for (let i = 0; i < this.deviceOrderList.length; i++) { if (orderIds == this.deviceOrderList[i].orderId) { orderCodes = this.deviceOrderList[i].orderCode; @@ -970,27 +1233,34 @@ export default { } } - this.$modal.confirm('是否确认删除计划工单编号为"' + orderCodes + '"的数据项?').then(function () { - return delDeviceOrder(orderIds); - }).then(response => { - if (response.code != 500) { - this.$modal.msgSuccess("删除成功"); - this.getList(); - } - }).catch(() => { - }); + this.$modal + .confirm('是否确认删除计划工单编号为"' + orderCodes + '"的数据项?') + .then(function () { + return delDeviceOrder(orderIds); + }) + .then((response) => { + if (response.code != 500) { + this.$modal.msgSuccess("删除成功"); + this.getList(); + } + }) + .catch(() => {}); }, /** 导出按钮操作 */ handleExport() { - this.download('device/deviceOrder/export', { - ...this.queryParams - }, `deviceOrder_${new Date().getTime()}.xlsx`) - } - } + this.download( + "device/deviceOrder/export", + { + ...this.queryParams, + }, + `deviceOrder_${new Date().getTime()}.xlsx` + ); + }, + }, };