Просмотр исходного кода

导出接口 定值权重A值问题
自检没错的时候,弹出相关窗口

zhongzewei 6 лет назад
Родитель
Сommit
33ba65774f

+ 10 - 11
web/building_saas/main/js/models/exportStandardInterface.js

@@ -139,9 +139,9 @@ const XMLStandard = (function () {
     let _base = XML_EXPORT_BASE,
         _config = _base.CONFIG,
         _util = _base.UTIL,
-        _cache = _base.CACHE,
-        _failList = _cache.getItem('failList');
+        _cache = _base.CACHE;
     return function (userID, granularity, exportKind) {
+        let _failList = _cache.getItem('failList');
         //默认导出建设项目
         if (!granularity || ![1, 2, 3].includes(granularity)) {
             granularity = _config.GRANULARITY.PROJECT;
@@ -790,9 +790,9 @@ const XMLStandard = (function () {
             XML_EXPORT_BASE.Element.call(this, '承包人材料差额法明细', attrs);
         }
         //承包人材料指数法表
-        function ExponentialGlj() {
+        function ExponentialGlj(fixedWeight) {
             let attrs = [
-                {name: '定值权重A', value: '', required: true, type: _config.TYPE.DECIMAL}
+                {name: '定值权重A', value: fixedWeight, required: true, type: _config.TYPE.DECIMAL}
             ];
             XML_EXPORT_BASE.Element.call(this, '承包人材料指数法表', attrs);
         }
@@ -1150,14 +1150,14 @@ const XMLStandard = (function () {
                         let ecTotalFee = _util.getFee(engineeringCostNode.data.fees, 'common.totalFee');
                         let exponentialGljs = materialAdjustObj.getPriceCoeDatas(tenderDetail.projectGLJ.datas.gljList, ecTotalFee);
                         if (exponentialGljs.length) {
-                            let exP = new ExponentialGlj();
-                            //权重B累加
-                            let totalVarWeight = 0;
+                            // 变值权重B累加
+                            let totalVarWeight = exponentialGljs.reduce((acc, cur) => acc += cur.varWeight || 0, 0);
+                            // 如果采用指数法,定值权重A = 1 - 变值权重B累加。如果不是指数法,取1
+                            let fixedWeight = adjustType === _config.ADJUST_TYPE.coe ? 1 - totalVarWeight : '1';
+                            let exP = new ExponentialGlj(fixedWeight);
                             exponentialGljs.forEach(data => {
-                                totalVarWeight += data.varWeight || 0;
                                 exP.children.push(new ExponentialGljDetail(adjustType, data));
                             });
-                            exP.attrs.find(attr => attr.name === '定值权重A').value = adjustType === _config.ADJUST_TYPE.coe ? 1 - totalVarWeight : '1';
                             tender.children.push(exP);
                         }
                     }
@@ -2034,7 +2034,7 @@ const XMLStandard = (function () {
         this.transformData = async function (tenderID, curExportKind) {
             if (curExportKind) {
                 // 更新缓存中的导出文件类型
-                _cache.setItem('exportKind', +curExportKind);
+                //_cache.setItem('exportKind', +curExportKind);
                 exportKind = parseInt(curExportKind);
             }
             let eleData = await loadProject(tenderID);
@@ -2043,7 +2043,6 @@ const XMLStandard = (function () {
             if (!eleData) {
                 return;
             }
-            console.log(this.datas);
             this.originalDatas.push({data: this.datas, fileName: `重庆标准交换数据(${FILE_KIND[exportKind]}).QTF`});
         };
     }

+ 7 - 5
web/building_saas/main/js/views/export_view.js

@@ -10,8 +10,7 @@
 //导出接口相关
 const ExportView = (() => {
     let _base = XML_EXPORT_BASE,
-        _cache = _base.CACHE,
-        _failList = _cache.getItem('failList');
+        _cache = _base.CACHE;
     let xmlObj = null;
     //设置工程编号表格数据设置
     const sheetSetting = {
@@ -62,6 +61,7 @@ const ExportView = (() => {
     function exportListener() {
         //导出接口-项目自检
         $('#export-check').click(async function () {
+            let failList = _cache.getItem('failList');
             let checkedDatas = $('#export input[type="checkbox"]:checked');
             if (!checkedDatas.length) {
                 return;
@@ -81,11 +81,13 @@ const ExportView = (() => {
                     }
                 }
                 //设置提示弹窗
-                if (_failList.length * 20 > 400) {
+                if (failList.length * 20 > 400) {
                     $('#hintBox_caption').addClass('export-check');
                 }
-                if (_failList.length) {
-                    throw _failList.join('<br/>');
+                if (failList.length) {
+                    throw failList.join('<br/>');
+                } else {
+                    throw '自检完成,未检测到错误数据。'
                 }
             } catch (err) {
                 alert(err);

+ 1 - 1
web/building_saas/main/js/views/material_adjust_view.js

@@ -42,7 +42,7 @@ let materialAdjustObj = {
             {headerName: "供货方式", headerWidth: 70, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
             {headerName: "备注", headerWidth: 100, dataCode: "remark", hAlign: "left", dataType: "String"}
         ],
-        view:{ lockColumns: ["code","name","specs","unit","quantity","totalPrice","originPlace","vender","supply","remark"]}
+        view:{ lockColumns: ["code","name","specs","unit","quantity","totalPrice","originPlace","varWeight","vender","supply","remark"]}
     },
     refreshSheetDatas:function () {
         //读项目属性的值,若没有则默认为造价信息差额调整法