|
|
@@ -47,23 +47,27 @@ const importBills = (function () {
|
|
|
return { code: 0, name: 1, unit: 2, quantity: 3 };
|
|
|
}
|
|
|
}
|
|
|
- function isGCLHead(dataRow) {
|
|
|
- let cell = dataRow[0];
|
|
|
- return cell && cell.value === '工程量清单';
|
|
|
+ function isGCLHead(dataRow, nextDataRow) {
|
|
|
+ const cell = dataRow[0];
|
|
|
+ const nextCell = nextDataRow && nextDataRow[0];
|
|
|
+ return cell && cell.value === '工程量清单' && (!nextCell || !/建设项目名称/.test(nextCell.value)); // 兼容招清单01-1表
|
|
|
}
|
|
|
- function isGCLExtendHead(dataRow) {
|
|
|
- let cell = dataRow[0];
|
|
|
- return cell && cell.value === '工程量清单预算表';
|
|
|
+ function isGCLExtendHead(dataRow, nextDataRow) {
|
|
|
+ const cell = dataRow[0];
|
|
|
+ const nextCell = nextDataRow && nextDataRow[0];
|
|
|
+ if ((cell && cell.value === '工程量清单预算表') || (nextCell && /建设项目名称/.test(nextCell.value))) { // 兼容招清单01-1表
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
//分析文件,1、工程量清单 2、清单示例表
|
|
|
function getFileType(sheetData) {
|
|
|
let dataTable = sheetData.data.dataTable,
|
|
|
rowCount = sheetData.rowCount;
|
|
|
for (let row = 0; row < rowCount; row++) {
|
|
|
- if (isGCLHead(dataTable[row])) {
|
|
|
+ if (isGCLHead(dataTable[row], dataTable[row + 1])) {
|
|
|
return fileType.gcl;
|
|
|
}
|
|
|
- if (isGCLExtendHead(dataTable[row])) {
|
|
|
+ if (isGCLExtendHead(dataTable[row], dataTable[row + 1])) {
|
|
|
return fileType.gclex;
|
|
|
}
|
|
|
}
|
|
|
@@ -78,7 +82,7 @@ const importBills = (function () {
|
|
|
let rst = [];
|
|
|
for (let row = 0; row < rowCount; row++) {
|
|
|
//表格中顶层节点
|
|
|
- if (isGCLHead(dataTable[row])) {
|
|
|
+ if (isGCLHead(dataTable[row], dataTable[row + 1])) {
|
|
|
let rootRow = dataTable[row + 2];
|
|
|
let name = rootRow[0].value ? _deNR(rootRow[0].value) : '';
|
|
|
let existsRoot = findLast(rst, x => x.name === name && x.depth === 0);
|
|
|
@@ -205,7 +209,7 @@ const importBills = (function () {
|
|
|
let preRootName;
|
|
|
for (let row = 0; row < rowCount; row++) {
|
|
|
const rowData = dataTable[row];
|
|
|
- if (isGCLExtendHead(rowData)) {
|
|
|
+ if (isGCLExtendHead(rowData, dataTable[row + 1])) {
|
|
|
const rootRowdata = dataTable[row + 3];
|
|
|
const name = rootRowdata[0].value;
|
|
|
if (name) {
|