|  | @@ -28,6 +28,8 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |      //导入的文件类型,界面选的文件类型是生成项目的文件类型,这里的文件类型指的是,要导入文件的类型,
 | 
	
		
			
				|  |  |      //导入文件类型不同,导入数据不同
 | 
	
		
			
				|  |  |      let importFileKind = '';
 | 
	
		
			
				|  |  | +    // 投标文件和控制价文件是完全导入数据的
 | 
	
		
			
				|  |  | +    let isFullyImport = false;
 | 
	
		
			
				|  |  |      // 文件类型
 | 
	
		
			
				|  |  |      const FileKind = {
 | 
	
		
			
				|  |  |          '6': 1, // 投标
 | 
	
	
		
			
				|  | @@ -97,6 +99,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |          const projectXMLObj = xmlObjMap['Project.xml'];
 | 
	
		
			
				|  |  |          const projectSrc = getValue(projectXMLObj, ['ConstructionProject']);
 | 
	
		
			
				|  |  |          importFileKind = FileKind[getValue(projectSrc, ['_FileKind'])]; // 标记当前导入的文件类型
 | 
	
		
			
				|  |  | +        isFullyImport = [FileKind.tender, FileKind.control].includes(importFileKind);
 | 
	
		
			
				|  |  |          const rst = {
 | 
	
		
			
				|  |  |              projType: projectType.Project,
 | 
	
		
			
				|  |  |              name: getValue(projectSrc, ['_Name']),
 | 
	
	
		
			
				|  | @@ -107,7 +110,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |              basicInformation: extractBasicInfo(projectSrc)
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          countData.unitPriceCount = countData.projectGLJCount;
 | 
	
		
			
				|  |  | -        if (importFileKind !== FileKind.tender) {
 | 
	
		
			
				|  |  | +        if (!isFullyImport) {
 | 
	
		
			
				|  |  |              countData = {
 | 
	
		
			
				|  |  |                  projectCount: countData.projectCount,
 | 
	
		
			
				|  |  |                  unitPriceFileCount: countData.unitPriceFileCount
 | 
	
	
		
			
				|  | @@ -267,7 +270,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |                  const feeRate = getValue(src, ['_Rate']);
 | 
	
		
			
				|  |  |                  item.feeRate = +feeRate !== 100 && feeRate || undefined;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if (importFileKind !== FileKind.tender) {
 | 
	
		
			
				|  |  | +            if (!isFullyImport) {
 | 
	
		
			
				|  |  |                  delete item.feeRate
 | 
	
		
			
				|  |  |                  delete item.fees;
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -327,7 +330,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |                  item.feeCode = FlagFeeCodeMap[fixedFlag.OTHER_MEASURE_FEE];
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (importFileKind === FileKind.tender) {
 | 
	
		
			
				|  |  | +        if (isFullyImport) {
 | 
	
		
			
				|  |  |              const summaryFees = getFeesFromBasicCost(divisionalSrc);
 | 
	
		
			
				|  |  |              const fees = [{ fieldName: 'common', totalFee: getValue(divisionalSrc, ['_Total']), unitFee: getValue(divisionalSrc, ['_TechnicalAndEconomicIndex']) }];
 | 
	
		
			
				|  |  |              item.fees = mergeFees(fees, summaryFees);
 | 
	
	
		
			
				|  | @@ -360,21 +363,19 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |              bills.feeRate = +feeRate !== 100 && feeRate || undefined;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 投标和控制价,需要导入最高限价
 | 
	
		
			
				|  |  | -        if ([FileKind.tender, FileKind.control].includes(importFileKind)) {
 | 
	
		
			
				|  |  | +        if (isFullyImport) {
 | 
	
		
			
				|  |  |              const maxPrice = getValue(workElementSrc, ['_PriceHigh']);
 | 
	
		
			
				|  |  |              //不为0才输出
 | 
	
		
			
				|  |  |              if (maxPrice && maxPrice !== '0') {
 | 
	
		
			
				|  |  |                  bills.outPutMaxPrice = true;
 | 
	
		
			
				|  |  |                  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;
 | 
	
		
			
				|  |  |          // 获取项目特征文本
 | 
	
	
		
			
				|  | @@ -436,7 +437,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      // 提取定额
 | 
	
		
			
				|  |  |      function extractRations(workElementSrc) {
 | 
	
		
			
				|  |  | -        if (importFileKind !== FileKind.tender) {
 | 
	
		
			
				|  |  | +        if (!isFullyImport) {
 | 
	
		
			
				|  |  |              return [];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 正常情况下定额肯定是在WorkContent内的,但是也做定额不在WorkContent内的处理(外层定额)
 | 
	
	
		
			
				|  | @@ -569,7 +570,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |          const sundryFees = [{ fieldName: 'common', totalFee: getValue(sundryCosts, ['_Total']) }];
 | 
	
		
			
				|  |  |          const provisionalMaterialEquipment = getValue(sundry, ['ProvisionalMaterialEquipment']);
 | 
	
		
			
				|  |  |          return {
 | 
	
		
			
				|  |  | -            fees: importFileKind === FileKind.tender ? sundryFees : [],
 | 
	
		
			
				|  |  | +            fees: isFullyImport ? sundryFees : [],
 | 
	
		
			
				|  |  |              sundryCosts: extractData(sundry, 'SundryCosts', [['SundryCostsGroup'], ['SundryCostsItem']]),
 | 
	
		
			
				|  |  |              provisional: extractData(sundry, 'ProvisionalSums', [['ProvisionalSumsGroup'], ['ProvisionalSumsItem']]),
 | 
	
		
			
				|  |  |              ProvisionalMaterialEquipment: {
 | 
	
	
		
			
				|  | @@ -591,7 +592,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |              if (isGroup) {
 | 
	
		
			
				|  |  |                  source = {
 | 
	
		
			
				|  |  |                      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']),
 | 
	
		
			
				|  |  |                      remark: getValue(itemSrc, ['_Remark'])
 | 
	
		
			
				|  |  |                  };
 | 
	
	
		
			
				|  | @@ -602,7 +603,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |                      unit: getValue(itemSrc, ['_Unit']),
 | 
	
		
			
				|  |  |                      calcBase: getValue(itemSrc, ['_QtyFormula']),
 | 
	
		
			
				|  |  |                      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']),
 | 
	
		
			
				|  |  |                      remark: getValue(itemSrc, ['_Remark'])
 | 
	
		
			
				|  |  |                  };
 | 
	
	
		
			
				|  | @@ -616,7 +617,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |          function extractData(sundry, srcName, fields, groupExtendMap, itemExtendMap) {
 | 
	
		
			
				|  |  |              const src = getValue(sundry, [srcName]);
 | 
	
		
			
				|  |  |              return {
 | 
	
		
			
				|  |  | -                fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
 | 
	
		
			
				|  |  | +                fees: isFullyImport ? [{ fieldName: 'common', totalFee: getValue(src, ['_Total']) }] : [],
 | 
	
		
			
				|  |  |                  feeCode: getValue(src, ['_Code']),
 | 
	
		
			
				|  |  |                  items: extractItemsRecur(src, fields, (itemSrc, curField) => {
 | 
	
		
			
				|  |  |                      const groupExtend = groupExtendMap
 | 
	
	
		
			
				|  | @@ -652,7 +653,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |                  name: getValue(src, ['_Name']),
 | 
	
		
			
				|  |  |                  calcBase: getValue(src, ['_QtyFormula']),
 | 
	
		
			
				|  |  |                  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']),
 | 
	
		
			
				|  |  |                  remark: getValue(src, ['_Remark'])
 | 
	
		
			
				|  |  |              };
 | 
	
	
		
			
				|  | @@ -669,7 +670,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |      // 提取人材机汇总相关(人材机汇总表、承包材料表)
 | 
	
		
			
				|  |  |      function extractGLJSummary(tenderSrc) {
 | 
	
		
			
				|  |  |          const initData = { gljSummary: [], differentiaSummary: [], exponentialSummary: [] };
 | 
	
		
			
				|  |  | -        if (importFileKind !== FileKind.tender) {
 | 
	
		
			
				|  |  | +        if (!isFullyImport) {
 | 
	
		
			
				|  |  |              return initData;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          const taxType = getValue(tenderSrc, ['_TaxModel']); // 计税方式
 | 
	
	
		
			
				|  | @@ -805,7 +806,7 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      // 提取评标材料
 | 
	
		
			
				|  |  |      function extractBidEvaluationSummary(tenderSrc) {
 | 
	
		
			
				|  |  | -        if (importFileKind !== FileKind.tender) {
 | 
	
		
			
				|  |  | +        if (!isFullyImport) {
 | 
	
		
			
				|  |  |              return [];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          const srcList = arrayValue(tenderSrc, ['BidEvaluationMainMaterial']);
 | 
	
	
		
			
				|  | @@ -1122,7 +1123,8 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      // 检查清单是否引用了自身,比如广联达导出文件中 材料保管费基数为CLBGF
 | 
	
		
			
				|  |  |      function isCalcBaseCycle(bills) {
 | 
	
		
			
				|  |  | -        return bills.calcBase.match(new RegExp(`\\b${bills.feeCode}\\b`)); // \b: 匹配前一个字符和后一个字符不全为\w的位置
 | 
	
		
			
				|  |  | +        const matched = bills.calcBase.match(new RegExp(`\\b${bills.feeCode}\\b`)); // \b: 匹配前一个字符和后一个字符不全为\w的位置
 | 
	
		
			
				|  |  | +        return !!(matched && matched[0]);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      // 转换计算基数
 | 
	
		
			
				|  |  |      // 1.有子项数据,则清空基数
 | 
	
	
		
			
				|  | @@ -1604,7 +1606,10 @@ const importXML = (() => {
 | 
	
		
			
				|  |  |              throw '无有效数据';
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          const xmlObjMap = {};
 | 
	
		
			
				|  |  | +        // 导入易达的文件,经过unzipFile的decodeFileName,xml文件头部变成了<?xml version="1.0" encoding="utf-8"?>,需要将前面的乱码去除,否则DOMParser转换后是null
 | 
	
		
			
				|  |  | +        const reg = /.*<\?xml version="1.0" encoding="utf-8"\?>/i;
 | 
	
		
			
				|  |  |          for (const fileName in fileMap) {
 | 
	
		
			
				|  |  | +            fileMap[fileName] = fileMap[fileName].replace(reg, '<?xml version="1.0" encoding="utf-8"?>');
 | 
	
		
			
				|  |  |              // x2js转换xml使用了DomParser接口,会将一些字符实体进行转义。若不想被自动转义,则需要调用escapeXMLEntity
 | 
	
		
			
				|  |  |              const xmlStr = escape ? util.escapeXMLEntity(fileMap[fileName]) : fileMap[fileName];
 | 
	
		
			
				|  |  |              //将xml格式良好的字符串转换成对象
 |