|
@@ -28,6 +28,8 @@ const importXML = (() => {
|
|
//导入的文件类型,界面选的文件类型是生成项目的文件类型,这里的文件类型指的是,要导入文件的类型,
|
|
//导入的文件类型,界面选的文件类型是生成项目的文件类型,这里的文件类型指的是,要导入文件的类型,
|
|
//导入文件类型不同,导入数据不同
|
|
//导入文件类型不同,导入数据不同
|
|
let importFileKind = '';
|
|
let importFileKind = '';
|
|
|
|
+ // 投标文件和控制价文件是完全导入数据的
|
|
|
|
+ let isFullyImport = false;
|
|
// 文件类型
|
|
// 文件类型
|
|
const FileKind = {
|
|
const FileKind = {
|
|
'6': 1, // 投标
|
|
'6': 1, // 投标
|
|
@@ -97,6 +99,7 @@ const importXML = (() => {
|
|
const projectXMLObj = xmlObjMap['Project.xml'];
|
|
const projectXMLObj = xmlObjMap['Project.xml'];
|
|
const projectSrc = getValue(projectXMLObj, ['ConstructionProject']);
|
|
const projectSrc = getValue(projectXMLObj, ['ConstructionProject']);
|
|
importFileKind = FileKind[getValue(projectSrc, ['_FileKind'])]; // 标记当前导入的文件类型
|
|
importFileKind = FileKind[getValue(projectSrc, ['_FileKind'])]; // 标记当前导入的文件类型
|
|
|
|
+ isFullyImport = [FileKind.tender, FileKind.control].includes(importFileKind);
|
|
const rst = {
|
|
const rst = {
|
|
projType: projectType.Project,
|
|
projType: projectType.Project,
|
|
name: getValue(projectSrc, ['_Name']),
|
|
name: getValue(projectSrc, ['_Name']),
|
|
@@ -107,7 +110,7 @@ const importXML = (() => {
|
|
basicInformation: extractBasicInfo(projectSrc)
|
|
basicInformation: extractBasicInfo(projectSrc)
|
|
};
|
|
};
|
|
countData.unitPriceCount = countData.projectGLJCount;
|
|
countData.unitPriceCount = countData.projectGLJCount;
|
|
- if (importFileKind !== FileKind.tender) {
|
|
|
|
|
|
+ if (!isFullyImport) {
|
|
countData = {
|
|
countData = {
|
|
projectCount: countData.projectCount,
|
|
projectCount: countData.projectCount,
|
|
unitPriceFileCount: countData.unitPriceFileCount
|
|
unitPriceFileCount: countData.unitPriceFileCount
|
|
@@ -267,7 +270,7 @@ const importXML = (() => {
|
|
const feeRate = getValue(src, ['_Rate']);
|
|
const feeRate = getValue(src, ['_Rate']);
|
|
item.feeRate = +feeRate !== 100 && feeRate || undefined;
|
|
item.feeRate = +feeRate !== 100 && feeRate || undefined;
|
|
}
|
|
}
|
|
- if (importFileKind !== FileKind.tender) {
|
|
|
|
|
|
+ if (!isFullyImport) {
|
|
delete item.feeRate
|
|
delete item.feeRate
|
|
delete item.fees;
|
|
delete item.fees;
|
|
}
|
|
}
|
|
@@ -327,7 +330,7 @@ const importXML = (() => {
|
|
item.feeCode = FlagFeeCodeMap[fixedFlag.OTHER_MEASURE_FEE];
|
|
item.feeCode = FlagFeeCodeMap[fixedFlag.OTHER_MEASURE_FEE];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (importFileKind === FileKind.tender) {
|
|
|
|
|
|
+ if (isFullyImport) {
|
|
const summaryFees = getFeesFromBasicCost(divisionalSrc);
|
|
const summaryFees = getFeesFromBasicCost(divisionalSrc);
|
|
const fees = [{ fieldName: 'common', totalFee: getValue(divisionalSrc, ['_Total']), unitFee: getValue(divisionalSrc, ['_TechnicalAndEconomicIndex']) }];
|
|
const fees = [{ fieldName: 'common', totalFee: getValue(divisionalSrc, ['_Total']), unitFee: getValue(divisionalSrc, ['_TechnicalAndEconomicIndex']) }];
|
|
item.fees = mergeFees(fees, summaryFees);
|
|
item.fees = mergeFees(fees, summaryFees);
|
|
@@ -360,21 +363,19 @@ const importXML = (() => {
|
|
bills.feeRate = +feeRate !== 100 && feeRate || undefined;
|
|
bills.feeRate = +feeRate !== 100 && feeRate || undefined;
|
|
}
|
|
}
|
|
// 投标和控制价,需要导入最高限价
|
|
// 投标和控制价,需要导入最高限价
|
|
- if ([FileKind.tender, FileKind.control].includes(importFileKind)) {
|
|
|
|
|
|
+ if (isFullyImport) {
|
|
const maxPrice = getValue(workElementSrc, ['_PriceHigh']);
|
|
const maxPrice = getValue(workElementSrc, ['_PriceHigh']);
|
|
//不为0才输出
|
|
//不为0才输出
|
|
if (maxPrice && maxPrice !== '0') {
|
|
if (maxPrice && maxPrice !== '0') {
|
|
bills.outPutMaxPrice = true;
|
|
bills.outPutMaxPrice = true;
|
|
bills.maxPrice = maxPrice;
|
|
bills.maxPrice = maxPrice;
|
|
}
|
|
}
|
|
- if (importFileKind === FileKind.tender) {
|
|
|
|
- const summaryFees = getFeesFromBasicCost(workElementSrc);
|
|
|
|
- const fees = [
|
|
|
|
- { fieldName: 'common', unitFee: getValue(workElementSrc, ['_Price']), totalFee: getValue(workElementSrc, ['_Total']) },
|
|
|
|
- { fieldName: 'equipment', unitFee: getValue(workElementSrc, ['_EquipmentPrice']) },
|
|
|
|
- ];
|
|
|
|
- bills.fees = mergeFees(fees, summaryFees);
|
|
|
|
- }
|
|
|
|
|
|
+ const summaryFees = getFeesFromBasicCost(workElementSrc);
|
|
|
|
+ const fees = [
|
|
|
|
+ { fieldName: 'common', unitFee: getValue(workElementSrc, ['_Price']), totalFee: getValue(workElementSrc, ['_Total']) },
|
|
|
|
+ { fieldName: 'equipment', unitFee: getValue(workElementSrc, ['_EquipmentPrice']) },
|
|
|
|
+ ];
|
|
|
|
+ bills.fees = mergeFees(fees, summaryFees);
|
|
}
|
|
}
|
|
return bills;
|
|
return bills;
|
|
// 获取项目特征文本
|
|
// 获取项目特征文本
|
|
@@ -436,7 +437,7 @@ const importXML = (() => {
|
|
}
|
|
}
|
|
// 提取定额
|
|
// 提取定额
|
|
function extractRations(workElementSrc) {
|
|
function extractRations(workElementSrc) {
|
|
- if (importFileKind !== FileKind.tender) {
|
|
|
|
|
|
+ if (!isFullyImport) {
|
|
return [];
|
|
return [];
|
|
}
|
|
}
|
|
// 正常情况下定额肯定是在WorkContent内的,但是也做定额不在WorkContent内的处理(外层定额)
|
|
// 正常情况下定额肯定是在WorkContent内的,但是也做定额不在WorkContent内的处理(外层定额)
|
|
@@ -569,7 +570,7 @@ const importXML = (() => {
|
|
const sundryFees = [{ fieldName: 'common', totalFee: getValue(sundryCosts, ['_Total']) }];
|
|
const sundryFees = [{ fieldName: 'common', totalFee: getValue(sundryCosts, ['_Total']) }];
|
|
const provisionalMaterialEquipment = getValue(sundry, ['ProvisionalMaterialEquipment']);
|
|
const provisionalMaterialEquipment = getValue(sundry, ['ProvisionalMaterialEquipment']);
|
|
return {
|
|
return {
|
|
- fees: importFileKind === FileKind.tender ? sundryFees : [],
|
|
|
|
|
|
+ fees: isFullyImport ? sundryFees : [],
|
|
sundryCosts: extractData(sundry, 'SundryCosts', [['SundryCostsGroup'], ['SundryCostsItem']]),
|
|
sundryCosts: extractData(sundry, 'SundryCosts', [['SundryCostsGroup'], ['SundryCostsItem']]),
|
|
provisional: extractData(sundry, 'ProvisionalSums', [['ProvisionalSumsGroup'], ['ProvisionalSumsItem']]),
|
|
provisional: extractData(sundry, 'ProvisionalSums', [['ProvisionalSumsGroup'], ['ProvisionalSumsItem']]),
|
|
ProvisionalMaterialEquipment: {
|
|
ProvisionalMaterialEquipment: {
|
|
@@ -591,7 +592,7 @@ const importXML = (() => {
|
|
if (isGroup) {
|
|
if (isGroup) {
|
|
source = {
|
|
source = {
|
|
name: getValue(itemSrc, ['_Name']),
|
|
name: getValue(itemSrc, ['_Name']),
|
|
- fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', totalFee: getValue(itemSrc, ['_Total']) }] : [],
|
|
|
|
|
|
+ fees: isFullyImport ? [{ fieldName: 'common', totalFee: getValue(itemSrc, ['_Total']) }] : [],
|
|
feeCode: getValue(itemSrc, ['_Code']),
|
|
feeCode: getValue(itemSrc, ['_Code']),
|
|
remark: getValue(itemSrc, ['_Remark'])
|
|
remark: getValue(itemSrc, ['_Remark'])
|
|
};
|
|
};
|
|
@@ -602,7 +603,7 @@ const importXML = (() => {
|
|
unit: getValue(itemSrc, ['_Unit']),
|
|
unit: getValue(itemSrc, ['_Unit']),
|
|
calcBase: getValue(itemSrc, ['_QtyFormula']),
|
|
calcBase: getValue(itemSrc, ['_QtyFormula']),
|
|
feeRate: +feeRate !== 100 && feeRate || undefined,
|
|
feeRate: +feeRate !== 100 && feeRate || undefined,
|
|
- fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', unitFee: getValue(itemSrc, ['_Price']), totalFee: getValue(itemSrc, ['_Total']) }] : [],
|
|
|
|
|
|
+ fees: isFullyImport ? [{ fieldName: 'common', unitFee: getValue(itemSrc, ['_Price']), totalFee: getValue(itemSrc, ['_Total']) }] : [],
|
|
feeCode: getValue(itemSrc, ['_Code']),
|
|
feeCode: getValue(itemSrc, ['_Code']),
|
|
remark: getValue(itemSrc, ['_Remark'])
|
|
remark: getValue(itemSrc, ['_Remark'])
|
|
};
|
|
};
|
|
@@ -616,7 +617,7 @@ const importXML = (() => {
|
|
function extractData(sundry, srcName, fields, groupExtendMap, itemExtendMap) {
|
|
function extractData(sundry, srcName, fields, groupExtendMap, itemExtendMap) {
|
|
const src = getValue(sundry, [srcName]);
|
|
const src = getValue(sundry, [srcName]);
|
|
return {
|
|
return {
|
|
- fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
|
|
|
|
|
|
+ fees: isFullyImport ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
|
|
feeCode: getValue(src, ['_Code']),
|
|
feeCode: getValue(src, ['_Code']),
|
|
items: extractItemsRecur(src, fields, (itemSrc, curField) => {
|
|
items: extractItemsRecur(src, fields, (itemSrc, curField) => {
|
|
const groupExtend = groupExtendMap
|
|
const groupExtend = groupExtendMap
|
|
@@ -652,7 +653,7 @@ const importXML = (() => {
|
|
name: getValue(src, ['_Name']),
|
|
name: getValue(src, ['_Name']),
|
|
calcBase: getValue(src, ['_QtyFormula']),
|
|
calcBase: getValue(src, ['_QtyFormula']),
|
|
feeRate: +feeRate !== 100 && feeRate || undefined,
|
|
feeRate: +feeRate !== 100 && feeRate || undefined,
|
|
- fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
|
|
|
|
|
|
+ fees: isFullyImport ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
|
|
feeCode: getValue(src, ['_Code']),
|
|
feeCode: getValue(src, ['_Code']),
|
|
remark: getValue(src, ['_Remark'])
|
|
remark: getValue(src, ['_Remark'])
|
|
};
|
|
};
|
|
@@ -669,7 +670,7 @@ const importXML = (() => {
|
|
// 提取人材机汇总相关(人材机汇总表、承包材料表)
|
|
// 提取人材机汇总相关(人材机汇总表、承包材料表)
|
|
function extractGLJSummary(tenderSrc) {
|
|
function extractGLJSummary(tenderSrc) {
|
|
const initData = { gljSummary: [], differentiaSummary: [], exponentialSummary: [] };
|
|
const initData = { gljSummary: [], differentiaSummary: [], exponentialSummary: [] };
|
|
- if (importFileKind !== FileKind.tender) {
|
|
|
|
|
|
+ if (!isFullyImport) {
|
|
return initData;
|
|
return initData;
|
|
}
|
|
}
|
|
const taxType = getValue(tenderSrc, ['_TaxModel']); // 计税方式
|
|
const taxType = getValue(tenderSrc, ['_TaxModel']); // 计税方式
|
|
@@ -805,7 +806,7 @@ const importXML = (() => {
|
|
}
|
|
}
|
|
// 提取评标材料
|
|
// 提取评标材料
|
|
function extractBidEvaluationSummary(tenderSrc) {
|
|
function extractBidEvaluationSummary(tenderSrc) {
|
|
- if (importFileKind !== FileKind.tender) {
|
|
|
|
|
|
+ if (!isFullyImport) {
|
|
return [];
|
|
return [];
|
|
}
|
|
}
|
|
const srcList = arrayValue(tenderSrc, ['BidEvaluationMainMaterial']);
|
|
const srcList = arrayValue(tenderSrc, ['BidEvaluationMainMaterial']);
|
|
@@ -1611,7 +1612,6 @@ const importXML = (() => {
|
|
fileMap[fileName] = fileMap[fileName].replace(reg, '<?xml version="1.0" encoding="utf-8"?>');
|
|
fileMap[fileName] = fileMap[fileName].replace(reg, '<?xml version="1.0" encoding="utf-8"?>');
|
|
// x2js转换xml使用了DomParser接口,会将一些字符实体进行转义。若不想被自动转义,则需要调用escapeXMLEntity
|
|
// x2js转换xml使用了DomParser接口,会将一些字符实体进行转义。若不想被自动转义,则需要调用escapeXMLEntity
|
|
const xmlStr = escape ? util.escapeXMLEntity(fileMap[fileName]) : fileMap[fileName];
|
|
const xmlStr = escape ? util.escapeXMLEntity(fileMap[fileName]) : fileMap[fileName];
|
|
- console.log(xmlStr);
|
|
|
|
//将xml格式良好的字符串转换成对象
|
|
//将xml格式良好的字符串转换成对象
|
|
const x2js = new X2JS();
|
|
const x2js = new X2JS();
|
|
let xmlObj = x2js.xml_str2json(xmlStr);
|
|
let xmlObj = x2js.xml_str2json(xmlStr);
|