|
|
@@ -379,9 +379,10 @@ const ImportXML = (() => {
|
|
|
let obj = {
|
|
|
rowCode: getValue(itemSrc, ['_行代号']),
|
|
|
name: getValue(itemSrc, ['_项目名称']),
|
|
|
+ calcBase: getValue(itemSrc, ['_计算基础表达式'])
|
|
|
};
|
|
|
if (importFileKind === FileKind.tender) {
|
|
|
- obj.calcBase = getValue(itemSrc, ['_计算基础表达式']);
|
|
|
+ // obj.calcBase = getValue(itemSrc, ['_计算基础表达式']);
|
|
|
obj.feeRate = getValue(itemSrc, ['_费率']);
|
|
|
obj.fees = [{fieldName: 'common', totalFee: getValue(itemSrc, ['_金额']) || '0'}];
|
|
|
}
|
|
|
@@ -495,8 +496,8 @@ const ImportXML = (() => {
|
|
|
function featureAndContentText(features, contents) {
|
|
|
let textArr = [];
|
|
|
// 项目特征
|
|
|
+ textArr.push('[项目特征]');
|
|
|
if (features.length) {
|
|
|
- textArr.push('[项目特征]');
|
|
|
textArr.push(...features.map(feature => {
|
|
|
//若不存在特征描述,同时特征名称中含有“:”,则直接返回特征名称 (广联达招标文件中,特征名称包含了特征名:值)
|
|
|
if (!feature.eigenvalue && /[\:,:]/.test(feature.name)) {
|
|
|
@@ -507,10 +508,10 @@ const ImportXML = (() => {
|
|
|
}));
|
|
|
}
|
|
|
// 工作内容
|
|
|
+ textArr.push('[工作内容]');
|
|
|
if (textArr.length) {
|
|
|
- textArr.push('[工作内容]');
|
|
|
+ textArr.push(...contents.map(content => content.name));
|
|
|
}
|
|
|
- textArr.push(...contents.map(content => content.name));
|
|
|
return textArr.join('\n');
|
|
|
}
|
|
|
}
|
|
|
@@ -812,13 +813,13 @@ const ImportXML = (() => {
|
|
|
}
|
|
|
return obj;
|
|
|
})};
|
|
|
+ provisional.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['暂列金额', '_金额']) || '0'}];
|
|
|
+ engineeringPro.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['专业工程暂估价', '_金额']) || '0'}];
|
|
|
+ claim.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['索赔计价汇总', '_金额']) || '0'}];
|
|
|
+ visa.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['现场签证计价汇总', '_金额']) || '0'}];
|
|
|
if (importFileKind === FileKind.tender) {
|
|
|
- provisional.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['暂列金额', '_金额']) || '0'}];
|
|
|
- engineeringPro.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['专业工程暂估价', '_金额']) || '0'}];
|
|
|
dayWork.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['计日工', '_金额']) || '0'}];
|
|
|
service.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['总承包服务费', '_金额']) || '0'}];
|
|
|
- claim.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['索赔计价汇总', '_金额']) || '0'}];
|
|
|
- visa.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['现场签证计价汇总', '_金额']) || '0'}];
|
|
|
others.fees = [{fieldName: 'common', totalFee: getValue(otherSrc, ['其他', '_金额']) || '0'}];
|
|
|
}
|
|
|
return {provisional, engineeringPro, dayWork, service, claim, visa, others};
|
|
|
@@ -1023,6 +1024,7 @@ const ImportXML = (() => {
|
|
|
name: feeBills.name,
|
|
|
rowCode: feeBills.rowCode,
|
|
|
feeRate: feeBills.feeRate,
|
|
|
+ calcBase: feeBills.calcBase,
|
|
|
};
|
|
|
if (importFileKind === FileKind.tender) {
|
|
|
//subTaxData.rowCode = feeBills.rowCode;
|
|
|
@@ -1033,7 +1035,7 @@ const ImportXML = (() => {
|
|
|
}
|
|
|
needfulTemplate.push(subTaxData);
|
|
|
preSubTax = subTaxData;
|
|
|
- } else { //匹配固定项
|
|
|
+ } else {
|
|
|
let isMatched = false;
|
|
|
//匹配固定项
|
|
|
for (let match of toMatches) {
|
|
|
@@ -1061,7 +1063,13 @@ const ImportXML = (() => {
|
|
|
continue;
|
|
|
}
|
|
|
isMatched = true;
|
|
|
- findBills.calcBase = feeBills.calcBase;
|
|
|
+ // 文件有基数则导入基数,没有则用模板的基数
|
|
|
+ if (feeBills.calcBase) {
|
|
|
+ findBills.calcBase = feeBills.calcBase;
|
|
|
+ } else {
|
|
|
+ // 用了模板的基数,基数无视基数验证
|
|
|
+ findBills.ignoreValidator = true;
|
|
|
+ }
|
|
|
findBills.feeRate = feeBills.feeRate;
|
|
|
findBills.rowCode = feeBills.rowCode;
|
|
|
//后台配置的feeRateID优先级比feeRate高,导入数据有费率值时,需要清空这个配置
|
|
|
@@ -1161,7 +1169,9 @@ const ImportXML = (() => {
|
|
|
function updateZZCSItem(org, tar) {
|
|
|
for(let [k, v] of Object.entries(tar)) {
|
|
|
// 如果匹配到的清单自身已有固定ID,不更新固定ID
|
|
|
- if (k === 'flags' && Array.isArray(tar.flags) && tar.flags.length) {
|
|
|
+ // 如果目标清单没有基数,模板清单基数不更新
|
|
|
+ if ((k === 'flags' && Array.isArray(tar.flags) && tar.flags.length) ||
|
|
|
+ (k === 'calcBase' && !tar.calcBase)) {
|
|
|
continue;
|
|
|
}
|
|
|
org[k] = v;
|
|
|
@@ -1291,7 +1301,7 @@ const ImportXML = (() => {
|
|
|
JSCS_JXF: '{技术措施项目定额施工机具使用费}',
|
|
|
JSCS_ZCF: '{技术措施项目主材费}',
|
|
|
JSCS_GR: '{技术措施项目人工工日}',
|
|
|
- JZMZ: '{建筑面积}',
|
|
|
+ JZMJ: '{建筑面积}',
|
|
|
RCJJC: '{人材机价差}',
|
|
|
RGJC: '{人工价差}',
|
|
|
CLJC: '{材料价差}',
|
|
|
@@ -1325,7 +1335,7 @@ const ImportXML = (() => {
|
|
|
}
|
|
|
});
|
|
|
for (let bills of billsData) {
|
|
|
- if (!bills.calcBase) {
|
|
|
+ if (!bills.calcBase || bills.ignoreValidator) {
|
|
|
continue;
|
|
|
}
|
|
|
let sub = billsData.find(data => data.ParentID === bills.ID);
|
|
|
@@ -1335,6 +1345,9 @@ const ImportXML = (() => {
|
|
|
bills.feeRate = '';
|
|
|
continue;
|
|
|
}
|
|
|
+ if (typeof bills.calcBase !== 'string') {
|
|
|
+ bills.calcBase = String(bills.calcBase);
|
|
|
+ }
|
|
|
//提取基数
|
|
|
bills.calcBase = bills.calcBase.replace(/\s/g, '');
|
|
|
let bases = bills.calcBase.split(/[\+\-\*\/]/g);
|
|
|
@@ -1417,6 +1430,18 @@ const ImportXML = (() => {
|
|
|
shareInfo: [],
|
|
|
engs: []
|
|
|
};
|
|
|
+ // 所有的清单模板库ID
|
|
|
+ let allTemplateLibIDs = [];
|
|
|
+ xmlObj.engs.forEach(eng => {
|
|
|
+ eng.tenders.forEach(tender => {
|
|
|
+ let templateLibID = tender.property.templateLibID;
|
|
|
+ if (!allTemplateLibIDs.includes(templateLibID)) {
|
|
|
+ allTemplateLibIDs.push(templateLibID);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 模板映射:{[templateLibID]: data}
|
|
|
+ let templateMapping = await ajaxPost('/template/bills/api/getNeedfulTemplate', {allTemplateLibIDs});
|
|
|
for (let i = 0; i < xmlObj.engs.length; i++) {
|
|
|
let curEng = xmlObj.engs[i],
|
|
|
preEng = postConstructData.engs[i - 1];
|
|
|
@@ -1448,7 +1473,8 @@ const ImportXML = (() => {
|
|
|
preTender.tender.NextSiblingID = curTender.ID;
|
|
|
}
|
|
|
//提取详细数据
|
|
|
- let postTenderData = await transformTender(curTender, IDPlaceholder);
|
|
|
+ let needfulTemplate = _.cloneDeep(templateMapping[curTender.property.templateLibID]);
|
|
|
+ let postTenderData = await transformTender(curTender, IDPlaceholder, needfulTemplate);
|
|
|
postTenderData.tender.property.rootProjectID = postConstructData.ID;
|
|
|
postEngData.tenders.push(postTenderData);
|
|
|
}
|
|
|
@@ -1458,8 +1484,8 @@ const ImportXML = (() => {
|
|
|
};
|
|
|
|
|
|
//转换单位工程的数据(直接可插入数据库的数据),返回{tender: {}, bills: [], ration: [], rationGLJ: [], projectGLJ: [], unitPrice: [], mixRatio: []}
|
|
|
- async function transformTender(tenderData, IDPlaceholder) {
|
|
|
- let detailData = await transformBills(tenderData, IDPlaceholder);
|
|
|
+ async function transformTender(tenderData, IDPlaceholder, needfulTemplate) {
|
|
|
+ let detailData = await transformBills(tenderData, IDPlaceholder, needfulTemplate);
|
|
|
//提取需要插入的单位工程数据
|
|
|
let tender = {
|
|
|
ID: tenderData.ID,
|
|
|
@@ -1481,10 +1507,7 @@ const ImportXML = (() => {
|
|
|
return detailData;
|
|
|
}
|
|
|
//转换清单数据
|
|
|
- async function transformBills(tenderData, IDPlaceholder) {
|
|
|
- //获取清单模板数据
|
|
|
- let needfulTemplate = await ajaxPost('/template/bills/api/getNeedfulTemplate',
|
|
|
- {templateLibID: tenderData.property.templateLibID});
|
|
|
+ async function transformBills(tenderData, IDPlaceholder, needfulTemplate) {
|
|
|
//处理单位工程费用汇总的清单,这一部分没有靠谱的规则,特殊处理。
|
|
|
setupFeeSummary(tenderData.feeSummary, needfulTemplate);
|
|
|
//处理添加清单数据
|
|
|
@@ -1516,6 +1539,9 @@ const ImportXML = (() => {
|
|
|
tenderData.gljSummary.forEach(pGLJ => {
|
|
|
pGLJ.project_id = tenderData.ID;
|
|
|
pGLJ.id = IDPlaceholder.projectGLJ++;
|
|
|
+ // 如果人材机数据的类型为空,默认设置成201先,具体需要后台匹配
|
|
|
+ pGLJ.type = pGLJ.type || 201;
|
|
|
+ pGLJ.shortName = pGLJ.shortName || '材';
|
|
|
//gljCodeMap[pGLJ.code] = pGLJ;
|
|
|
projectGLJMap[pGLJ.customCode] = pGLJ;
|
|
|
projectGLJMap[pGLJ.original_code] = pGLJ;
|