From 01bf5b211ab73c26203fc16e14b89760ae12cc79 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Thu, 21 Nov 2024 13:41:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E6=96=99=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/detail.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common/detail.js b/src/common/detail.js index 59722ec2..35ef4ba1 100644 --- a/src/common/detail.js +++ b/src/common/detail.js @@ -85,7 +85,24 @@ export function getThreeDataSource(data) { return items; } - +export function getDataSourceBatch(subList) { + let items = []; + subList.forEach(detail => { + var item = items.find(r => + r.itemCode == detail.itemCode ) + if (item == undefined) { + item = createItemInfo(detail); + let newDetail = createDetailInfo(detail); // + item.subList.push(newDetail); + items.push(item) + } else { + item.qty = calc.add(item.qty, detail.qty) + let newDetail = createDetailInfo(detail); // + item.subList.push(newDetail); + } + }) + return items; +} export function getDataSource(subList) { let items = [];