From 27c00ecf13e3c5c6918ce244eeaf0f40eb0619f1 Mon Sep 17 00:00:00 2001 From: zhoulei Date: Wed, 15 Dec 2021 17:55:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:DN=E4=BF=AE=E5=A4=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=E6=90=BA=E5=B8=A6=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/J-Picker/jPicker.vue | 1 + .../raw/ingoods/dnReceipt/dnReceiving.vue | 87 +++++++++---------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/components/J-Picker/jPicker.vue b/src/components/J-Picker/jPicker.vue index eb9eb2f..277d117 100644 --- a/src/components/J-Picker/jPicker.vue +++ b/src/components/J-Picker/jPicker.vue @@ -139,6 +139,7 @@ export default { } }, selChange(e) { + console.log('触发机制。。'); this.nSel = e.detail.value[0]; }, filterOp(e) { diff --git a/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue b/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue index 9601983..eba0961 100644 --- a/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue +++ b/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue @@ -45,14 +45,14 @@ {{ $t('message.Cumulative') }} - + {{ $t('message.CommissionedLocation') }} - + {{ $t('message.CommissionedThisNumber') }} @@ -111,31 +111,29 @@ export default class dnReceiptDom extends BasePage { form: any = { documentNo: '', }; - material: any = {}; + // 原始物料列表(这里不准确,要修改) + material: any = []; poList: any = []; materialList: any = []; - every: any = ''; + // 当前被选择中原材料 + every: any = {}; value = ''; type = 'text'; border = true; - //累计数量 - Cumulative: any = 0; - //判断要添加的库位和已添加的库位是否相等 - sendSpotList: any = []; //本次数量 receiptAmount: any = ''; //库位 Location: any = []; - //添加库位和数量的列表 + //添加的库位和数量的列表 LocationList: any = []; - //所选择的库位 - wlCode: any = ''; + //所选择的库位对象 + wl: any = { + value: null, + }; //所选择的采购单号 - poNo: any = ''; + poNo: any = null; // 需求数量 - requestAmount = null; - //上传 - upload: any = []; + requestAmount: number = null; //页面初始化 async onReady() { //页面初始化 获取可选库位 @@ -165,9 +163,6 @@ export default class dnReceiptDom extends BasePage { }); return; } - // 1.查询获取物料列表 - // 2.根据物料列表中的poNo过滤返回新列表为采购单 - // 3.物料选择根据poNo过滤返回 await this.model.queryOrderInInfo(this.form.documentNo); let list: any = localStorage.getItem('list'); localStorage.removeItem('list'); @@ -214,16 +209,16 @@ export default class dnReceiptDom extends BasePage { //选择物料后触发的回调事件 本次数量:receiptAmount 需求数量:requestAmount materialChoice(e: any) { // 待放入新增中的公共对象 - this.every = e.pickerName; + this.every = { ...e.pickerName }; } //选择库位后触发的回调事件 LocationChoice(e: any) { - this.wlCode = e.pickerName.value; + this.wl = e.pickerName; } //点击添加 Add() { const count = this.totalLocation(this.LocationList); - if (this.receiptAmount == '' || this.wlCode == '') { + if (this.receiptAmount == '' || this.wl.value == '') { uni.showToast({ icon: 'none', title: this.$t('message.Commission_tips2') as any, @@ -245,7 +240,7 @@ export default class dnReceiptDom extends BasePage { return; } // 判断已添加库位和新添加库位是否相同,不相同return - let isTrue = this.LocationList.some((item) => item.wlCode !== this.wlCode); + let isTrue = this.LocationList.some((item) => item.wlCode !== this.wl.label); if (isTrue) { uni.showToast({ @@ -254,39 +249,48 @@ export default class dnReceiptDom extends BasePage { }); return; } - const loc = this.Location.find((item) => item.value === this.wlCode); this.LocationList.push({ - ...loc, + ...this.every, + wlCode: this.wl.label, receiptAmount: this.receiptAmount, - wlCode: this.wlCode, }); - this.every.wllist = this.LocationList; this.receiptAmount = ''; isTrue = true; this.business(); } deleteItem(index: any) { this.LocationList.splice(index, 1); - this.every.wllist.splice(index, 1); - console.log('表格数据', this.LocationList); - console.log('要上传的数据', this.every); this.business(); } + // 重置页面数据 + resetForm() { + // 清空 add table + this.LocationList = []; + this.poNo = ''; + // 清空 当前选择的库位对象 + this.wl = { + value: null, + }; + // 清空 物料对象 + this.every = {}; + // 清空 去重后的物料列表 + this.materialList = []; + // 清空 当前累计数量 + this.receiptAmount = null; + } async onSubmit() { - if (this.every.wllist == null || this.every.wllist.length == 0) { + this.resetForm(); + return; + + if (this.LocationList.length === 0) { uni.showToast({ icon: 'none', title: this.$t('message.Commission_tips5') as any, }); } - this.upload.push(this.every); - await this.model.submitOrderInEnter(this.upload); - this.LocationList = []; - this.wlCode = ''; - this.receiptAmount = ''; - this.Cumulative = 0; - this.every = ''; - this.materialList = []; + this.every.wllist = this.LocationList; + console.log('new this.every :::: ', this.every); + // await this.model.submitOrderInEnter([this.every]); } async bill() { if (this.form.documentNo == '') { @@ -306,12 +310,7 @@ export default class dnReceiptDom extends BasePage { } //添加和删除操作的时候 计算累计收货数量 business() { - let num = 0; - this.LocationList.forEach((item: any) => { - num += parseFloat(item.receiptAmount); - }); - this.Cumulative = num; - this.every.receiptAmount = num; + this.every.receiptAmount = this.totalLocation(this.LocationList); } }