From 6482a356d4c6440dfc35b2e750953751daddc631 Mon Sep 17 00:00:00 2001 From: wuqun Date: Tue, 13 Dec 2022 16:45:02 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=9B=9E=E6=AC=BE=E5=92=8C=E5=BC=80?= =?UTF-8?q?=E7=A5=A8=E6=98=8E=E7=BB=86=E8=A1=A8=E5=AF=BC=E5=85=A5=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=BC=96=E5=8F=B7=E5=88=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/achievement.js | 24 +++++++++---------- .../performanceReport/importBackModal.jsx | 18 +++++++------- .../importInvoicingDetailsModal.js | 18 +++++++------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/api/app/lib/controllers/report/achievement.js b/api/app/lib/controllers/report/achievement.js index b36ad3f..e3a70f9 100644 --- a/api/app/lib/controllers/report/achievement.js +++ b/api/app/lib/controllers/report/achievement.js @@ -289,19 +289,19 @@ async function importBackDetails(ctx) { const data = ctx.request.body; const { tableModel } = ctx.query; let modelName = tableModel || 'ReceivableDetail' - let addArr = []; - let dataList = await models[modelName].findAll({//查编号 - attributes: ['number'] - }); - data.map(d => { - let exist = dataList.find(m => m.dataValues.number == d.number); - if (!exist) { - addArr.push(d); - } - }) + //let addArr = []; + // let dataList = await models[modelName].findAll({//查编号 + // attributes: ['number'] + // }); + //data.map(d => { + //let exist = dataList.find(m => m.dataValues.number == d.number); + //if (!exist) { + //addArr.push(d); + //} + //}) //只处理新增的 - if (addArr.length) { - await models[modelName].bulkCreate(addArr, { transaction }); + if (data.length) { + await models[modelName].bulkCreate(data, { transaction }); } await transaction.commit(); ctx.status = 204; diff --git a/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx b/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx index c241ab7..289ea85 100644 --- a/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx +++ b/web/client/src/sections/business/containers/performanceReport/importBackModal.jsx @@ -199,15 +199,15 @@ const ImportBackModal = props => { error(`第${i + 2}行【序号】填写错误,需要为非负整数`) return } - let exist = allNumbers.find(m => m.number == obj.number);//数据库中 已有该编号 - if (exist) { - error(`第${i + 2}行的【编号】在系统中已存在`) - return - } - if (postData.some(p => p.number == obj.number)) {//编号 唯一 - error(`第${i + 2}行【编号】重复,请更改后重新上传`) - return - } + // let exist = allNumbers.find(m => m.number == obj.number);//数据库中 已有该编号 + // if (exist) { + // error(`第${i + 2}行的【编号】在系统中已存在`) + // return + // } + // if (postData.some(p => p.number == obj.number)) {//编号 唯一 + // error(`第${i + 2}行【编号】重复,请更改后重新上传`) + // return + // } //回款年份 if (obj.receivableYear && !yearPattern.test(obj.receivableYear)) { error(`第${i + 2}行【回款年份】填写错误`) diff --git a/web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js b/web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js index cba46d0..b37151a 100644 --- a/web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js +++ b/web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js @@ -185,15 +185,15 @@ const ImportInvoicingDetailsModal = props => { error(`第${i + 2}行【序号】填写错误,需要为非负整数`) return } - let exist = allNumbers.find(m => m.number == obj.number);//数据库中 已有该编号 - if (exist) { - error(`第${i + 2}行的【编号】在系统中已存在`) - return - } - if (postData.some(p => p.number == obj.number)) {//编号 唯一 - error(`第${i + 2}行【编号】重复,请更改后重新上传`) - return - } + // let exist = allNumbers.find(m => m.number == obj.number);//数据库中 已有该编号 + // if (exist) { + // error(`第${i + 2}行的【编号】在系统中已存在`) + // return + // } + // if (postData.some(p => p.number == obj.number)) {//编号 唯一 + // error(`第${i + 2}行【编号】重复,请更改后重新上传`) + // return + // } for (let k = 0; k < ColumnDateKey.length; k++) { let cValid = judgeTimeValid(obj[ColumnDateKey[k]]);