From 59b28d141ee4c5cba318f709d7a2af3d739d6e68 Mon Sep 17 00:00:00 2001 From: xielue Date: Wed, 14 Jun 2023 22:40:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=83=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MesProductionOrder/voucher.vue | 124 ++++++++++++++++-- 1 file changed, 112 insertions(+), 12 deletions(-) diff --git a/src/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/voucher.vue b/src/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/voucher.vue index f0e4b37..3c542fc 100644 --- a/src/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/voucher.vue +++ b/src/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/voucher.vue @@ -22,8 +22,12 @@ 弃审 删除 - 导出 - 打印 + 完成 + + 关闭 + + 导出 + 打印
@@ -229,7 +233,7 @@ export default { titleAlign: 'right', // 表单校验规则 - rules: { + rules: { start_time: [ { required: true, message: '请输入预计开始日期' } @@ -302,6 +306,7 @@ export default { pageInit() { this.pageStatus = ''; + this.deletedDetailsData = []; // 获取路由的id参数 let dataId = this.getDataId(); // 如果有id参数,说明是编辑模式 @@ -326,7 +331,7 @@ export default { if (a.data[detailDataFieldName].start_time) { a.data[detailDataFieldName].start_time = new Date(a.data[detailDataFieldName].start_time * 1000); } - + this.options.formOptions.data = a.data[detailDataFieldName]; @@ -334,7 +339,7 @@ export default { this.pageStatus = 'approved'; } - this.detailsData = a.dta[detailDataFieldName].production_order_materials || []; + this.detailsData = JSON.parse(JSON.stringify(a.data[detailDataFieldName].production_order_materials || [])) ; this.detailsDataInit(); this.$forceUpdate() @@ -410,28 +415,71 @@ export default { postdata.id = this.getDataId_BigInt(); } - postdata.production_order_materials = JSONbig.parse(JSONbig.stringify(this.detailsData)); + let ds = JSONbig.parse(JSONbig.stringify(this.detailsData)); - postdata.production_order_materials = postdata.production_order_materials.filter(item => item.materials_id); + ds = ds.filter(item => item.materials_id); + if (!ds.length) { + this.$mk.error(`数据行为空`); + return; + } - postdata.production_order_materials.forEach(item => { + ds.forEach(item => { if (this.dataId) { item.production_order_id = this.getDataId_BigInt(); } delete item._X_ROW_KEY; + if(item.id){ + item.id = this.$mk.toBigInt(item.id); + } + item.materials_id = this.$mk.toBigInt(item.materials_id); item.production_num = parseInt(item.production_num); item.batch_num = parseInt(item.batch_num); }) - if (!postdata.production_order_materials || !postdata.production_order_materials.length) { - this.$mk.error(`数据行为空`); - return; + console.log(ds) + + + if (this.dataId) { + postdata.production_order_materials = { + insertList:[], + updateList:[], + deleteList:[] + }; + + ds.forEach(item=>{ + if(item.id){ + postdata.production_order_materials.updateList.push(item); + } + else{ + postdata.production_order_materials.insertList.push(item); + } + }); + + this.deletedDetailsData.forEach(item=>{ + postdata.production_order_materials.deleteList.push(item); + }) + + + } else { + postdata.production_order_materials = ds; + + } + delete postdata.production_order_association_order; + delete postdata.reorder_staff; + delete postdata.update; + delete postdata.create; + delete postdata.production_department; + delete postdata.audit_staff_appoint; + + + + // 格式化提交的数据 this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items }); @@ -551,7 +599,7 @@ export default { return; } this.$mk.post({ - url: `${BASE_URL.BASE_URL}//MesProductionOrder/v1/mes/production/order/cancelApprove`, + url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/cancelApprove`, loading: '弃审中...', data: { id: this.getDataId_BigInt(), @@ -568,6 +616,52 @@ export default { } }); }, + pageComplete() { + let dataId = this.getDataId(); + if (!dataId) { + return; + } + this.$mk.post({ + url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/complete`, + loading: '操作中...', + data: { + id: this.getDataId_BigInt(), + audit_remark: '' + }, + useBigInt: true + }).then(a => { + if (a.code == "200") { + this.$mk.success(a.msg || "操作成功"); + this.pageInit(); + + } else { + this.$mk.error(a.msg); + } + }); + }, + pageClose() { + let dataId = this.getDataId(); + if (!dataId) { + return; + } + this.$mk.post({ + url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/close`, + loading: '操作中...', + data: { + id: this.getDataId_BigInt(), + audit_remark: '' + }, + useBigInt: true + }).then(a => { + if (a.code == "200") { + this.$mk.success(a.msg || "操作成功"); + this.pageInit(); + + } else { + this.$mk.error(a.msg); + } + }); + }, pageVoucherAdd() { this.dataId = null; this.pageInit(); @@ -668,6 +762,9 @@ export default { }, beforeEditMethod({ column, row }) { + if(this.pageStatus == "approved"){ + return false; + } if (row.SourceTableID && column.field != "Quantity") { return false; } @@ -684,6 +781,9 @@ export default { } }, beforeEditEvent({ column, row }) { + if(this.pageStatus == "approved"){ + return false; + } if (row.SourceTableID && column.field != "Quantity") { return false; }