|
@@ -32,7 +32,7 @@ module.exports = app => {
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
const bills = [];
|
|
|
- let iCode, iName, iUnit, iUp, iQty, iTp, bCheckCol = false;
|
|
|
+ let iCode = -1, iName = -1, iUnit = -1, iUp = -1, iQty = -1, iTp = -1, bCheckCol = false;
|
|
|
for (let iRow = 0; iRow < sheet.data.length; iRow++) {
|
|
|
const row = sheet.data[iRow];
|
|
|
if (!bCheckCol) {
|
|
@@ -54,15 +54,15 @@ module.exports = app => {
|
|
|
iUp = -1;
|
|
|
iQty = -1;
|
|
|
}
|
|
|
- } else if (this.ctx.helper.validBillsCode(row[0])) {
|
|
|
+ } else if (this.ctx.helper.validBillsCode(row[iCode])) {
|
|
|
const data = {
|
|
|
deal_id: bills.length + 1,
|
|
|
tender_id: tenderId,
|
|
|
- code: row[0],
|
|
|
- name: row[1],
|
|
|
- unit: row[2],
|
|
|
- unit_price: row[3],
|
|
|
- quantity: row[4],
|
|
|
+ code: row[iCode],
|
|
|
+ name: row[iName],
|
|
|
+ unit: row[iUnit],
|
|
|
+ unit_price: row[iUp],
|
|
|
+ quantity: row[iQty],
|
|
|
};
|
|
|
if ((data.unit_price && !this._.isNumber(data.unit_price)) || (data.quantity && !this._.isNumber(data.quantity))) {
|
|
|
throw '导入的Excel的数据类型有误,请检查第' + (iRow + 1) + '行';
|