diff --git a/src/pages/raw/ingoods/dnReceipt/ImportDN.vue b/src/pages/raw/ingoods/dnReceipt/ImportDN.vue index 17489e3..b5a7e89 100644 --- a/src/pages/raw/ingoods/dnReceipt/ImportDN.vue +++ b/src/pages/raw/ingoods/dnReceipt/ImportDN.vue @@ -134,6 +134,7 @@ export default class dnReceiptDom extends BasePage { newLocation: any = []; //添加库位和数量的列表 LocationList: any = []; + DNReceivingListIndex: any = null; //所选择的库位 wl: any = { value: null, @@ -251,6 +252,20 @@ export default class dnReceiptDom extends BasePage { materialChoice(e: any) { // 待放入新增中的公共对象 this.every = { ...e.pickerName }; + if (this.DNReceivingListIndex == null) { + this.model.ImportDNReceivingList.push(this.every); + } + this.model.ImportDNReceivingList.forEach((item: any, index: any) => { + if (item.poLine == this.every.poLine || item.materialCode == this.every.materialCode || item.dnNo == this.every.dnNo) { + this.DNReceivingListIndex = index; + } + }); + this.model.ImportDNReceivingList.forEach((item: any, index: any) => { + if (item.poLine != this.every.poLine || item.materialCode != this.every.materialCode || item.dnNo != this.every.dnNo) { + this.model.ImportDNReceivingList.push(this.every); + this.DNReceivingListIndex = index + 1; + } + }); this.newLocation = []; this.newLocation = this.Location.filter((item: any) => item.sendSpot === this.every.sendSpot); console.log('newLoction', this.newLocation); @@ -303,15 +318,27 @@ export default class dnReceiptDom extends BasePage { wlCode: this.wl.label, receiptAmount: this.receiptAmount, }); + this.model.ImportDNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList); //将本次数量蓝清空 this.receiptAmount = ''; //为什莫要将置为true???? isTrue = true; this.business(); } - deleteItem(index: any) { + deleteItem(indexItem: any) { + let Item: any = {}; + this.model.ImportDNReceivingList.forEach((item: any) => { + if (item.poLine == this.every.poLine || item.materialCode == this.every.materialCode || item.dnNo == this.every.dnNo) { + Item = item; + } + }); + Item.wllist.forEach((item: any, index: any) => { + if (item.poLine == this.LocationList[indexItem].poLine || item.materialCode == this.LocationList[indexItem].materialCode || item.dnNo == this.LocationList[indexItem].dnNo) { + Item.wllist.splice(index, 1); + } + }); //splice有删除功能,第一个参数为位置,第二个参数是数量 - this.LocationList.splice(index, 1); + this.LocationList.splice(indexItem, 1); this.business(); // guoshuang 删除成功提示 uni.showToast({ @@ -351,7 +378,7 @@ export default class dnReceiptDom extends BasePage { } //此条是什么作用 提交里的入参是和后端商量好的吗???? this.every.wllist = this.LocationList; - await this.model.submitOrderInEnter([this.every]); + await this.model.submitOrderInEnter(this.model.ImportDNReceivingList); this.resetForm(); } async bill() { diff --git a/src/pages/raw/ingoods/dnReceipt/model.ts b/src/pages/raw/ingoods/dnReceipt/model.ts index ff262eb..4ffcab5 100644 --- a/src/pages/raw/ingoods/dnReceipt/model.ts +++ b/src/pages/raw/ingoods/dnReceipt/model.ts @@ -36,6 +36,7 @@ export class ReceiptModule extends VuexModule { code = ''; DNdetailedList: any; DNReceivingList: any = []; + ImportDNReceivingList: any = []; /** * 看单号查询结果 */