Преглед изворни кода

导入鹏业有问题bug 导出完善

zhongzewei пре 6 година
родитељ
комит
f13728d8e2

+ 213 - 71
web/building_saas/main/js/models/exportStandardInterface.js

@@ -116,6 +116,43 @@ const XMLStandard = (function () {
         '{分包设备费}': 'FBSBF',
         '{分包人工工日}': 'FBGR'
     };
+    //计算基础说明映射
+    const CalcStateMap = {
+        'FBFXHJ': '分部分项工程费',
+        'CSXMHJ': '措施项目费',
+        'ZZCSF': '组织措施项目费',
+        'QTXMHJ': '其他项目费',
+        'GF': '规费',
+        'SJ': '税金',
+        'RGF': '分部分项定额人工费',
+        'CLF': '分部分项定额材料费',
+        'JXF': '分部分项定额施工机具使用费',
+        'ZCF': '分部分项主材费',
+        'GR': '分部分项人工工日',
+        'JSCSF': '技术措施项目费',
+        'JSCS_RGF': '技术措施项目定额人工费',
+        'JSCS_CLF': '技术措施项目定额材料费',
+        'JSCS_JXF': '技术措施项目定额施工机具使用费',
+        'JSCS_ZCF': '技术措施项目主材费',
+        'JSCS_GR': '技术措施项目人工工日',
+        'JZMJ': '建筑面积',
+        'RCJJC': '人材机价差',
+        'RGJC': '人工价差',
+        'CLJC': '材料价差',
+        'JXJC': '施工机具使用费价差',
+        'JGRGF': '甲供人工费',
+        'JGCLF': '甲供材料费',
+        'JGJXF': '甲供施工机具使用费',
+        'JGZCF': '甲供主材费',
+        'JGSBF': '甲供设备费',
+        'FBF': '分包费',
+        'FBRGF': '分包定额人工费',
+        'FBCLF': '分包定额材料费',
+        'FBJXF': '分包定额机械费',
+        'FBZCF': '分包主材费',
+        'FBSBF': '分包设备费',
+        'FBGR': '分包人工工日',
+    };
     //加载数据间隔,减少服务器压力
     const TIMEOUT_TIME = 500;
     function isDef(v) {
@@ -362,7 +399,7 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '编号', value: source.code, required: true, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
-                {name: '金额', value: exportKind === FILE_KIND.tender ? source.summaryInfo.engineeringCost : '0', type: TYPE.NUM2},
+                {name: '金额', value: exportKind === ExportKind.Tender ? source.summaryInfo.engineeringCost : '0', type: TYPE.NUM2},
             ];
             element.call(this, '单项工程', attrs);
         }
@@ -381,7 +418,7 @@ const XMLStandard = (function () {
                     '围墙工程', '幕墙工程', '市政安装工程', '城市轨道交通安装', '人工土石方',
                     '房屋安装修缮工程', '房屋修缮单拆除'
                 ]},
-                {name: '金额', value: exportKind === FILE_KIND.tender
+                {name: '金额', value: exportKind === ExportKind.Tender
                     ? source.summaryInfo.engineeringCost
                     : '0', type: TYPE.NUM2},
                 {name: '定额库编码', value: source.defaultRationLibCode, enumeration: [
@@ -420,12 +457,20 @@ const XMLStandard = (function () {
         //特征项定义
         function FeatureItem(feature) {
             let attrs = [
-                {name: '编码', value: feature.code || ''},
+                {name: '编码', value: feature.code},
                 {name: '名称', value: feature.dispName, required: true},
                 {name: '内容', value: feature.value, required: true},
             ];
             element.call(this, '特征项', attrs);
         }
+        //工程信息-信息项定义
+        function InfoItem(info) {
+            let attrs = [
+                {name: '编码', value: info.code, required: true},
+                {name: '内容', value: info.value, required: true},
+            ];
+            element.call(this, '信息项', attrs);
+        }
         //单位工程费汇总定义
         function TenderFeeSummary() {
             element.call(this, '单位工程费汇总', []);
@@ -437,10 +482,10 @@ const XMLStandard = (function () {
                 {name: '行代号', value: source.rowCode, required: true},
                 {name: '项目名称', value: source.name, required: true},
                 {name: '计算基础表达式', value: source.calcBase, required: true},
-                {name: '计算基础说明', value: source.calcBase},
-                {name: '费率', value: source.feeRate},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2},
-                {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2},
+                {name: '计算基础说明', value: source.calcBaseState},
+                {name: '费率', value: exportKind === ExportKind.Tender ? source.feeRate : '100'},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2},
+                {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', type: TYPE.NUM2},
                 {name: '费用类别', value: source.feeType, type: TYPE.INT, required: true,
                     enumeration: ['1100', '1200', '1204', '1300', '800', '900', '1800', '1']},
                 {name: '备注', value: source.remark},
@@ -456,8 +501,8 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '编号', value: source.code, required: true, maxLen: 20},
                 {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), required: true, type: TYPE.NUM2},
-                {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', required: true, type: TYPE.NUM2},
+                {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', required: true},
                 {name: '备注', value: source.remark}
             ];
             element.call(this, '清单分部', attrs);
@@ -469,11 +514,12 @@ const XMLStandard = (function () {
                 {name: '项目名称', value: source.name, required: true, minLen: 1, maxLen: 500, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '单位', value: source.unit, required: true, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '工程量', value: source.quantity, required: true, type: TYPE.DECIMAL},
-                {name: '综合单价', value: getFee(source.fees, 'common.unitFee'), required: true, type: TYPE.DECIMAL},
-                {name: '综合合价', value: getFee(source.fees, 'common.totalFee'), required: true, type: TYPE.NUM2},
-                {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), required: true, type: TYPE.NUM2},
+                {name: '综合单价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.unitFee') : '0', required: true, type: TYPE.DECIMAL},
+                {name: '综合合价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', required: true, type: TYPE.NUM2},
+                {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', required: true, type: TYPE.NUM2},
                 {name: '主要清单标志', value: !!source.mainBills, type: TYPE.BOOL},
                 {name: '暂估清单标志', value: !!source.isEstimate, type: TYPE.BOOL},
+                {name: '最高限价', value: exportKind === ExportKind.Control ? source.maxPrice : '0', type: TYPE.NUM2},
                 {name: '备注', value: source.remark},
             ];
             element.call(this, '清单项目', attrs);
@@ -555,16 +601,22 @@ const XMLStandard = (function () {
                 {name: '定额机上人工基价调整合价', value: 0, type: TYPE.NUM2, required: true},
                 {name: '未计材料单价', value: getFee(source.fees, 'unratedMaterial.unitFee'), type: TYPE.DECIMAL, required: true},
                 {name: '未计材料合价', value: getFee(source.fees, 'unratedMaterial.totalFee'), type: TYPE.NUM2, required: true},
-                {name: '人材机价差单价', value: getFee(source.fees, 'gljDiff.unitFee'), type: TYPE.DECIMAL, required: true},   //人材机价差通过人工、材料、机械价差相加得出
-                {name: '人材机价差合价', value: getFee(source.fees, 'gljDiff.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '人材机价差单价', value: scMathUtil.roundForObj(getFee(source.fees, 'labourDiff.unitFee') +
+                    getFee(source.fees, 'materialDiff.unitFee') + getFee(source.fees, 'machineDiff.unitFee'), 2),
+                    type: TYPE.DECIMAL, required: true},   //人材机价差通过人工、材料、机械价差相加得出
+                {name: '人材机价差合价', value: scMathUtil.roundForObj(getFee(source.fees, 'labourDiff.totalFee') +
+                    getFee(source.fees, 'materialDiff.totalFee') + getFee(source.fees, 'machineDiff.totalFee'), 2),
+                    type: TYPE.NUM2, required: true},
                 {name: '暂估材料单价', value: getFee(source.fees, 'estimate.unitFee'), type: TYPE.DECIMAL, required: true},
                 {name: '暂估材料合价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2, required: true},
                 {name: '管理费单价', value: getFee(source.fees, 'manage.unitFee'), type: TYPE.DECIMAL, required: true},
                 {name: '管理费合价', value: getFee(source.fees, 'manage.totalFee'), type: TYPE.NUM2, required: true},
                 {name: '利润单价', value: getFee(source.fees, 'profit.unitFee'), type: TYPE.DECIMAL, required: true},
                 {name: '利润合价', value: getFee(source.fees, 'profit.totalFee'), type: TYPE.NUM2, required: true},
-                {name: '风险单价', value: getFee(source.fees, 'risk.unitFee'), type: TYPE.DECIMAL, required: true}, //重庆08叫风险费 重庆18叫一般风险费
-                {name: '风险合价', value: getFee(source.fees, 'risk.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '风险单价', value: scMathUtil.roundForObj(getFee(source.fees, 'risk.unitFee') + getFee(source.fees, 'otherRisk.unitFee'), 2),
+                    type: TYPE.DECIMAL, required: true}, //一般风险费单价+其他风险费单价
+                {name: '风险合价', value: scMathUtil.roundForObj(getFee(source.fees, 'risk.totalFee') + getFee(source.fees, 'otherRisk.totalFee'), 2),
+                    type: TYPE.NUM2, required: true},
                 {name: '一般风险单价', value: getFee(source.fees, 'risk.unitFee'), type: TYPE.DECIMAL, required: true},
                 {name: '一般风险合价', value: getFee(source.fees, 'risk.totalFee'), type: TYPE.NUM2, required: true},
                 {name: '其他风险单价', value: getFee(source.fees, 'otherRisk.unitFee'), type: TYPE.DECIMAL, required: true},
@@ -575,15 +627,15 @@ const XMLStandard = (function () {
         //措施项目清单定义
         function CSXMBills(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
-                {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
+                {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', type: TYPE.NUM2, required: true},
             ];
             element.call(this, '措施项目清单', attrs);
         }
         //组织措施清单定义
         function ZZCSBills(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
             ];
             element.call(this, '组织措施清单', attrs);
         }
@@ -592,7 +644,7 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '编码', value: source.code, maxLen: 20, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark}
             ];
             element.call(this, '组织措施分类', attrs);
@@ -603,9 +655,9 @@ const XMLStandard = (function () {
                 {name: '序号', value: source.code, minLen: 1, maxLen:20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '计算基础表达式', value: source.calcBase, required: true},
-                {name: '计算基础说明', value: source.calcBase},
-                {name: '费率', value: source.feeRate, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), required: true},
+                {name: '计算基础说明', value: source.calcBaseState},
+                {name: '费率', value: exportKind === ExportKind.Tender ? source.feeRate : '100', required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', required: true},
                 {name: '暂估价标志', value: !!source.isEstimate, type: TYPE.BOOL},
                 {name: '备注', value: source.remark},
                 {name: '费用类别', value: source.feeType, enumeration: ['120201', '1204', '10041', '1206'], required: true},
@@ -615,8 +667,8 @@ const XMLStandard = (function () {
         //技术措施清单定义
         function JSCSBills(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
-                {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
+                {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', type: TYPE.NUM2, required: true},
             ];
             element.call(this, '技术措施清单', attrs);
         }
@@ -625,8 +677,8 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '编号', value: source.code},
                 {name: '名称', value: source.name, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
-                {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.DECIMAL, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
+                {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', type: TYPE.DECIMAL, required: true},
             ];
             element.call(this, '技术措施分类', attrs);
         }
@@ -637,7 +689,7 @@ const XMLStandard = (function () {
         //暂列金额定义
         function Provisional(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2}
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2}
             ];
             element.call(this, '暂列金额', attrs);
         }
@@ -647,7 +699,7 @@ const XMLStandard = (function () {
                 {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '项目名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '计量单位', value: source.unit, maxLen: 20, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark, required: true}
             ];
             element.call(this, '暂列金额明细', attrs);
@@ -655,7 +707,7 @@ const XMLStandard = (function () {
         //专业工程暂估价定义
         function EngEstimate(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee')}
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0'}
             ];
             element.call(this, '专业工程暂估价', attrs);
         }
@@ -665,7 +717,7 @@ const XMLStandard = (function () {
                 {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '工程名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '工程内容', value: source.engineeringContent, maxLen: 2000, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark, required: true}
             ];
             element.call(this, '专业工程暂估明细', attrs);
@@ -673,7 +725,7 @@ const XMLStandard = (function () {
         //计日工定义
         function DayWork(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee')}
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0'}
             ];
             element.call(this, '计日工', attrs);
         }
@@ -696,8 +748,8 @@ const XMLStandard = (function () {
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '数量', value: source.quantity, type: TYPE.DECIMAL, required: true},
-                {name: '综合单价', value: source.quantity, type: TYPE.DECIMAL, required: true},
-                {name: '综合合价', value: source.quantity, type: TYPE.NUM2, required: true},
+                {name: '综合单价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.unitFee') : '0', type: TYPE.DECIMAL, required: true},
+                {name: '综合合价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark}
             ];
             element.call(this, '计日工项目', attrs);
@@ -705,7 +757,7 @@ const XMLStandard = (function () {
         //总承包服务费定义
         function TurnKeyContract(source) {
             let attrs = [
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2}
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2}
             ];
             element.call(this, '总承包服务费', attrs);
         }
@@ -723,10 +775,10 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '工程名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
-                {name: '计算基础', value: source.calcBaseValue, type: TYPE.DECIMAL, required: true},
+                {name: '计算基础', value: exportKind === ExportKind.Tender ? source.calcBaseValue : '', type: TYPE.DECIMAL, required: true},
                 {name: '服务内容', value: source.serviceContent, maxLen: 255, required: true},
-                {name: '费率', value: source.feeRate, type: TYPE.DECIMAL, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '费率', value: exportKind === ExportKind.Tender ? source.feeRate : '100', type: TYPE.DECIMAL, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '备注', value: source.remark}
             ];
             element.call(this, '总承包服务费费用项', attrs);
@@ -738,8 +790,8 @@ const XMLStandard = (function () {
                 {name: '项目名称', value: source.name, required: true},
                 {name: '计量单位', value: source.unit, required: true},
                 {name: '数量', value: source.quantity, type: TYPE.DECIMAL, required: true},
-                {name: '单价', value: getFee(source.fees, 'common.unitFee'), type: TYPE.DECIMAL, required: true},
-                {name: '合价', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '单价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.unitFee') : '0', type: TYPE.DECIMAL, required: true},
+                {name: '合价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '依据', value: source.claimVisa, required: true},
             ];
             element.call(this, '签证索赔计价汇总费用项', attrs);
@@ -747,7 +799,7 @@ const XMLStandard = (function () {
         //其他定义
         function Other(source) {
             let attrs = [
-                {name: '金额', value: source.commonTotalFee, type: TYPE.NUM2}
+                {name: '金额', value: exportKind === ExportKind.Tender ? source.commonTotalFee : '0', type: TYPE.NUM2}
             ];
             element.call(this, '其他', attrs);
         }
@@ -756,9 +808,9 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '序号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
-                {name: '计算基础', value: source.calcBase,  maxLen: 255},
-                {name: '费率', value: source.feeRate, type: TYPE.DECIMAL},
-                {name: '金额', value: source.commonTotalFee, type: TYPE.NUM2, required: true},
+                {name: '计算基础', value: exportKind === ExportKind.Tender ? source.calcBase : '',  maxLen: 255},
+                {name: '费率', value: exportKind === ExportKind.Tender ? source.feeRate : '100', type: TYPE.DECIMAL},
+                {name: '金额', value: exportKind === ExportKind.Tender ? source.commonTotalFee : '0', type: TYPE.NUM2, required: true},
                 {name: '不计入合价标志', value: source.notSummray, type: TYPE.BOOL},
                 {name: '招标人标志', value: false, type: TYPE.BOOL},
                 {name: '备注', value: source.remark, maxLen: 255}
@@ -775,15 +827,31 @@ const XMLStandard = (function () {
                 {name: '序号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '行代号', value: source.rowCode, maxLen: 20, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
-                {name: '计算基础表达式', value: source.calcBase, maxLen: 255, required: true},
-                {name: '计算基础说明', value: source.calcBase, maxLen: 255},
-                {name: '费率', value: source.feeRate, type: TYPE.DECIMAL, required: true},
-                {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2, required: true},
+                {name: '计算基础表达式', value: exportKind === ExportKind.Tender ? source.calcBase : '', maxLen: 255, required: true},
+                {name: '计算基础说明', value: exportKind === ExportKind.Tender ? source.calcBaseState : '', maxLen: 255},
+                {name: '费率', value: exportKind === ExportKind.Tender ? source.feeRate : '100', type: TYPE.DECIMAL, required: true},
+                {name: '金额', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', type: TYPE.NUM2, required: true},
                 {name: '费用类别', value: source.feeType, enumeration: ['800', '900', '9001', '9002', '9003'], required: true},
                 {name: '备注', value: source.remark, maxLen: 255}
             ];
             element.call(this, '费用项', attrs);
         }
+        //承包人材料差额法表
+        function DifferentiaGlj() {
+            element.call(this, '承包人材料差额法表', []);
+        }
+        //承包人材料差额法明细
+        function DifferentiaGljDetail(source) {
+            let attrs = [
+                {name: '关联材料号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '名称', value: source.code, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '规格', value: source.specs, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
+                {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '数量', value: source.quantity, type: TYPE.DECIMAL, required: true},
+                {name: '风险系数', value: source.riskCoe, type: TYPE.DECIMAL, require: true},
+                {name: '基准单价', value: source.riskCoe, type: TYPE.DECIMAL, require: true},
+            ]
+        }
         //人材机汇总定义
         function GljSummary() {
             element.call(this, '人材机汇总', []);
@@ -1060,7 +1128,7 @@ const XMLStandard = (function () {
                         let flagNode = tenderDetail.mainTree.items.find(mNode => getNodeFlag(mNode) === flag);
                         //匹配到了 普通基数转换成行引用
                         if (flagNode) {
-                            replaceStr = flagNode.serialNo() + 1;
+                            replaceStr = `F${flagNode.serialNo() + 1}`;
                         }
                     }
                     //存在无法处理的基数
@@ -1100,6 +1168,52 @@ const XMLStandard = (function () {
                 return matchs || [];
             }
         }
+        //转换基数说明,根据转换后的基数处理
+        //1.行引用转换为对应行的名称
+        //2.基数字典转换为中文
+        function transformCalcBaseState(tenderDetail, expr) {
+            if (!expr) {
+                return '';
+            }
+            expr = expr.toString();
+            //提取基数
+            let bases = expr.split(/[\+\-\*\/]/g);
+            //提取操作符
+            let oprs = expr.match(/[\+\-\*\/]/g);
+            //转换后的基数
+            let newBase = [];
+            let illegal = false;
+            for (let base of bases) {
+                //行引用转换为名称
+                if (/F\d+/.test(base)) {
+                    let rowCode = base.match(/\d+/)[0],
+                        node = tenderDetail.mainTree.items[rowCode - 1];
+                    if (!node || !node.data.name) {
+                        illegal = true;
+                        break;
+                    }
+                    newBase.push(node && node.data.name ? node.data.name : '');
+                } else if (CalcStateMap[base]){    //字典转换为中文
+                    newBase.push(CalcStateMap[base]);
+                } else if (/^\d+(\.\d+)?$/.test(base)) {    //金额
+                    newBase.push(base);
+                } else {
+                    illegal = true;
+                    break;
+                }
+            }
+            if (illegal) {
+                return '';
+            }
+            let newExpr = '';
+            for (let i = 0; i < newBase.length; i++) {
+                newExpr += newBase[i];
+                if (oprs && oprs[i]) {
+                    newExpr += oprs[i];
+                }
+            }
+            return newExpr;
+        }
 
         //获取需要导出的项目数据
         //@param {Number}tenderID(当前界面的单位工程ID,后台根据这个单位工程,去找其建设项目下所有数据)
@@ -1224,7 +1338,7 @@ const XMLStandard = (function () {
             }
             //初始化项目人材机代号(人材机生成的代号要由排序后的项目人材机从C0开始生成),定额下的人材机含量提前使用到了这个代码,所以需要先初始化
             let allGljs = gljUtil.sortRationGLJ(tenderDetail.projectGLJ.datas.gljList); //人材机汇总排序
-            tenderGljs = allGljs.map(glj => glj.glj_id);
+            tenderGljs = allGljs.map(glj => glj.id);
             //单位工程
             let tenderSource = {
                 code: getIncreamentData('projectCode'),
@@ -1246,6 +1360,18 @@ const XMLStandard = (function () {
                 let featureItem = new FeatureItem(data);
                 engFeature.children.push(featureItem);
             }
+            //工程信息 : 筛选设置了编码的基本信息数据
+            let constructInfo = new element('工程信息', []);
+            curPMData.project.property.basicInformation.forEach(pItem => {
+                pItem.items.forEach(info => {
+                    if (info.code) {
+                        constructInfo.children.push(new InfoItem(info));
+                    }
+                });
+            });
+            if (constructInfo.children.length) {
+                tender.children.push(constructInfo)
+            }
             //单位工程费汇总
             tender.children.push(loadDXFY(tenderDetail));
             //分部分项清单
@@ -1262,11 +1388,13 @@ const XMLStandard = (function () {
             tender.children.push(chargeTax);
             //建设项目下评审材料汇总设置评审材料明细
             let curAppraisalSummary = curProjectEle.children.find(ele => ele.name === '评审材料汇总');
-            //人材机汇总
+            //投标导出人材机汇总
             let gljSumarryInfo = loadGlj(curAppraisalSummary, tenderDetail);
             if (gljSumarryInfo) {
                 let {gljSummary, evalBidMaterial, evalEstimateMaterial} = gljSumarryInfo;
-                tender.children.push(gljSummary);
+                if (exportKind === ExportKind.Tender) {
+                    tender.children.push(gljSummary);
+                }
                 //评标材料表
                 if (evalBidMaterial && evalBidMaterial.children.length) {
                     tender.children.push(evalBidMaterial);
@@ -1312,6 +1440,7 @@ const XMLStandard = (function () {
                     feeType: FEE_TYPE[flag] || FEE_TYPE['0'],
                     remark: node.data.remark
                 };
+                source.calcBaseState = transformCalcBaseState(detail, source.calcBase);
                 let feeRow = new FeeRow(source);
                 tenderFeeSummary.children.push(feeRow);
             }
@@ -1476,7 +1605,7 @@ const XMLStandard = (function () {
                 for (let rGlj of rationGljData) {
                     let gljSource = {
                         //code: rGlj.code,
-                        code: getGljCode(rGlj.GLJID),
+                        code: getGljCode(rGlj.projectGLJID),
                         quantity: rGlj.quantity,
                         totalQuantity: gljUtil.getTotalQuantity(rGlj,  rationData, decimal.glj.quantity, decimal.ration.quantity)
                     };
@@ -1488,17 +1617,22 @@ const XMLStandard = (function () {
                 ration.children.push(feeContent);
                 return ration;
             }
-            //加载组价内容
-            let rationData = allRation.filter(x => x.billsItemID === node.data.ID);
-            if (rationData.length > 0) {
-                let priceContent = new PriceContent();
-                bills.children.push(priceContent);
-                //加载定额子目
-                rationData.sort((x, y) => x.serialNo - y.serialNo); //定额排序
-                for (let rData of rationData) {
-                    let rationGlj = allRationGlj.filter(x => x.rationID === rData.ID);
-                    priceContent.children.push(loadRation(rData, rationGlj));
+            //投标加载组价内容、费用组成
+            if (exportKind === ExportKind.Tender) {
+                let rationData = allRation.filter(x => x.billsItemID === node.data.ID);
+                if (rationData.length > 0) {
+                    let priceContent = new PriceContent();
+                    bills.children.push(priceContent);
+                    //加载定额子目
+                    rationData.sort((x, y) => x.serialNo - y.serialNo); //定额排序
+                    for (let rData of rationData) {
+                        let rationGlj = allRationGlj.filter(x => x.rationID === rData.ID);
+                        priceContent.children.push(loadRation(rData, rationGlj));
+                    }
                 }
+                //清单费用组成
+                let feeContent = new FeeContent({fees: node.data.fees});
+                bills.children.push(feeContent);
             }
             return bills;
         }
@@ -1589,12 +1723,13 @@ const XMLStandard = (function () {
                         let source = {
                             code: node.data.code,
                             name: node.data.name,
-                            calcBase: node.data.calcBase,
+                            calcBase: transformCalcBase(detail, node),
                             feeRate: node.data.feeRate ? node.data.feeRate : 100,
                             fees: node.data.fees,
                             remark: node.data.remark,
                             feeType: FEE_TYPE[getNodeFlag(node)] || FEE_TYPE['0']
                         };
+                        source.calcBaseState = transformCalcBaseState(detail, source.calcBase);
                         /*if (source.feeType === '1800') {
                             debugger;
                         }*/
@@ -1700,7 +1835,8 @@ const XMLStandard = (function () {
             //添加索赔计价汇总元素
             let claimNode = detail.Bills.tree.items.find(node => getNodeFlag(node) === fixedFlag.CLAIM);
             if (claimNode && claimNode.children.length > 0) {   //必须要有子项才能显示索赔计价汇总元素
-                let claimEle = new element('索赔计价汇总', []);
+                let claimEle = new element('索赔计价汇总', [
+                    {name: '金额', value: exportKind === ExportKind.Tender ? getFee(claimNode.data.fees, 'common.totalFee') : '0'}]);
                 for (let n of claimNode.children) {
                     claimEle.children.push(new ClaimVisaFeeItem(n.data));
                 }
@@ -1709,7 +1845,9 @@ const XMLStandard = (function () {
             //添加现场签证计价汇总元素
             let visaNode = detail.Bills.tree.items.find(node => getNodeFlag(node) === fixedFlag.VISA);
             if (visaNode && visaNode.children.length > 0) {     //必须要有子项才能显示现场签证计价汇总元素
-                let visaEle = new element('现场签证计价汇总', []);
+                let visaEle = new element('现场签证计价汇总', [
+                    {name: '金额', value: exportKind === ExportKind.Tender ? getFee(visaNode.data.fees, 'common.totalFee') : '0'}
+                ]);
                 for (let n of visaNode.children) {
                     visaEle.children.push(new ClaimVisaFeeItem(n.data));
                 }
@@ -1837,7 +1975,7 @@ const XMLStandard = (function () {
                     let otherItemEle = new OtherItem({
                         code: node.data.code,
                         name: node.data.name,
-                        calcBase: node.data.calcBase,
+                        calcBase: transformCalcBase(detail, node),
                         feeRate: node.data.feeRate ? node.data.feeRate : 100,
                         commonTotalFee: totalFee,
                         notSummary: belongFlag && belongFlag === fixedFlag.MATERIAL_PROVISIONAL,   //不计入合价,只有材料(工程设备)暂估价固定节点
@@ -1876,12 +2014,13 @@ const XMLStandard = (function () {
                     code: node.data.code,
                     rowCode: `F${serialNo}`,
                     name: node.data.name,
-                    calcBase: node.data.calcBase,
+                    calcBase: transformCalcBase(detail, node),
                     feeRate: node.data.feeRate ? node.data.feeRate : 100,
                     fees: node.data.fees,
                     feeType: FEE_TYPE[getNodeFlag(node)] || FEE_TYPE['0'],
                     remark: node.data.remark
                 };
+                source.calcBaseState = transformCalcBaseState(detail, source.calcBase);
                 //序号唯一
                 checkUnique(curTenderEle.constraints.feeItemNo, source.code, '规费和税金费用项编号');
                 chargeTaxEle.children.push(new FeeItem(source));
@@ -1965,7 +2104,7 @@ const XMLStandard = (function () {
                     }
                     let gljSource = {
                         //code: glj.code,
-                        code: getGljCode(glj.glj_id),
+                        code: getGljCode(glj.id),
                         name: glj.name,
                         specs: glj.specs,
                         unit: glj.unit,
@@ -1996,8 +2135,11 @@ const XMLStandard = (function () {
                         ratioData = detail.projectGLJ.datas.mixRatioMap[connectKey];
                     if (ratioData && Array.isArray(ratioData)) {
                         for (let ratio of ratioData) {
-                            let gljRatio = new GljRatio({code: getGljCode(ratio.glj_id), quantity: ratio.consumption});
-                            gljEle.children.push(gljRatio);
+                            let pGLJ = detail.projectGLJ.datas.gljList.find(d => d.original_code === ratio.code);
+                            if (pGLJ) {
+                                let gljRatio = new GljRatio({code: getGljCode(pGLJ.id), quantity: ratio.consumption});
+                                gljEle.children.push(gljRatio);
+                            }
                         }
                     }
                     gljSummary.children.push(gljEle);

+ 49 - 25
web/building_saas/main/js/models/importStandardInterface.js

@@ -407,7 +407,7 @@ const ImportXML = (() => {
             return rationSrcs.map(rationSrc => {
                 let rationData = {
                     serialNo: serialNo++,
-                    code: getValue(rationSrc, ['_原始定额编号']),
+                    code: getValue(rationSrc, ['_原始定额编号']).replace('换', ''),
                     name: getValue(rationSrc, ['_项目名称']),
                     caption: getValue(rationSrc, ['_项目名称']),
                     unit: getValue(rationSrc, ['_单位']),
@@ -685,8 +685,8 @@ const ImportXML = (() => {
             let others = {items: arrayValue(otherSrc, ['其他', '其他列项']).map(src => {
                 let obj = {
                     type: BillsType.BILLS,
-                    code: getValue(src, ['_号']),
-                    name: getValue(src, ['_项目名称']),
+                    code: getValue(src, ['_号']),
+                    name: getValue(src, ['_名称']),
                     calcBase: getValue(src, ['_计算基础']),
                     feeRate: getValue(src, ['_费率']),
                     remark: getValue(src, ['_备注'])
@@ -760,6 +760,7 @@ const ImportXML = (() => {
                     orgCode = code;
                 }
                 let gljData = {
+                    customCode: code,   //处理自定义的代码 (有的公司定额人材机代码、人材机代码是用自动生成的代码)
                     code: orgCode,
                     original_code: orgCode,
                     name: getValue(gljSrc, ['_名称']),
@@ -803,7 +804,7 @@ const ImportXML = (() => {
         function getFlag(data) {
             return data.flags && data.flags[0] && data.flags[0].flag || 0;
         }
-        let toMatach = [
+        let toMatches = [
             {reg: /分部分项/, flag: fixedFlag.SUB_ENGINERRING},
             {reg: /^措施项目/, flag: fixedFlag.MEASURE},
             {reg: /技术措施/, flag: fixedFlag.CONSTRUCTION_TECH},
@@ -855,7 +856,7 @@ const ImportXML = (() => {
                 } else {    //匹配固定项
                     let isMatched = false;
                     //匹配固定项
-                    for (let match of toMatach) {
+                    for (let match of toMatches) {
                         if (!match.reg.test(feeBills.name)) {
                             continue;
                         }
@@ -1011,9 +1012,9 @@ const ImportXML = (() => {
             //人工
             addFixedBlock(fixedFlag.LABOUR, tenderData.other.dayWork.labour);
             //材料
-            addFixedBlock(fixedFlag.DAYWORK,tenderData.other.dayWork.material);
+            addFixedBlock(fixedFlag.MATERIAL,tenderData.other.dayWork.material);
             //机械
-            addFixedBlock(fixedFlag.DAYWORK, tenderData.other.dayWork.machine);
+            addFixedBlock(fixedFlag.MACHINE, tenderData.other.dayWork.machine);
             //总承包服务费
             addFixedBlock(fixedFlag.TURN_KEY_CONTRACT, tenderData.other.service.items, tenderData.other.service.fees);
             //索赔
@@ -1021,16 +1022,35 @@ const ImportXML = (() => {
             //签证
             addFixedBlock(fixedFlag.VISA, tenderData.other.visa.items, tenderData.other.visa.fees);
             //其他
-            if (tenderData.other.others.length) {
-                let othersParent = {
-                    ID: uuid.v1(),
-                    NextSiblingID: -1,
-                    name: '其他',
-                    fees: tenderData.other.others.fees || []
-                };
-                addFixedBlock(fixedFlag.OTHER, [othersParent]);
-                addFixedBlock(othersParent, tenderData.other.others.items);
+            if (tenderData.other.others.items.length) {
+                //特殊处理材料(工程设备暂估价)
+                let materialProIdx = tenderData.other.others.items.findIndex(item => item.name === '材料(工程设备)暂估价');
+                if (~materialProIdx) {
+                    let materialPro = tenderData.other.others.items.splice(materialProIdx, 1)[0];
+                    let fixedMaterialPro = billsTarget.find(data => getFlag(data) === fixedFlag.MATERIAL_PROVISIONAL);
+                    if (fixedMaterialPro) {
+                        fixedMaterialPro.fees = materialPro.fees;
+                        fixedMaterialPro.feeRate = materialPro.feeRate;
+                        fixedMaterialPro.calcBase = materialPro.calcBase;
+                    }
+                }
+                if (tenderData.other.others.items.length) {
+                    let othersParent = {
+                        ID: uuid.v1(),
+                        NextSiblingID: -1,
+                        name: '其他',
+                        fees: tenderData.other.others.fees || []
+                    };
+                    addFixedBlock(fixedFlag.OTHER, [othersParent]);
+                    addFixedBlock(othersParent, tenderData.other.others.items);
+                }
             }
+            //删掉有feeRate的feeRateID
+            billsTarget.forEach(data => {
+                if (data.feeRate) {
+                    data.feeRateID = null;
+                }
+            });
             function addFixedBlock(flag, items, fees = null) {
                 let fixedBills = flag;
                 if (typeof flag === 'number') {
@@ -1127,7 +1147,6 @@ const ImportXML = (() => {
                 //提取基数
                 bills.calcBase = bills.calcBase.replace(/\s/g, '');
                 let bases = bills.calcBase.split(/[\+\-\*\/]/g);
-                bases = [...new Set(bases)];
                 //提取操作符
                 let oprs = bills.calcBase.match(/[\+\-\*\/]/g);
                 //转换后的基数
@@ -1293,19 +1312,23 @@ const ImportXML = (() => {
                 mixRatio: []    //组成物
             };
             //工料机汇总code-数据映射
-            let gljCodeMap = {};
+            //let gljCodeMap = {};
+            //项目人材机customCode-原始代码数据映射
+            let projectGLJMap = {};
             //投标文件才需要导入定额等数据
             if (importFileKind === FileKind.tender) {
-                tenderData.gljSummary.forEach(data => {
-                    data.project_id = tenderData.ID;
-                    data.id = IDPlaceholder.projectGLJ++;
-                    gljCodeMap[data.code] = data;
+                tenderData.gljSummary.forEach(pGLJ => {
+                    pGLJ.project_id = tenderData.ID;
+                    pGLJ.id = IDPlaceholder.projectGLJ++;
+                    //gljCodeMap[pGLJ.code] = pGLJ;
+                    projectGLJMap[pGLJ.customCode] = pGLJ;
                 });
                 //处理项目人材机数据
                 tenderData.gljSummary.forEach(pGLJ => {
                     //组成物数据
                     pGLJ.ratios.forEach(ratio => {
-                        let matchData = gljCodeMap[ratio.code];
+                        let matchData = projectGLJMap[ratio.code];
+                        ratio.code = matchData.original_code;
                         ratio.projectGLJID = pGLJ.id; //后端查找标准数据后,方便更新组成物数据
                         ratio.id = IDPlaceholder.ratio++;
                         ratio.unit_price_file_id = tenderData.property.unitPriceFile.id;
@@ -1313,7 +1336,7 @@ const ImportXML = (() => {
                         ratio.name = matchData ? matchData.name : '';
                         ratio.specs = matchData ? matchData.specs : '';
                         ratio.type = matchData ? matchData.type : 1;
-                        ratio.connect_key = `${pGLJ.code}|-|${pGLJ.name}|-|${pGLJ.specs}|-|${pGLJ.unit}|-|${pGLJ.type}`;
+                        ratio.connect_key = [pGLJ.original_code, pGLJ.name, pGLJ.specs, pGLJ.unit, pGLJ.type].join('|-|');
                         rst.mixRatio.push(ratio);
                     });
                     delete pGLJ.ratios;
@@ -1386,9 +1409,10 @@ const ImportXML = (() => {
                         }
                         //处理定额人材机,添加需要的数据
                         ration.rationGljs.forEach(rGLJ => {
-                            let matchGLJ = gljCodeMap[rGLJ.code];
+                            let matchGLJ = projectGLJMap[rGLJ.code];
                             if (matchGLJ) {
                                 rGLJ.projectGLJID = matchGLJ.id;
+                                rGLJ.code = matchGLJ.original_code;
                                 rGLJ.type = matchGLJ.type;
                                 rGLJ.shortName = matchGLJ.shortName;
                                 rGLJ.name = matchGLJ.name;

+ 1 - 0
web/building_saas/main/js/views/project_view.js

@@ -3353,6 +3353,7 @@ $('#export-confirm').click(async function () {
             saveAs(zipFile, '重庆标准交换数据.zip');
         }
     } catch (err) {
+        console.log(err);
         alert(err);
     }
     console.log(xmlObj);