From 2edd98620286e487729f977a11f2681f91f7a0c8 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Thu, 21 Nov 2024 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages-warehouse/inOutWarehouse/part.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pages-warehouse/inOutWarehouse/part.vue b/pages-warehouse/inOutWarehouse/part.vue index 71b9c5a..0e2470c 100644 --- a/pages-warehouse/inOutWarehouse/part.vue +++ b/pages-warehouse/inOutWarehouse/part.vue @@ -393,13 +393,15 @@ export default { }).then(res => { this.partList = Object.entries(res.data) this.partList = this.partList.map(([key, value]) => { - return [key, value.filter(item => (!item.inCount && item.inCount !== item.goodsCount))] + return [key, value.filter(item => { + return item.inCount !== item.goodsCount + })] }) this.partList = this.partList.filter(([key, value]) => value.length > 0) this.partList.forEach(([key, value]) => { value.forEach(item => { - item.goodsCount = item.goodsCount - item?.inCount | 0 - item.inCount = item.goodsCount - item?.inCount | 0 + item.goodsCount = item.goodsCount - (item.inCount ? item.inCount : 0) + item.inCount = item.goodsCount }) }) const values = this.partList.map(([key, value]) => value) @@ -426,11 +428,13 @@ export default { id: this.soId, soNo: createUniqueCodeByHead("RK") } + const values = this.partList.map(([key, value]) => value).reduce((acc, item) => acc.concat(item)) if (this.selectRows && this.selectRows.length > 0){ - data.soiList = [...this.selectRows] - data.waresList = [...this.selectRows.map(item => item.wares)] + const ids = this.selectRows.map(item => item.id) + const newSelect = values.filter(item => ids.includes(item.id)) + data.soiList = [...newSelect] + data.waresList = [...newSelect.map(item => item.wares)] }else { - const values = this.partList.map(([key, value]) => value).reduce((acc, item) => acc.concat(item)) data.soiList = [...values] data.waresList = [...values.map(item => item.wares)] }