Pārlūkot izejas kodu

1.导入重庆接口文件,单位工程是仿古建筑工程,导入的借用的定额AB0013,其取费专业应是“公共建筑工程”,不应是“仿古建筑工程”。
2.导出接口时,不点击“自检”,应不自检,允许导出
3.导入接口后,单位工程均应自动锁定清单。
4.导入的接口文件,有的单位工程索赔和现场签证的顺序变了。
5.导入接口文件,评标材料打勾列应根据文件写对应值。

zhongzewei 6 gadi atpakaļ
vecāks
revīzija
ac42717a34

+ 1 - 1
modules/pm/facade/pm_facade.js

@@ -1331,7 +1331,7 @@ async function importProject(importObj, userID, compilationID) {
             await installationFacade.copyInstallationFeeFromLib(data.ID, data.property.engineering_id);
         }
         //锁定清单
-        data.property.lockBills = false;
+        data.property.lockBills = true;
         //工料机单价调整系数
         data.property.tenderSetting = tenderSetting;
         //工程特征相关更新

+ 4 - 1
modules/templates/models/bills_template.js

@@ -114,6 +114,9 @@ function setSeqByNext(billsData) {
         while (last && target.length !== datas.length) {
             target.push(last);
             last = datas.find(data => data.NextSiblingID == last.ID);
+            if (!last) {
+                break;
+            }
         }
         //链断了即清单模板数据的树结构有问题,这里做下兼容:
         // 1.数据没问题,返回排序过后的同层数据数组    2.数据有问题,返回不排序的同层数组
@@ -131,7 +134,7 @@ function sortSeqToNextSibling(needfulData) {
         sameDepthDatas[data.ParentID].push(data);
     }
     for (let sameDepth of Object.values(sameDepthDatas)) {
-        sameDepth.sort((a, b) => a.seq - a.seq);
+        sameDepth.sort((a, b) => a.seq - b.seq);
         for (let i = 0; i < sameDepth.length; i++) {
             let cur = sameDepth[i],
                 next = sameDepth[i + 1];

+ 105 - 106
web/building_saas/main/js/models/exportStandardInterface.js

@@ -12,7 +12,6 @@
 * 数据标准接口
 * 导出符合标准接口要求的xml
 * */
-
 const XMLStandard = (function () {
     //费用类别:固定行ID对应
     const FEE_TYPE = {
@@ -137,8 +136,11 @@ const XMLStandard = (function () {
         'FBGR': '分包人工工日',
     };
     // 通用设置和工具
-    let _config = XML_EXPORT_BASE.CONFIG,
-        _util = XML_EXPORT_BASE.UTIL;
+    let _base = XML_EXPORT_BASE,
+        _config = _base.CONFIG,
+        _util = _base.UTIL,
+        _cache = _base.CACHE,
+        _failList = _cache.getItem('failList');
     return function (userID, granularity, exportKind) {
         //默认导出建设项目
         if (!granularity || ![1, 2, 3].includes(granularity)) {
@@ -150,10 +152,6 @@ const XMLStandard = (function () {
         }
         this.originalDatas = []; //转换后的数据(xml化前的数据结构)
 
-        // 造成导出失败
-        let failList = [];
-        this.failList = failList;
-
         //建设项目定义
         //source:来源数据
         function Project(source) {
@@ -172,7 +170,7 @@ const XMLStandard = (function () {
                 engCode: [],    //单项工程编号
                 tenderCode: [], //单位工程编号
             };
-            XML_EXPORT_BASE.Element.call(this, '标段', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '标段', attrs);
         }
         //项目信息定义
         function ProjectInfo(source) {
@@ -193,7 +191,7 @@ const XMLStandard = (function () {
                 {name: '合同价类型', value: _util.getValueByKey(source.basicInformation, 'contractPriceType')},
 
             ];
-            XML_EXPORT_BASE.Element.call(this, '项目信息', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '项目信息', attrs);
         }
         //招标信息定义
         function BiddingInfo(source) {
@@ -206,7 +204,7 @@ const XMLStandard = (function () {
                 {name: '控制总价', value: exportKind === _config.EXPORT_KIND.Control ? source.summaryInfo.engineeringCost : '0',
                     required: true, type: _config.TYPE.NUM2},
             ];
-            XML_EXPORT_BASE.Element.call(this, '招标信息', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '招标信息', attrs);
         }
         //投标信息定义
         function BidInfo(source) {
@@ -221,14 +219,14 @@ const XMLStandard = (function () {
                 {name: '担保类型', value: _util.getValueByKey(source.basicInformation, 'guaranteeType'), enumeration: ['支票', '现金', '电汇', '汇票']},
                 {name: '投标总价', value: source.summaryInfo.engineeringCost, required: true, type: _config.TYPE.NUM2},
             ];
-            XML_EXPORT_BASE.Element.call(this, '投标信息', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '投标信息', attrs);
         }
         //编制说明定义
         function CompilationIllustration(source) {
             let attrs = [
                 {name: '内容', value: source.compilationIllustration, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '编制说明', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '编制说明', attrs);
         }
         //系统信息定义
         function SystemInfo(source) {
@@ -237,7 +235,7 @@ const XMLStandard = (function () {
                 {name: 'ID2', value: '', required: true},
                 {name: '生成时间', value: source.generatedTime, type: _config.TYPE.DATE_TIME, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '系统信息', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '系统信息', attrs);
         }
         //费用构成定义
         function FeeFrom(summaryInfo) {
@@ -256,7 +254,7 @@ const XMLStandard = (function () {
                 {name: '规费', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.charge : '0', required: true, type: _config.TYPE.NUM2},
                 {name: '税金', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.tax : '0', required: true, type: _config.TYPE.NUM2},
             ];
-            XML_EXPORT_BASE.Element.call(this, '费用构成', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '费用构成', attrs);
         }
         //单项工程定义
         function Engineering(source) {
@@ -265,7 +263,7 @@ const XMLStandard = (function () {
                 {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? source.summaryInfo.engineeringCost : '0', type: _config.TYPE.NUM2},
             ];
-            XML_EXPORT_BASE.Element.call(this, '单项工程', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '单项工程', attrs);
         }
         //单位工程定义
         function Tender(source) {
@@ -306,7 +304,7 @@ const XMLStandard = (function () {
                 mainBillsCode: [],             //主要清单明细项目编码 (标准文件中constraint中没有定义此唯一性,但是主要清单明细的备注那里说明了,这里处理一下)
                 appraisalDetailCode: [],         //评审材料明细代码唯一(标准文件中constraint中没有定义此唯一性,但是评审材料明细的备注里说明了)
             };
-            XML_EXPORT_BASE.Element.call(this, '单位工程', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '单位工程', attrs);
         }
         // 开放出来的构造方法
         this.instance = {
@@ -323,7 +321,7 @@ const XMLStandard = (function () {
                 {name: '建设规模', value: source.feature.projectScale, required: true},
                 {name: '工程类别', value: _util.getValueByKey(source.basicInformation, 'projectCategory'), required: true} //取建设项目的工程类别
             ];
-            XML_EXPORT_BASE.Element.call(this, '工程特征', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '工程特征', attrs);
         }
         //特征项定义
         function FeatureItem(feature) {
@@ -332,7 +330,7 @@ const XMLStandard = (function () {
                 {name: '名称', value: feature.dispName, required: true},
                 {name: '内容', value: feature.value, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '特征项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '特征项', attrs);
         }
         //工程信息-信息项定义
         function InfoItem(info) {
@@ -340,11 +338,11 @@ const XMLStandard = (function () {
                 {name: '编码', value: info.code, required: true},
                 {name: '内容', value: info.value, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '信息项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '信息项', attrs);
         }
         //单位工程费汇总定义
         function TenderFeeSummary() {
-            XML_EXPORT_BASE.Element.call(this, '单位工程费汇总', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '单位工程费汇总', []);
         }
         //计价程序费用行定义
         function FeeRow(source) {
@@ -363,11 +361,11 @@ const XMLStandard = (function () {
                 },
                 {name: '备注', value: source.remark},
             ];
-            XML_EXPORT_BASE.Element.call(this, '计价程序费用行', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '计价程序费用行', attrs);
         }
         //分部分项清单
         function FBFXBills() {
-            XML_EXPORT_BASE.Element.call(this, '分部分项清单', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '分部分项清单', []);
         }
         //清单分部定义
         function FBBills(source) {
@@ -380,7 +378,7 @@ const XMLStandard = (function () {
                 {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0', required: true},
                 {name: '备注', value: source.remark}
             ];
-            XML_EXPORT_BASE.Element.call(this, '清单分部', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '清单分部', attrs);
         }
         //清单项目定义
         function FXbills(source) {
@@ -407,11 +405,11 @@ const XMLStandard = (function () {
                     failHint: `第${source.row}行清单-“最高限价”`},
                 {name: '备注', value: source.remark},
             ];
-            XML_EXPORT_BASE.Element.call(this, '清单项目', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '清单项目', attrs);
         }
         //项目特征定义
         function ItemCharacter() {
-            XML_EXPORT_BASE.Element.call(this, '项目特征', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '项目特征', []);
         }
         //特征定义
         function Feature(source) {
@@ -419,22 +417,22 @@ const XMLStandard = (function () {
                 {name: '特征名称', value: source.name, required: true},
                 {name: '特征描述', value: source.value, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '特征', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '特征', attrs);
         }
         //工程内容定义
         function JobContent() {
-            XML_EXPORT_BASE.Element.call(this, '工程内容', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '工程内容', []);
         }
         //内容定义
         function Content(content) {
             let attrs = [
                 {name: '内容', value: content, required: true}
             ];
-            XML_EXPORT_BASE.Element.call(this, '内容', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '内容', attrs);
         }
         //组价内容定义
         function PriceContent() {
-            XML_EXPORT_BASE.Element.call(this, '组价内容', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '组价内容', []);
         }
         //定额子目定义
         function Ration(source) {
@@ -460,11 +458,11 @@ const XMLStandard = (function () {
                     failHint: `第${source.row}行定额-“分包标志”`},
                 {name: '备注', value: source.remark}
             ];
-            XML_EXPORT_BASE.Element.call(this, '定额子目', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '定额子目', attrs);
         }
         //工料分析定义
         function GljAnalyze() {
-            XML_EXPORT_BASE.Element.call(this, '工料分析', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '工料分析', []);
         }
         //人材机含量定义
         function GljContent(source) {
@@ -474,7 +472,7 @@ const XMLStandard = (function () {
                 {name: '数量', value: source.totalQuantity, required: true, type: _config.TYPE.DECIMAL},
                 {name: '数量计算方式', value: 1, required: true, type: _config.TYPE.INT, enumeration: ['1', '2']},
             ];
-            XML_EXPORT_BASE.Element.call(this, '人材机含量', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '人材机含量', attrs);
         }
         //费用组成
         function FeeContent(source) {
@@ -512,7 +510,7 @@ const XMLStandard = (function () {
                 {name: '其他风险单价', value: _util.getFee(source.fees, 'otherRisk.unitFee'), type: _config.TYPE.DECIMAL, required: true},
                 {name: '其他风险合价', value: _util.getFee(source.fees, 'otherRisk.totalFee'), type: _config.TYPE.NUM2, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '费用组成', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '费用组成', attrs);
         }
         //措施项目清单定义
         function CSXMBills(source) {
@@ -522,7 +520,7 @@ const XMLStandard = (function () {
                 {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0',
                     type: _config.TYPE.NUM2, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '措施项目清单', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '措施项目清单', attrs);
         }
         //组织措施清单定义
         function ZZCSBills(source) {
@@ -530,7 +528,7 @@ const XMLStandard = (function () {
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
                     type: _config.TYPE.NUM2, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '组织措施清单', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '组织措施清单', attrs);
         }
         //组织措施分类定义
         function ZZCSClass(source) {
@@ -543,7 +541,7 @@ const XMLStandard = (function () {
                     type: _config.TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark}
             ];
-            XML_EXPORT_BASE.Element.call(this, '组织措施分类', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '组织措施分类', attrs);
         }
         //公式计算措施项
         function FormulaCalcMeasure(source) {
@@ -562,7 +560,7 @@ const XMLStandard = (function () {
                     enumerationHint: ['组织措施费', '安全文明施工专项费', '建设工程竣工档案编制费', '住宅工程质量分户验收费'],
                     failHint: `第${source.row}行清单-“固定费用类别”`},
             ];
-            XML_EXPORT_BASE.Element.call(this, '公式计算措施项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '公式计算措施项', attrs);
         }
         //技术措施清单定义
         function JSCSBills(source) {
@@ -572,7 +570,7 @@ const XMLStandard = (function () {
                 {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0',
                     type: _config.TYPE.NUM2, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '技术措施清单', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '技术措施清单', attrs);
         }
         //技术措施分类
         function JSCSClass(source) {
@@ -584,18 +582,18 @@ const XMLStandard = (function () {
                 {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0',
                     type: _config.TYPE.DECIMAL, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '技术措施分类', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '技术措施分类', attrs);
         }
         //其他项目清单定义
         function OtherBills() {
-            XML_EXPORT_BASE.Element.call(this, '其他项目清单', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '其他项目清单', []);
         }
         //暂列金额定义
         function Provisional(source) {
             let attrs = [
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2}
             ];
-            XML_EXPORT_BASE.Element.call(this, '暂列金额', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '暂列金额', attrs);
         }
         //暂列金额明细定义
         function ProvisionalDetail(source) {
@@ -610,14 +608,14 @@ const XMLStandard = (function () {
                     type: _config.TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark, required: true}
             ];
-            XML_EXPORT_BASE.Element.call(this, '暂列金额明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '暂列金额明细', attrs);
         }
         //专业工程暂估价定义
         function EngEstimate(source) {
             let attrs = [
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0'}
             ];
-            XML_EXPORT_BASE.Element.call(this, '专业工程暂估价', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '专业工程暂估价', attrs);
         }
         //专业工程暂估明细定义
         function EngEstimateDetail(source) {
@@ -632,26 +630,26 @@ const XMLStandard = (function () {
                     type: _config.TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark, required: true}
             ];
-            XML_EXPORT_BASE.Element.call(this, '专业工程暂估明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '专业工程暂估明细', attrs);
         }
         //计日工定义
         function DayWork(source) {
             let attrs = [
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0'}
             ];
-            XML_EXPORT_BASE.Element.call(this, '计日工', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '计日工', attrs);
         }
         //人工定义
         function Labour() {
-            XML_EXPORT_BASE.Element.call(this, '人工', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '人工', []);
         }
         //材料定义
         function Material() {
-            XML_EXPORT_BASE.Element.call(this, '材料', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '材料', []);
         }
         //施工机械定义
         function Machine() {
-            XML_EXPORT_BASE.Element.call(this, '施工机械', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '施工机械', []);
         }
         //计日工项目定义
         function DayWorkItem(source) {
@@ -669,14 +667,14 @@ const XMLStandard = (function () {
                     type: _config.TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark}
             ];
-            XML_EXPORT_BASE.Element.call(this, '计日工项目', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '计日工项目', attrs);
         }
         //总承包服务费定义
         function TurnKeyContract(source) {
             let attrs = [
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2}
             ];
-            XML_EXPORT_BASE.Element.call(this, '总承包服务费', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '总承包服务费', attrs);
         }
         //总承包服务费分类定义
         function TurnKeyContractClass(source) {
@@ -687,7 +685,7 @@ const XMLStandard = (function () {
                     failHint: `第${source.row}行承包服务费清单-“名称”`},
                 {name:'备注', value: source.remark}
             ];
-            XML_EXPORT_BASE.Element.call(this, '总承包服务费分类', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '总承包服务费分类', attrs);
         }
         //总承包服务费费用项定义
         function TurnKeyContractItem(source) {
@@ -703,7 +701,7 @@ const XMLStandard = (function () {
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark}
             ];
-            XML_EXPORT_BASE.Element.call(this, '总承包服务费费用项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '总承包服务费费用项', attrs);
         }
         //签证索赔计价汇总费用项
         function ClaimVisaFeeItem(source) {
@@ -718,14 +716,14 @@ const XMLStandard = (function () {
                     type: _config.TYPE.NUM2, required: true},
                 {name: '依据', value: source.claimVisa, required: true},
             ];
-            XML_EXPORT_BASE.Element.call(this, '签证索赔计价汇总费用项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '签证索赔计价汇总费用项', attrs);
         }
         //其他定义
         function Other(source) {
             let attrs = [
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? source.commonTotalFee : '0', type: _config.TYPE.NUM2}
             ];
-            XML_EXPORT_BASE.Element.call(this, '其他', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '其他', attrs);
         }
         //其他列项定义
         function OtherItem(source) {
@@ -742,11 +740,11 @@ const XMLStandard = (function () {
                 {name: '招标人标志', value: false, type: _config.TYPE.BOOL},
                 {name: '备注', value: source.remark, maxLen: 255}
             ];
-            XML_EXPORT_BASE.Element.call(this, '其他列项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '其他列项', attrs);
         }
         //规费和税金清单定义
         function ChargeTaxBills() {
-            XML_EXPORT_BASE.Element.call(this, '规费和税金清单', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '规费和税金清单', []);
         }
         //费用项定义
         function FeeItem(source) {
@@ -766,11 +764,11 @@ const XMLStandard = (function () {
                     failHint: `第${source.row}行清单-“固定费用类别”`},
                 {name: '备注', value: source.remark, maxLen: 255}
             ];
-            XML_EXPORT_BASE.Element.call(this, '费用项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '费用项', attrs);
         }
         //承包人材料差额法表
         function DifferentiaGlj() {
-            XML_EXPORT_BASE.Element.call(this, '承包人材料差额法表', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '承包人材料差额法表', []);
         }
         //承包人材料差额法明细
         //如果是“控制价”、“招标”,则不导出;
@@ -789,14 +787,14 @@ const XMLStandard = (function () {
                 {name: '备注', value: source.remark, maxLen: 255,
                     failHint: `承包人材料${source.code}-“备注”`},
             ];
-            XML_EXPORT_BASE.Element.call(this, '承包人材料差额法明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '承包人材料差额法明细', attrs);
         }
         //承包人材料指数法表
         function ExponentialGlj() {
             let attrs = [
                 {name: '定值权重A', value: '', required: true, type: _config.TYPE.DECIMAL}
             ];
-            XML_EXPORT_BASE.Element.call(this, '承包人材料指数法表', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '承包人材料指数法表', attrs);
         }
         //承包人材料指数法明细
         //如果是“控制价”、“招标”,则不导出;
@@ -812,11 +810,11 @@ const XMLStandard = (function () {
                 {name: '备注', value: source.remark, maxLen: 255,
                     failHint: `承包人材料${source.code}-“备注”`},
             ];
-            XML_EXPORT_BASE.Element.call(this, '承包人材料指数法明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '承包人材料指数法明细', attrs);
         }
         //人材机汇总定义
         function GljSummary() {
-            XML_EXPORT_BASE.Element.call(this, '人材机汇总', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '人材机汇总', []);
         }
         //人材机定义
         function Glj(source) {
@@ -854,7 +852,7 @@ const XMLStandard = (function () {
                 {name: '备注', value: source.remark, maxLen: 255,
                     failHint: `人材机${source.orgCode}-“备注”`},
             ];
-            XML_EXPORT_BASE.Element.call(this, '人材机', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '人材机', attrs);
         }
         //人材机配比定义
         function GljRatio(source) {
@@ -862,15 +860,15 @@ const XMLStandard = (function () {
                 {name: '明细材料代码', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '数量', value: source.quantity, type: _config.TYPE.DECIMAL, required: true}
             ];
-            XML_EXPORT_BASE.Element.call(this, '人材机配比', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '人材机配比', attrs);
         }
         //评标材料表定义
         function EvalBidMaterial() {
-            XML_EXPORT_BASE.Element.call(this, '评标材料表', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '评标材料表', []);
         }
         //暂估价材料表定义
         function EvalEstimateMaterial() {
-            XML_EXPORT_BASE.Element.call(this, '暂估价材料表', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '暂估价材料表', []);
         }
         //材料明细定义
         function MaterialDetail(source) {
@@ -889,11 +887,11 @@ const XMLStandard = (function () {
                 {name: '质量等级', value: source.qualityGrace, maxLen: 255},
                 {name: '备注', value: source.remark, maxLen: 255},
             ];
-            XML_EXPORT_BASE.Element.call(this, '材料明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '材料明细', attrs);
         }
         //清单综合单价计算程序定义
         function CalcProgram() {
-            XML_EXPORT_BASE.Element.call(this, '清单综合单价计算程序', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '清单综合单价计算程序', []);
         }
         //综合单价计算程序文件定义
         function CalcProgramFile(source) {
@@ -901,7 +899,7 @@ const XMLStandard = (function () {
                 {name: 'ID', value: source.ID, type: _config.TYPE.INT, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true}
             ];
-            XML_EXPORT_BASE.Element.call(this, '综合单价计算程序文件', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '综合单价计算程序文件', attrs);
         }
         //综合单价计算程序费用项定义
         function CalcProgramFeeItem(source) {
@@ -915,11 +913,11 @@ const XMLStandard = (function () {
                 {name: '费用类别', value: source.feeType, type: _config.TYPE.INT, required: true},
                 {name: '备注', value: source.remark, maxLen: 255},
             ];
-            XML_EXPORT_BASE.Element.call(this, '综合单价计算程序费用项', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '综合单价计算程序费用项', attrs);
         }
         //主要清单汇总定义
         function MainBillsSummary() {
-            XML_EXPORT_BASE.Element.call(this, '主要清单汇总', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '主要清单汇总', []);
         }
         //主要清单明细定义
         function MainBillsItem(source) {
@@ -933,11 +931,11 @@ const XMLStandard = (function () {
                 {name: '其中暂估价', value: _util.getFee(source.fees, 'estimate.totalFee'), type: _config.TYPE.DECIMAL},
                 {name: '备注', value: source.remark, maxLen: 255},
             ];
-            XML_EXPORT_BASE.Element.call(this, '主要清单明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '主要清单明细', attrs);
         }
         //评审材料汇总定义
         function AppraisalSummary(){
-            XML_EXPORT_BASE.Element.call(this, '评审材料汇总', [], failList);
+            XML_EXPORT_BASE.Element.call(this, '评审材料汇总', []);
         }
         //评审材料明细定义
         function AppraisalDetail(source) {
@@ -948,7 +946,7 @@ const XMLStandard = (function () {
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '市场价', value: source.marketPrice, type: _config.TYPE.DECIMAL, required: true}
             ];
-            XML_EXPORT_BASE.Element.call(this, '评审材料明细', attrs, failList);
+            XML_EXPORT_BASE.Element.call(this, '评审材料明细', attrs);
         }
 
         //目前的数据
@@ -1051,7 +1049,7 @@ const XMLStandard = (function () {
             let source = {summaryInfo: summaryInfo[engData.ID], name: engData.name, code: getIncreamentData('projectCode')};
             let engineering = new Engineering(source);
             //单项工程编号要唯一
-            _util.checkUnique(curProjectEle.constraints.engCode, failList, source.code, '单项工程编号');
+            _util.checkUnique(curProjectEle.constraints.engCode, source.code, '单项工程编号');
             //费用构成
             let feeForm = new FeeFrom(summaryInfo[engData.ID]);
             engineering.children.push(feeForm);
@@ -1063,11 +1061,11 @@ const XMLStandard = (function () {
                     await _util.setTimeoutSync(() => {}, _config.TIMEOUT_TIME);
                 }
                 //方便用户看错误来自哪个单位工程
-                failList.push(`<span style="font-weight: bold">单位工程“${tenderData.name}”下:</span>`);
-                let orgLen = failList.length;
+                _failList.push(`<span style="font-weight: bold">单位工程“${tenderData.name}”下:</span>`);
+                let orgLen = _failList.length;
                 let tender = await loadTender(summaryInfo, tenderData);
-                if (failList.length === orgLen) {    //只有上方的提示,说明该单位工程没有报错
-                    failList.pop();
+                if (_failList.length === orgLen) {    //只有上方的提示,说明该单位工程没有报错
+                    _failList.pop();
                 }
                 tenderGljs = [];    //清空单位工程内所有的人材机(ID)
                 engineering.children.push(tender);
@@ -1110,7 +1108,7 @@ const XMLStandard = (function () {
             };
             let tender = curTenderEle = new Tender(tenderSource);
             //单位工程编号要唯一
-            _util.checkUnique(curProjectEle.constraints.tenderCode, failList, tenderSource.code, '单位工程编号');
+            _util.checkUnique(curProjectEle.constraints.tenderCode, tenderSource.code, '单位工程编号');
             //工程特征
             let featureObj = _util.arrayToObj(tenderData.property.projectFeature);
             let engFeature = new EngFeature({feature:featureObj, basicInformation: curPMData.project.property.basicInformation});
@@ -1121,7 +1119,7 @@ const XMLStandard = (function () {
                 engFeature.children.push(featureItem);
             }
             //工程信息 : 筛选设置了编码的基本信息数据
-            let constructInfo = new XML_EXPORT_BASE.Element('工程信息', [], failList);
+            let constructInfo = new XML_EXPORT_BASE.Element('工程信息', []);
             curPMData.project.property.basicInformation.forEach(pItem => {
                 pItem.items.forEach(info => {
                     if (info.code) {
@@ -1257,7 +1255,7 @@ const XMLStandard = (function () {
             };
             let bills = new FXbills(source);
             //清单项目项目编码要在单位工程中唯一
-            _util.checkUnique(curTenderEle.constraints.billsCode, failList, source.code, `第${source.row}行`,`“清单项目编码${source.code}”`);
+            _util.checkUnique(curTenderEle.constraints.billsCode, source.code, `第${source.row}行`,`“清单项目编码${source.code}”`);
             //加载特征及内容
             function loadFeatureContent() {
                 let job = [],
@@ -1438,7 +1436,7 @@ const XMLStandard = (function () {
             let fbfxBills = new FBFXBills();
             let subEngNode = detail.Bills.tree.roots.find((node) => node.getFlag() === fixedFlag.SUB_ENGINERRING);
             if (!subEngNode) {
-                failList.push('不存在分部分项清单');
+                _failList.push('不存在分部分项清单');
                 return fbfxBills;
             }
             //是否有清单分类,分部分项下,清单分类和清单项目不可同层存在,如果有了清单分类,则提示其他清单项目:
@@ -1455,7 +1453,7 @@ const XMLStandard = (function () {
                         remark: node.data.remark
                     };
                     if (node.children.length === 0) {
-                        failList.push(`第${fbSource.row}行清单分部下至少要有一条清单项目。`);
+                        _failList.push(`第${fbSource.row}行清单分部下至少要有一条清单项目。`);
                     }
                     let fbBills = new FBBills(fbSource);
                     fbfxBills.children.push(fbBills);
@@ -1469,7 +1467,7 @@ const XMLStandard = (function () {
                     //第一层有了分部,不能有分项
                     if (hasBillsClass) {
                         let row = detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1;
-                        failList.push(`第${row}行清单应是清单分部,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                        _failList.push(`第${row}行清单应是清单分部,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
                     }
                     let fxBills = loadBills(node, detail);
                     fbfxBills.children.push(fxBills);
@@ -1485,8 +1483,8 @@ const XMLStandard = (function () {
         function loadCSXM(detail) {
             let measureNode = detail.Bills.tree.roots.find((node) => node.getFlag() === fixedFlag.MEASURE);
             if (!measureNode) {
-                failList.push('不存在措施项目清单');
-                return new XML_EXPORT_BASE.Element('措施项目清单', [], failList);
+                _failList.push('不存在措施项目清单');
+                return new XML_EXPORT_BASE.Element('措施项目清单', []);
             }
             let csxmBills = new CSXMBills({fees: measureNode.data.fees});
             //加载组织措施清单
@@ -1504,7 +1502,7 @@ const XMLStandard = (function () {
                 csxmBills.children.push(jscsBills);
                 let isValidDepth = _util.validDepth(maxDepth, jscsNode);
                 if (!isValidDepth) {
-                    failList.push('技术措施清单子项超过两层');
+                    _failList.push('技术措施清单子项超过两层');
                 } else {
                     loadJSCS(jscsBills, jscsNode.children);
                 }
@@ -1538,7 +1536,7 @@ const XMLStandard = (function () {
                         };
                         source.calcBaseState = _util.transformCalcBaseState(detail, source.calcBase, CalcStateMap);
                         if (hasBillsClass) {
-                            failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                            _failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
                         }
                         let formula = new FormulaCalcMeasure(source);
                         parent.children.push(formula);
@@ -1547,7 +1545,7 @@ const XMLStandard = (function () {
                 if (parent instanceof ZZCSClass) {  //组织措施分类下的只能有一个组织措施分类
                     let filters = parent.children.filter(data => data instanceof ZZCSClass);
                     if (filters.length) {
-                        failList.push('组织措施分类下只能有一个组织措施分类');
+                        _failList.push('组织措施分类下只能有一个组织措施分类');
                     }
                 }
             }
@@ -1566,7 +1564,7 @@ const XMLStandard = (function () {
                     } else {    //清单项目
                         if (hasBillsClass) {
                             let row = detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1;
-                            failList.push(`第${row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                            _failList.push(`第${row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
                         }
                         parent.children.push(loadBills(node, detail));
                     }
@@ -1618,7 +1616,7 @@ const XMLStandard = (function () {
                     if (fNode.children.length > 0) {
                         let isValidDepth = _util.validDepth(1, fNode);
                         if (!isValidDepth) {
-                            failList.push(`计日工${ele.name}子项超过一层`);
+                            _failList.push(`计日工${ele.name}子项超过一层`);
                         } else {
                             for (let itemNode of fNode.children) {
                                 ele.children.push(loadDayWorkItem(itemNode, constraints, `${ele.name}计日工项目编号`));
@@ -1637,7 +1635,7 @@ const XMLStandard = (function () {
             if (tkcNode && tkcNode.children.length > 0) {  //必须要有子项才显示总承包服务费元素
                 let isValidDepth = _util.validDepth(2, tkcNode);  //最多2层子项:总承包服务费分类-总承包服务费费用项
                 if (!isValidDepth) {
-                    failList.push('总承包服务费子项超过两层');
+                    _failList.push('总承包服务费子项超过两层');
                 } else {
                     let tkcEle = new TurnKeyContract({fees: tkcNode.data.fees});
                     otherEle.children.push(tkcEle);
@@ -1648,7 +1646,7 @@ const XMLStandard = (function () {
             let claimNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.CLAIM);
             if (claimNode && claimNode.children.length > 0) {   //必须要有子项才能显示索赔计价汇总元素
                 let claimEle = new XML_EXPORT_BASE.Element('索赔计价汇总', [
-                    {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(claimNode.data.fees, 'common.totalFee') : '0'}], failList);
+                    {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(claimNode.data.fees, 'common.totalFee') : '0'}]);
                 for (let n of claimNode.children) {
                     claimEle.children.push(new ClaimVisaFeeItem(n.data));
                 }
@@ -1659,7 +1657,7 @@ const XMLStandard = (function () {
             if (visaNode && visaNode.children.length > 0) {     //必须要有子项才能显示现场签证计价汇总元素
                 let visaEle = new XML_EXPORT_BASE.Element('现场签证计价汇总', [
                     {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(visaNode.data.fees, 'common.totalFee') : '0'}
-                ], failList);
+                ]);
                 for (let n of visaNode.children) {
                     visaEle.children.push(new ClaimVisaFeeItem(n.data));
                 }
@@ -1679,7 +1677,7 @@ const XMLStandard = (function () {
                 //暂列金额最多只有一层子节点
                 let isValidDepth = _util.validDepth(1, node);
                 if (!isValidDepth) {
-                    failList.push('暂列金额子项超过一层');
+                    _failList.push('暂列金额子项超过一层');
                 } else {    //加载暂列金额明细
                     for (let n of node.children) {
                         let pDetailSource = {
@@ -1692,7 +1690,7 @@ const XMLStandard = (function () {
                             },
                             pDetailEle = new ProvisionalDetail(pDetailSource);
                         //暂列金额明细编号在单位工程中唯一
-                        _util.checkUnique(curTenderEle.constraints.provisionalDetailCode, failList, pDetailSource.code,
+                        _util.checkUnique(curTenderEle.constraints.provisionalDetailCode, pDetailSource.code,
                             `第${pDetailSource.row}行`, `暂列金额明细编码${pDetailSource.code}`);
                         provisionalEle.children.push(pDetailEle);
                     }
@@ -1705,7 +1703,7 @@ const XMLStandard = (function () {
                 //专业工程暂估价最多只有一层子节点
                 let isValidDepth = _util.validDepth(1, node);
                 if (!isValidDepth) {
-                    failList.push('专业工程暂估价子项超过一层');
+                    _failList.push('专业工程暂估价子项超过一层');
                 } else {    //加载专业工程暂估明细
                     for (let n of node.children) {
                         let eDetailSource = {
@@ -1718,7 +1716,7 @@ const XMLStandard = (function () {
                             },
                             eDetailEle = new EngEstimateDetail(eDetailSource);
                         //暂列金额明细编号在单位工程中唯一
-                        _util.checkUnique(curTenderEle.constraints.engEstimateDetailCode, failList, eDetailSource.code,
+                        _util.checkUnique(curTenderEle.constraints.engEstimateDetailCode, eDetailSource.code,
                             `第${eDetailSource.row}行`, `专业工程暂估明细编码${eDetailSource.code}`);
                         engEstimateEle.children.push(eDetailEle);
                     }
@@ -1736,7 +1734,7 @@ const XMLStandard = (function () {
                     fees: node.data.fees,
                     remark: node.data.remark
                 };
-                _util.checkUnique(constraints, failList, source.code, `第${source.row}行`, `计日工项目编码${source.code}`);
+                _util.checkUnique(constraints, source.code, `第${source.row}行`, `计日工项目编码${source.code}`);
                 return new DayWorkItem(source);
             }
             //加载服务费项
@@ -1765,7 +1763,7 @@ const XMLStandard = (function () {
                             remark: node.data.remark
                         };
                         if (hasBillsClass) {
-                            failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                            _failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
                         }
                         parent.children.push(new TurnKeyContractItem(source));
                     }
@@ -1807,7 +1805,7 @@ const XMLStandard = (function () {
                     };
                     let otherItemEle = new OtherItem(otherItemSource);
                     otherItems.push(otherItemEle);
-                    _util.checkUnique(curTenderEle.constraints.otherItemNo, failList, otherItemSource.code,
+                    _util.checkUnique(curTenderEle.constraints.otherItemNo, otherItemSource.code,
                         `第${otherItemSource.row}行`, `清单编码${otherItemSource.code}`);
                 }
                 let otherEle = new Other({commonTotalFee: summaryFee});
@@ -1849,7 +1847,7 @@ const XMLStandard = (function () {
                 };
                 source.calcBaseState = _util.transformCalcBaseState(detail, source.calcBase, CalcStateMap);
                 //序号唯一
-                _util.checkUnique(curTenderEle.constraints.feeItemNo, failList, source.code,
+                _util.checkUnique(curTenderEle.constraints.feeItemNo, source.code,
                     `第${source.row}行`, `清单编码${source.code}`);
                 chargeTaxEle.children.push(new FeeItem(source));
             }
@@ -1876,7 +1874,7 @@ const XMLStandard = (function () {
                 };
                 let mainBillsItemEle = new MainBillsItem(source);
                 //主要清单明细项目编码唯一
-                _util.checkUnique(curTenderEle.constraints.mainBillsCode, failList, source.code, '主要清单明细项目编码');
+                _util.checkUnique(curTenderEle.constraints.mainBillsCode, source.code, '主要清单明细项目编码');
                 parent.children.push(mainBillsItemEle);
             }
         }
@@ -1957,7 +1955,7 @@ const XMLStandard = (function () {
                     };
                     let gljEle = new Glj(gljSource);
                     //人材机代码唯一
-                    _util.checkUnique(curTenderEle.constraints.gljCode, failList, gljSource.code, '人材机代码', gljSource.orgCode);
+                    _util.checkUnique(curTenderEle.constraints.gljCode, gljSource.code, '人材机代码', gljSource.orgCode);
                     //人材机配比
                     let connectKey = gljUtil.getIndex(glj, gljKeyArray),
                         ratioData = detail.projectGLJ.datas.mixRatioMap[connectKey];
@@ -1979,7 +1977,7 @@ const XMLStandard = (function () {
                         evalBidMaterial.children.push(new MaterialDetail(gljSource));
                         //给建设项目下的评审材料汇总设置明细数据,这里需要检测代码(编号)唯一性,因为是汇总所有单位工程的,要求所有单位工程内评审材料代码唯一
                         appraisalSummary.children.push(new AppraisalDetail(gljSource));
-                        _util.checkUnique(curTenderEle.constraints.appraisalDetailCode, failList, gljSource.code, '评审材料明细代码', gljSource.orgCode);
+                        _util.checkUnique(curTenderEle.constraints.appraisalDetailCode, gljSource.code, '评审材料明细代码', gljSource.orgCode);
                     }
                     if (glj.is_evaluate) {  //暂估
                         gljSource.serialNo = evalEstSeq++;
@@ -2048,6 +2046,7 @@ const XMLStandard = (function () {
             if (!eleData) {
                 return;
             }
+            console.log(this.datas);
             this.originalDatas.push({data: this.datas, fileName: `重庆标准交换数据(${FILE_KIND[exportKind]}).QTF`});
         };
     }

+ 43 - 6
web/building_saas/main/js/models/exportStdInterfaceBase.js

@@ -7,7 +7,6 @@
  * @date 2019/6/20
  * @version
  */
-
 const XML_EXPORT_BASE = (() => {
 
     // 属性类型
@@ -58,6 +57,43 @@ const XML_EXPORT_BASE = (() => {
         EXPORT_KIND
     });
 
+    // 缓存项 不需要的时候需要清空
+    let _cache = {
+        // 失败列表
+        failList: [],
+        // 项目数据(不包含详细数据,项目管理数据)
+        projectData: {},
+        // 当前导出类型,默认投标
+        exportKind: EXPORT_KIND.Tender,
+        // 记录拉取的单位工程项目详细数据,导出的时候,可能会导出多个文件,只有导出第一个文件的时候需要请求数据
+        tenderDetailMap: {}
+    };
+    // 返回缓存项
+    function getItem(key) {
+        return _cache[key] || null;
+    }
+    // 设置缓存项
+    function setItem(key, value) {
+        // 与原数据是同类型的数据才可设置成功
+        if (_cache[key] &&
+            Object.prototype.toString.call(_cache[key]) ===
+            Object.prototype.toString.call(value)) {
+            _cache[key] = value;
+        }
+    }
+    // 清空缓存项
+    function clear() {
+        _cache.failList = [];
+        _cache.projectData = {};
+        _cache.exportKind = EXPORT_KIND.Tender;
+        _cache.tenderDetailMap = {};
+    }
+    const CACHE = Object.freeze({
+        getItem,
+        setItem,
+        clear
+    });
+
     /*
      * 定义不设置一个Node方法统一进入的原因:模板化比较直观,不分开定义节点的话,调用传参也很麻烦而且不直观。
      * 一个节点对应一个构造方法,方便调整配置、方便其他版本开发、接手的人看起来更直观
@@ -66,13 +102,13 @@ const XML_EXPORT_BASE = (() => {
      *         {Array}failList 失败列表
      * @return {void}
      * */
-    function Element(name, attrs, failList) {
+    function Element(name, attrs) {
         this.name = name;
         let checkData = check(name, attrs);
         this.fail = checkData.failHints;
         this.attrs = checkData.filterAttrs;
         this.children = [];
-        failList.push(...this.fail);
+        _cache.failList.push(...this.fail);
     }
     /*
      * 检查
@@ -236,12 +272,12 @@ const XML_EXPORT_BASE = (() => {
     //检测唯一性
     //@param {Object}constraints(约束池) {All}data(检测的数据) {String}hint(提示已存在的内容) {String}subHint(额外提示,有额外提示时,不用data提示)
     //@return {void}
-    function checkUnique(constraints, failList, data, hint, subHint) {
+    function checkUnique(constraints, data, hint, subHint) {
         if (constraints.includes(data)) {
             let failHint = subHint
                 ? `${hint}“${subHint}”已存在`
                 : `${hint}“${data}”已存在`;
-            failList.push(failHint);
+            _cache.failList.push(failHint);
         } else if (data) {
             constraints.push(data);
         }
@@ -540,9 +576,10 @@ const XML_EXPORT_BASE = (() => {
             saveAs(zipFile, '重庆标准交换数据.zip');
         }
     }
-
+    
     return {
         CONFIG,
+        CACHE,
         UTIL,
         Element,
         exportFile

+ 19 - 7
web/building_saas/main/js/models/importStandardInterface.js

@@ -106,6 +106,14 @@ const ImportXML = (() => {
         BILLS: 4, //清单
         BX: 5    //补项
     };
+    // 定额类型
+    const RationType = {
+        ration: 1,
+        volumePrice: 2, // 量价
+        volumePriceMaterial: 201, // 量材
+        gljRation: 3,
+        install: 4
+    };
     //项目类型
     const ProjectType = {
         Project: 'Project',
@@ -431,10 +439,10 @@ const ImportXML = (() => {
                 //'6'认为量材,其他都认为是定额
                 let type = getValue(rationSrc, ['_子目类型']);
                 if (type == '6') {
-                    rationData.type = 2;
-                    rationData.subType = 201;
+                    rationData.type = RationType.volumePrice;
+                    rationData.subType = RationType.volumePriceMaterial;
                 } else {
-                    rationData.type = 1;
+                    rationData.type = RationType.ration;
                 }
                 rationData.fees = [
                     {fieldName: 'rationUnitPrice', unitFee: getValue(rationSrc, ['_定额单价']) || '0',
@@ -1224,8 +1232,6 @@ const ImportXML = (() => {
                     if (rowCodeMap[base]) { //行引用
                         newBase.push(`@${rowCodeMap[base]}`);
                     } else if (CalcBaseMap[base]) { //基数字典
-                        /*illegal = true;
-                        break;*/
                         newBase.push(CalcBaseMap[base]);
                     } else {    //都没匹配到,说明软件无法识别此基数
                         illegal = true;
@@ -1383,7 +1389,8 @@ const ImportXML = (() => {
                 mixRatio: []    //组成物
             };
             //工料机汇总code-数据映射
-            //项目人材机customCode-原始代码数据映射
+            // 项目人材机customCode、original_code-原始数据映射,有的导入数据中,有一部分关联自生成材料号CX,有的关联原始代码...
+            // 因此customCode、original_code都需要跟原始数据映射,通过customCode取不到数据的时候,通过orgCode获取
             let projectGLJMap = {};
             //投标文件才需要导入定额等数据
             if (importFileKind === FileKind.tender) {
@@ -1392,6 +1399,7 @@ const ImportXML = (() => {
                     pGLJ.id = IDPlaceholder.projectGLJ++;
                     //gljCodeMap[pGLJ.code] = pGLJ;
                     projectGLJMap[pGLJ.customCode] = pGLJ;
+                    projectGLJMap[pGLJ.original_code] = pGLJ;
                 });
                 //处理项目人材机数据
                 tenderData.gljSummary.forEach(pGLJ => {
@@ -1485,7 +1493,11 @@ const ImportXML = (() => {
                 billsHasRations.forEach(bills => {
                     //处理定额
                     bills.rations.forEach(ration => {
-                        ration.programID = tenderData.property.projectEngineering; //默认取单位工程取费类别,后台匹配到标准的再设置
+                        // 定额的取费专业在定额库默认为空的话,取定额取费专业
+                        // 如果是量价、与定额同级的人材机,则取单位工程取费专业
+                        ration.programID = ration.type === RationType.ration
+                            ? tenderData.property.engineering
+                            : tenderData.property.projectEngineering;
                         ration.ID = uuid.v1();
                         ration.projectID = tenderData.ID;
                         ration.billsItemID = bills.ID;

+ 20 - 9
web/building_saas/main/js/views/export_view.js

@@ -9,6 +9,9 @@
  */
 //导出接口相关
 const ExportView = (() => {
+    let _base = XML_EXPORT_BASE,
+        _cache = _base.CACHE,
+        _failList = _cache.getItem('failList');
     let xmlObj = null;
     //设置工程编号表格数据设置
     const sheetSetting = {
@@ -50,6 +53,11 @@ const ExportView = (() => {
         }
         return rst;
     }
+    // 回到初始状态
+    function resetState() {
+        xmlObj = null;
+        _cache.clear();
+    }
     //事件监听
     function exportListener() {
         //导出接口-项目自检
@@ -73,11 +81,11 @@ const ExportView = (() => {
                     }
                 }
                 //设置提示弹窗
-                if (xmlObj.failList.length * 20 > 400) {
+                if (_failList.length * 20 > 400) {
                     $('#hintBox_caption').addClass('export-check');
                 }
-                if (xmlObj.failList.length) {
-                    throw xmlObj.failList.join('<br/>');
+                if (_failList.length) {
+                    throw _failList.join('<br/>');
                 }
             } catch (err) {
                 alert(err);
@@ -112,12 +120,13 @@ const ExportView = (() => {
                     pr.end();
                 }
                 //错误-设置提示弹窗
-                if (xmlObj.failList.length * 20 > 400) {
+                //不弹出
+                /*if (_failList.length * 20 > 400) {
                     $('#hintBox_caption').addClass('export-check');
                 }
-                if (xmlObj.failList.length) {
-                    throw xmlObj.failList.join('<br/>');
-                }
+                if (_failList.length) {
+                    throw _failList.join('<br/>');
+                }*/
                 //弹出工程编号设置窗口
                 if (isPring) {
                     setTimeout(() => {
@@ -188,7 +197,8 @@ const ExportView = (() => {
             xmlObj = null;
         });
         $('#export').on('hide.bs.modal', function() {
-            xmlObj = null;
+            resetState();
+            //xmlObj = null;
             STATE.checking = false;
             STATE.exporting = false;
             STATE.confirming = false;
@@ -201,7 +211,8 @@ const ExportView = (() => {
             }
         });
         $('#export input[type="checkbox"]').click(function () {
-            xmlObj = null;
+            resetState();
+            //xmlObj = null;
         });
     }
     return {exportListener}