From ba93fe09390c90b3e5a4ef54bfe6181ce6c45678 Mon Sep 17 00:00:00 2001 From: guoshuang Date: Tue, 8 Feb 2022 16:25:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=9F=E6=9D=90=E6=96=99=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/raw/handover/aggregating/model.ts | 26 ++++- src/pages/raw/handover/aggregating/order.vue | 45 ++++++--- .../raw/handover/aggregating/summary.vue | 96 ++++++++++++------- 3 files changed, 113 insertions(+), 54 deletions(-) diff --git a/src/pages/raw/handover/aggregating/model.ts b/src/pages/raw/handover/aggregating/model.ts index 847c6e1..0326e90 100644 --- a/src/pages/raw/handover/aggregating/model.ts +++ b/src/pages/raw/handover/aggregating/model.ts @@ -94,6 +94,11 @@ export class AggregatingModule extends VuexModule { checkAllAggregateList(checked: boolean) { this.aggregateList = this.aggregateList.map((item: any) => { item.checked = checked; + if (item.checked) { + item.hvAmount = item.totalMoAmount - item.totalHvAmount; + } else { + item.hvAmount = 0; + } return item; }); } @@ -115,8 +120,13 @@ export class AggregatingModule extends VuexModule { setAggregateListItemHvAmount({ index, hvAmount }: { index: number; hvAmount: number }) { const original = this.aggregateList[index]; const newItem = { ...original, hvAmount }; - // this.aggregateList.splice(index, 1, newItem); this.aggregateList[index].hvAmount = hvAmount; + // this.aggregateList.splice(index, 1, newItem); + // if (this.aggregateList[index].checked) { + // this.aggregateList[index].hvAmount = this.aggregateList[index].totalMoAmount - this.aggregateList[index].totalHvAmount; + // } else { + // this.aggregateList[index].hvAmount = 0; + // } } /** @@ -130,13 +140,14 @@ export class AggregatingModule extends VuexModule { // this.orderList.splice(index, 1, newItem); this.orderList[index].hvAmount = hvAmount; } - // setOrderListItemHvAmount(params: { hvAmount: number }) { + // setOrderListItemHvAmount() { // this.orderList // .filter((_: any) => _.checked) // .forEach((item: any) => { - // if (params.hvAmount) { - // item.currentAmount = params.hvAmount; - // } + // item.hvAmount = item.totalMoAmount - item.totalHvAmount; + // // if (params.hvAmount) { + // // item.currentAmount = params.hvAmount; + // // } // }); // } @@ -176,6 +187,11 @@ export class AggregatingModule extends VuexModule { checkAllOrderList(checked: boolean) { this.orderList = this.orderList.map((item: any) => { item.checked = checked; + if (item.checked) { + item.hvAmount = item.totalMoAmount - item.totalHvAmount; + } else { + item.hvAmount = 0; + } return item; }); } diff --git a/src/pages/raw/handover/aggregating/order.vue b/src/pages/raw/handover/aggregating/order.vue index 018e174..90211d8 100644 --- a/src/pages/raw/handover/aggregating/order.vue +++ b/src/pages/raw/handover/aggregating/order.vue @@ -8,11 +8,11 @@ - + - + @@ -38,17 +38,17 @@ - + {{ $t('message.po_SelectAll') }} - + + {{ $t('message.po_Submit') }} @@ -137,7 +137,7 @@ export default class AggregatingOrder extends BasePage { // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕 onReady() { - this.$amountForm.setRules(this.amountFormRules); + //this.$amountForm.setRules(this.amountFormRules); this.$submitForm.setRules(this.submitFormRules); this.isHandoverFinished = false; } @@ -155,9 +155,26 @@ export default class AggregatingOrder extends BasePage { model.checkAllOrderList(!model.isOrderCheckedAll); } clickIndex(e: any) { - this.spliceItem = e.data[0].lineData.orderOutId; - let num:any = parseFloat(e.data[0].lineData.totalMoAmount) - parseFloat(e.data[0].lineData.totalHvAmount) - this.amountForm.amount = num + console.log('ccccc', e.data); + // this.spliceItem = e.data[0].lineData.orderOutId; + // let num:any = parseFloat(e.data[0].lineData.totalMoAmount) - parseFloat(e.data[0].lineData.totalHvAmount) + // this.amountForm.amount = num + // 已交接数量 + e.data.forEach((item, index) => { + //debugger; + console.log('xuanzedeindex', e.data); + console.log('hvmount', item.lineData.totalMoAmount - item.lineData.totalHvAmount); + model.setOrderListItemHvAmount({ + index: e.data[index].index, + hvAmount: item.lineData.totalMoAmount - item.lineData.totalHvAmount, + }); + }); + this.model.orderList.forEach((item) => { + if (item.checked == false) { + item.hvAmount = 0; + } + }); + console.log('/////////', this.model.orderList); } /** * 接收人确认 @@ -174,7 +191,7 @@ export default class AggregatingOrder extends BasePage { /** * 确认 */ - onOk() { + /**onOk() { this.$amountForm.validate((valid) => { if (!valid) return; const firstSelection = this.model.orderList.find((_) => _.checked); @@ -197,7 +214,7 @@ export default class AggregatingOrder extends BasePage { }); } }); - } + }**/ onSubmit() { this.$submitForm.validate(async (valid) => { if (valid) { @@ -289,7 +306,7 @@ export default class AggregatingOrder extends BasePage { // model.proOrderResultList.splice(index, 1); // } // }); - this.$amountForm.setRules(this.amountFormRules); + //this.$amountForm.setRules(this.amountFormRules); this.$submitForm.setRules(this.submitFormRules); } /** diff --git a/src/pages/raw/handover/aggregating/summary.vue b/src/pages/raw/handover/aggregating/summary.vue index b42798e..6269ab2 100644 --- a/src/pages/raw/handover/aggregating/summary.vue +++ b/src/pages/raw/handover/aggregating/summary.vue @@ -8,11 +8,11 @@ - + - + @@ -38,17 +38,17 @@ - + {{ $t('message.po_SelectAll') }} - + + {{ $t('message.po_Submit') }} @@ -137,12 +137,33 @@ export default class AggregatingSummary extends BasePage { // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕 onReady() { - this.$amountForm.setRules(this.amountFormRules); + /**this.$amountForm.setRules(this.amountFormRules);**/ this.$submitForm.setRules(this.submitFormRules); this.isBusinessFinished = false; } clickIndex(e: any) { - this.spliceItem = e.data[0].lineData.materialCode; + console.log('ccccc', e); + //this.spliceItem = e.data[0].lineData.materialCode; + //修改本次交接数量 + // model.setAggregateListItemHvAmount({ + // index: this.model.aggregateList.findIndex((_) => _.checked), + // hvAmount: 0, + // }); + e.data.forEach((item, index) => { + //debugger; + console.log('xuanzedeindex', e.data); + console.log('hvmount', item.lineData.totalMoAmount - item.lineData.totalHvAmount); + model.setAggregateListItemHvAmount({ + index: e.data[index].index, + hvAmount: item.lineData.totalMoAmount - item.lineData.totalHvAmount, + }); + }); + this.model.aggregateList.forEach((item) => { + if (item.checked == false) { + item.hvAmount = 0; + } + }); + console.log('/////////', this.model.aggregateList); } beforeDestroy() { if (model.aggregateList.length > 0 && !this.isBusinessFinished) { @@ -171,30 +192,33 @@ export default class AggregatingSummary extends BasePage { /** * 确认 */ - onOk() { - this.$amountForm.validate((valid) => { - if (!valid) return; - const firstSelection = this.model.aggregateList.find((_) => _.checked); - if (firstSelection === undefined) { - this.customToast(this.$t('message.Pi_tip7') as string); - } else { - // 本次交接数量 - const currentPickNum = parseFloat(this.amountForm.amount); - // 已交接数量 - const totalHvAmount = parseFloat(firstSelection.totalHvAmount); - // 拣配数量 - const totalMoAmount = parseFloat(firstSelection.totalMoAmount); - if (currentPickNum != totalMoAmount) { - this.customToast(this.$t('message.Pi_tip12') as string); - return; - } - model.setAggregateListItemHvAmount({ - index: this.model.aggregateList.findIndex((_) => _.checked), - hvAmount: currentPickNum, - }); - } - }); - } + // onOk() { + // this.$amountForm.validate((valid) => { + // if (!valid) return; + // const firstSelection = this.model.aggregateList.find((_) => _.checked); + // if (firstSelection === undefined) { + // this.customToast(this.$t('message.Pi_tip7') as string); + // } else { + // // 本次交接数量 + // const currentPickNum = parseFloat(this.amountForm.amount); + // // 已交接数量 + // const totalHvAmount = parseFloat(firstSelection.totalHvAmount); + // // 拣配数量 + // const totalMoAmount = parseFloat(firstSelection.totalMoAmount); + // //点击确定时有校验输入的交接数量必须=累计拣配数量??? + // // if (currentPickNum != totalMoAmount) { + // // this.customToast(this.$t('message.Pi_tip12') as string); + // // return; + // // } + // //修改表格信息的 + // model.setAggregateListItemHvAmount({ + // index: this.model.aggregateList.findIndex((_) => _.checked), + // //hvAmount: currentPickNum, + // hvAmount: totalMoAmount - totalHvAmount, + // }); + // } + // }); + // } /** * 上传 @@ -241,6 +265,8 @@ export default class AggregatingSummary extends BasePage { this.customToast(this.$t('message.Pi_tip13') as string); return; } + //此处校验了请确保交接数量等于需求数量 + //totalMoAmount:累计拣配数量 totalHvAmount:交接数量 hvAmount:本次交接数量 List.forEach((item: any) => { if (parseFloat(item.totalMoAmount) - parseFloat(item.totalHvAmount) != parseFloat(item.hvAmount)) { isTrue = false; @@ -274,7 +300,7 @@ export default class AggregatingSummary extends BasePage { }); } async onAggregate() { - this.amountForm.amount = ''; + /**this.amountForm.amount = '';**/ this.submitForm.receiver = ''; this.submitForm.receiverName = ''; this.submitForm.password = ''; @@ -292,7 +318,7 @@ export default class AggregatingSummary extends BasePage { // model.proOrderResultList.splice(index, 1); // } // }); - this.$amountForm.setRules(this.amountFormRules); + /**this.$amountForm.setRules(this.amountFormRules);**/ this.$submitForm.setRules(this.submitFormRules); } /**