Browse Source

(*)回款和开票明细表导入 去掉编号判重

master
wuqun 2 years ago
parent
commit
6482a356d4
  1. 24
      api/app/lib/controllers/report/achievement.js
  2. 18
      web/client/src/sections/business/containers/performanceReport/importBackModal.jsx
  3. 18
      web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js

24
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;

18
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}行【回款年份】填写错误`)

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

Loading…
Cancel
Save