diff --git a/src/renderer/src/views/shujuguanli.vue b/src/renderer/src/views/shujuguanli.vue index f2df764..7f4e537 100644 --- a/src/renderer/src/views/shujuguanli.vue +++ b/src/renderer/src/views/shujuguanli.vue @@ -770,6 +770,41 @@ export default { 'Quantity to deliver': item["Quantity to deliver"] ? item["Quantity to deliver"].toFixed(3) : "" }) } + let lilstLocalTemp = [] + for (let index = 0; index < this.fileData2Local.length; index++) { + let element = this.fileData2Local[index]; + let findIndex = [] + let findAllIndex = [] + for (let j = 0; j < lilstLocal.length; j++) { + let item = lilstLocal[j]; + if (!item["isFind"]) { + if (item["Store"] === element["Store"] && item["Sku"] === element["Sku"] && item["Description"] === element["Description"] && item["Quantity to deliver"] === element["Quantity to deliver"]) { + findIndex.push(j) + } + if (item["Store"] === element["Store"] && item["Sku"] === element["Sku"] && item["Description"] === element["Description"]) { + findAllIndex.push(j) + } + } + } + findIndex = _.uniq(findIndex) + findAllIndex = _.uniq(findAllIndex) + let exList = _.difference(findAllIndex, findIndex) + for (let j = 0; j < findIndex.length; j++) { + let item = lilstLocal[findIndex[j]]; + lilstLocalTemp.push({ ...item }) + item["isFind"] = true + } + for (let j = 0; j < exList.length; j++) { + let item = lilstLocal[exList[j]]; + lilstLocalTemp.push({ ...item }) + item["isFind"] = true + } + } + let extraList = _.filter(lilstLocal, o => !o["isFind"]) + for (let i = 0; i < extraList.length; i++) { + let element = extraList[i]; + lilstLocalTemp.push({ ...element }) + } // 创建一个新的工作簿和工作表 let workbook = new ExcelJS.Workbook(); let worksheet = workbook.addWorksheet('Sheet1'); @@ -784,7 +819,7 @@ export default { }); // 设置数据行样式 - lilstLocal.forEach((row, rowIndex) => { + lilstLocalTemp.forEach((row, rowIndex) => { let rowKeys = Object.keys(row); for (let colIndex = 0; colIndex < rowKeys.length; colIndex++) { let key = rowKeys[colIndex];