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]]);