|
@@ -8,6 +8,10 @@
|
|
|
* @version
|
|
|
*/
|
|
|
const _ = require('lodash');
|
|
|
+const colDefineType = {
|
|
|
+ match: 1,
|
|
|
+ pos: 2,
|
|
|
+}
|
|
|
const aeUtils = {
|
|
|
toNumber: function (value) {
|
|
|
let num = _.toNumber(value);
|
|
@@ -17,10 +21,22 @@ const aeUtils = {
|
|
|
const colsDef = {};
|
|
|
for (const iCol in row) {
|
|
|
const text = row[iCol];
|
|
|
- for (const head in colHeaderMatch) {
|
|
|
- const match = colHeaderMatch[head];
|
|
|
- if (match.indexOf(text) >= 0) {
|
|
|
- colsDef[head] = iCol;
|
|
|
+ for (const header in colHeaderMatch) {
|
|
|
+ const match = colHeaderMatch[header];
|
|
|
+ switch (match.type) {
|
|
|
+ case colDefineType.match:
|
|
|
+ if (match.value.indexOf(text) >= 0) {
|
|
|
+ colsDef[header] = iCol;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case colDefineType.pos:
|
|
|
+ for (const v of match.value) {
|
|
|
+ if (text.indexOf(v) >= 0) {
|
|
|
+ colsDef[header] = iCol;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -283,17 +299,17 @@ class AnalysisExcelTree {
|
|
|
this.ctx = ctx;
|
|
|
this.colsDef = null;
|
|
|
this.colHeaderMatch = {
|
|
|
- code: ['项目节编号', '预算项目节'],
|
|
|
- b_code: ['清单子目号', '清单编号', '子目号'],
|
|
|
- pos: ['部位明细'],
|
|
|
- name: ['名称'],
|
|
|
- unit: ['单位'],
|
|
|
- quantity: ['清单数量'],
|
|
|
- dgn_qty1: ['设计数量1'],
|
|
|
- dgn_qty2: ['设计数量2'],
|
|
|
- unit_price: ['单价'],
|
|
|
- drawing_code: ['图号'],
|
|
|
- memo: ['备注'],
|
|
|
+ code: {value: ['项目节编号', '预算项目节'], type: colDefineType.match},
|
|
|
+ b_code: {value: ['清单子目号', '清单编号', '子目号'], type: colDefineType.match},
|
|
|
+ pos: {value: ['部位明细'], type: colDefineType.match},
|
|
|
+ name: {value: ['名称'], type: colDefineType.match},
|
|
|
+ unit: {value: ['单位'], type: colDefineType.match},
|
|
|
+ quantity: {value: ['清单数量'], type: colDefineType.match},
|
|
|
+ dgn_qty1: {value: ['设计数量1'], type: colDefineType.match},
|
|
|
+ dgn_qty2: {value: ['设计数量2'], type: colDefineType.match},
|
|
|
+ unit_price: {value: ['单价'], type: colDefineType.match},
|
|
|
+ drawing_code: {value: ['图号'], type: colDefineType.match},
|
|
|
+ memo: {value: ['备注'], type: colDefineType.match},
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -515,11 +531,11 @@ class AnalysisGclExcelTree {
|
|
|
this.ctx = ctx;
|
|
|
this.colsDef = null;
|
|
|
this.colHeaderMatch = {
|
|
|
- b_code: ['编号', '清单编号', '子目号', '子目编号', '清单号'],
|
|
|
- name: ['名称', '清单名称', '子目名称'],
|
|
|
- unit: ['单位'],
|
|
|
- quantity: ['清单数量'], // 施工图复核数量
|
|
|
- unit_price: ['单价'],
|
|
|
+ b_code: {value: ['编号', '清单编号', '子目号', '子目编号', '清单号'], type: colDefineType.match},
|
|
|
+ name: {value: ['名称', '清单名称', '子目名称'], type: colDefineType.match},
|
|
|
+ unit: {value: ['单位'], type: colDefineType.pos},
|
|
|
+ quantity: {value: ['数量'], type: colDefineType.pos}, // 施工图复核数量
|
|
|
+ unit_price: {value: ['单价'], type: colDefineType.pos},
|
|
|
};
|
|
|
}
|
|
|
|