Sfoglia il codice sorgente

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

Conflicts:
	web/over_write/js/zhejiang_2005.js
zhangweicheng 6 anni fa
parent
commit
13f039e991

+ 2 - 1
config/gulpConfig.js

@@ -228,7 +228,8 @@ module.exports = {
         'web/building_saas/complementary_ration_lib/js/ration_assist.js',
         'web/building_saas/complementary_ration_lib/js/ration_installation.js.js',
         'public/web/slideResize.js',
-        'web/building_saas/complementary_ration_lib/js/coe.js'
+        'web/building_saas/complementary_ration_lib/js/coe.js',
+        'web/building_saas/complementary_ration_lib/js/init.js'
     ],
     compleRation_glj_css: [
     ],

+ 3 - 1
modules/common/const/bills_fixed.js

@@ -57,7 +57,9 @@ const fixedFlag = {
     //安全生产费
     SAFE_COST:27,
     //100章清单
-    ONE_HUNDRED_BILLS: 28
+    ONE_HUNDRED_BILLS: 28,
+    // 一二三部分合计
+    ONE_TO_THREE_TOTAL: 29,
 };
 
 export default fixedFlag;

+ 12 - 2
modules/complementary_glj_lib/models/gljModel.js

@@ -40,6 +40,16 @@ class GljDao {
             }
         }
     }
+
+    async getGLJDataSync (gljLibId, userId, compilationId) {
+        const stdGljs = await stdGljModel.find({repositoryId: gljLibId}).lean();
+        const complementaryGljs = await complementaryGljModel.find({userId, compilationId}).lean();
+        return {
+            stdGljs,
+            complementaryGljs
+        }
+    }
+
     //获得用户的补充工料机和用户当前所在编办的标准工料机
     async getGljItems (stdGljLibId, userId, compilationId, projection, callback){
         let me = this;
@@ -303,8 +313,8 @@ class GljDao {
 
     async getMixedTree(gljLibId, userId, compilationId){
         let rst = {std: [], comple: []};
-        rst.std = await gljClassModel.find({repositoryId: gljLibId});
-        rst.comple = await compleClassModel.find({userId: userId, compilationId: compilationId});
+        rst.std = await gljClassModel.find({repositoryId: gljLibId}).lean();
+        rst.comple = await compleClassModel.find({userId: userId, compilationId: compilationId}).lean();
         return rst;
     }
 }

+ 14 - 1
modules/complementary_ration_lib/controllers/compleViewController.js

@@ -6,8 +6,9 @@ import BaseController from '../../common/base/base_controller';
 import CompleViewModel from '../models/compleViewModel';
 import EngineeringLibModel from "../../users/models/engineering_lib_model";
 let config = require("../../../config/config.js");
-
 let compleViewModel = new CompleViewModel();
+import CompleRationDao from '../models/compleRationModel';
+const compleRationDao = new CompleRationDao();
 let callback = function (req, res, err, msg, data) {
     res.json({error: err, message: msg, data: data});
 };
@@ -53,6 +54,18 @@ class CompleViewController extends BaseController{
         });
     }
 
+    async prepareInitData (req, res) {
+        try {
+            const gljLibId = await getGljLibId(req.session.sessionCompilation);
+            const userId = req.session.sessionUser.id;
+            const compilationId = req.session.sessionCompilation._id;
+            const initData = await compleRationDao.prepareInitData(userId, compilationId, gljLibId);
+            res.json({error: 0, message: 'success', data: initData});
+        } catch (err) {
+            res.json({error: 1, message: 'fail', data: null});
+        }
+    }
+
     async redirectGljList(req, res){
         const gljLibId = await getGljLibId(req.session.sessionCompilation);
         const redirectRation = `/complementaryRation/ration`;

+ 27 - 17
modules/complementary_ration_lib/models/compleRationModel.js

@@ -8,8 +8,14 @@ const installSectionModel = mongoose.model("std_ration_lib_installationSection")
 const installFeeItemModel = mongoose.model("std_ration_lib_installation");
 const complementaryGljModel = mongoose.model('complementary_glj_lib');
 const stdGljModel = mongoose.model('std_glj_lib_gljList');
+const stdgljutil = require('../../../public/cache/std_glj_type_util');
+const installFacade = require('../facades/compleInstallFacade');
 import async from 'async';
 let stdRationModel = require ('../../ration_repository/models/ration_item').Model;
+import SectionTreeDao from '../models/sectionTreeModel';
+const sectionTreeDao = new SectionTreeDao();
+import GljDao from "../../complementary_glj_lib/models/gljModel";
+const gljDao = new GljDao();
 let counter = require('../../../public/counter/counter');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 let gljUtil = require('../../../public/gljUtil');
@@ -458,23 +464,27 @@ class CompleRatoinDao {
         });
     }
 
-    async getInstallation(rationRepId, callback){
-        try {
-            let feeItems = await installFeeItemModel.find({rationRepId: rationRepId, $or: [{deleted: false}, {deleted: null}]});
-            for(let feeItem of feeItems){
-                let sids = [];
-                for(let sec of feeItem.section){
-                    sids.push(sec.ID);
-                }
-                if(sids.length > 0){
-                    let sections = await installSectionModel.find({ID: {$in: sids}, $or: [{deleted: false}, {deleted: null}]});
-                    feeItem._doc.section = sections;
-                }
-            }
-            callback(0, feeItems);
-        }
-        catch(err){
-            callback(err, null);
+    async getCodes (userId, compilationId) {
+        const compleRations = await compleRationModel.find({userId, compilationId}, '-_id code').lean();
+        const codes = [];
+        compleRations.forEach(item => codes.push(item.code));
+        return codes;
+    }
+
+    async prepareInitData (userId, compilationId, gljLibId) {
+        const rationsCodes = await this.getCodes(userId, compilationId);
+        const gljDistTypeCache = stdgljutil.getStdGljTypeCacheObj().toArray();
+        const installationData = await installFacade.getInstallation(userId, compilationId);
+        const rationTreeData = await sectionTreeDao.getComplementaryTree(userId, compilationId);
+        const mixedTreeData = await gljDao.getMixedTree(gljLibId, userId, compilationId);
+        const mixedGLJData = await gljDao.getGLJDataSync(gljLibId, userId, compilationId);
+        return {
+            rationsCodes,
+            gljDistTypeCache,
+            installationData,
+            rationTreeData,
+            mixedTreeData,
+            mixedGLJData
         }
     }
 }

+ 6 - 0
modules/complementary_ration_lib/models/sectionTreeModel.js

@@ -48,6 +48,12 @@ class SectionTreeDao {
         });
 
     }
+
+    async getComplementaryTree (userId, compilationId) {
+        const treeData = await compleRationSectionTreeModel.find({userId, compilationId}).lean();
+        return treeData;
+    }
+
     async getRationTree(userId, compilationId, rationRepId, type, callback) {
         //区分要获取的是标准的数据还是补充的数据
         const rationLibType = {

+ 1 - 0
modules/complementary_ration_lib/routes/routes.js

@@ -21,6 +21,7 @@ module.exports = function (app) {
     app.get('/complementaryRation/glj', compleViewController.init, compleViewController.redirectGljList);
     app.get('/complementaryRation/coe', compleViewController.init, compleViewController.redirectCoeList);
     app.get('/complementaryRation/installation', compleViewController.init, compleViewController.redirectInstallation);
+    router.get('/initData', compleViewController.init, compleViewController.prepareInitData);
 
     router.post('/getRationLib', compleViewController.init, compleViewController.getRationLib);
     router.post('/getRationLibs', compleViewController.init, compleViewController.getRationLibs);

+ 3 - 61
web/building_saas/complementary_ration_lib/html/dinge.html

@@ -52,7 +52,8 @@
         }
     </style>
     <script>
-        let gljLibId = '<%= gljLibId %>';
+        const gljLibId = '<%= gljLibId %>';
+        const userID = '<%=userID %>';
     </script>
 </head>
 <body>
@@ -630,67 +631,8 @@
 <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_installation.js"></script>
 <script src="/public/web/slideResize.js"></script>
 <script src="/web/building_saas/complementary_ration_lib/js/coe.js"></script>
+<script src="/web/building_saas/complementary_ration_lib/js/init.js"></script>
 <!--endinject-->
-<script type="text/javascript">
-    let userID = '<%=userID %>';
-    $(document).ready(function(){
-        rationOprObj.buildSheet($("#rationItemsSheet")[0]);
-
-        // tabPanel 下有多个Spread时,相互之间不能正确显示。改成一个Spread下多个Sheet。
-        var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 4);
-        rdSpread.options.allowUserDragFill = false;
-        rdSpread.options.allowUserDragDrop = false;
-        sheetCommonObj.spreadDefaultStyle(rdSpread);
-        rationGLJOprObj.buildSheet(rdSpread.getSheet(0));
-
-        rationAssistOprObj.buildSheet(rdSpread.getSheet(1));
-
-        rationCoeOprObj.buildSheet(rdSpread.getSheet(2));
-
-        rationInstObj.buildSheet(rdSpread.getSheet(3));
-        rationInstObj.getInstallation(parseInt(getQueryString("repository")), function () {
-            //rationInstObj.buildSheet(rdSpread.getSheet(3));
-        });
-        let rdSpreadEscSheets = [];
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(0), editStarting: rationGLJOprObj.onEditStarting, editEnded: rationGLJOprObj.onCellEditEnd});
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(1), editStarting: rationAssistOprObj.onEditStarting, editEnded: rationAssistOprObj.onEditEnded});
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(2), editStarting: rationCoeOprObj.onEditStarting, editEnded: rationCoeOprObj.onEditEnded});
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(3), editStarting: rationInstObj.onEditStarting, editEnded: rationInstObj.onEditEnded});
-        sheetCommonObj.bindEscKey(rdSpread, rdSpreadEscSheets);
-        pageOprObj.initPage();
-
-        $("#linkGLJ").click(function(){
-            rationGLJOprObj.bindRationGljDelOpr();
-            rdSpread.setActiveSheetIndex(0);
-        });
-
-        $("#linkFZDE").click(function(){
-            rationAssistOprObj.bindRationAssDel();
-            rdSpread.setActiveSheetIndex(1);
-        });
-
-        $("#linkFZTJ").click(function(){
-            rationCoeOprObj.bindRationCoeDel();
-            rdSpread.setActiveSheetIndex(2);
-        });
-
-        $("#linkAZZJ").click(function(){
-            rationInstObj.bindRationInstDel();
-            rdSpread.setActiveSheetIndex(3);
-        });
-        //解决spreadjs sheet初始化没高度宽度
-        $('#modalCon').width($(window).width()*0.5);
-        $('#gljSelTreeDiv').height($(window).height() - 300);
-        $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
-        $("#gljSelSheet").width($('#modalCon').width() * 0.63);
-        $(window).resize(function () {
-            $('#modalCon').width($(window).width()*0.5);
-            $('#gljSelTreeDiv').height($(window).height() - 300);
-            $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
-            $("#gljSelSheet").width($('#modalCon').width()* 0.63);
-        });
-    });
-</script>
 </body>
 <script type="text/javascript">
     autoFlashHeight();

+ 20 - 21
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -39,28 +39,22 @@ let gljSelOprObj = {
             delete glj.ID;
         }
     },
-    getSelGljItems: function(stdGljLibId, callback) {
-        let me = this;
-        CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
-            me.stdGljList = rstData.stdGljs;
-            //兼容多单价,计算补充定额价格时,套多单价人材机的时候,默认取第一个价格
-            for(let sGlj of me.stdGljList){
-                if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined'){
-                    sGlj.basePrice = sGlj.priceProperty.price1;
-                }
-            }
-            me.complementaryGljList = rstData.complementaryGljs;
-            me.switchToGljId(me.stdGljList);
-            me.switchToGljId(me.complementaryGljList);
-            me.setProp('type', 'std', me.stdGljList);
-            me.setProp('type', 'complementary', me.complementaryGljList);
-            me.sortGlj(me.stdGljList);
-            me.sortGlj(me.complementaryGljList);
-            gljAdjOprObj.gljList = me.stdGljList.concat(me.complementaryGljList);
-            if(callback){
-                callback();
+    getSelGljItems: function(gljData) {
+        this.stdGljList = gljData.stdGljs;
+        //兼容多单价,计算补充定额价格时,套多单价人材机的时候,默认取第一个价格
+        for(let sGlj of this.stdGljList){
+            if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined'){
+                sGlj.basePrice = sGlj.priceProperty.price1;
             }
-        });
+        }
+        this.complementaryGljList = gljData.complementaryGljs;
+        this.switchToGljId(this.stdGljList);
+        this.switchToGljId(this.complementaryGljList);
+        this.setProp('type', 'std', this.stdGljList);
+        this.setProp('type', 'complementary', this.complementaryGljList);
+        this.sortGlj(this.stdGljList);
+        this.sortGlj(this.complementaryGljList);
+        gljAdjOprObj.gljList = this.stdGljList.concat(this.complementaryGljList);
     },
     initClassTree: function (type, treeData) {
         let me = this;
@@ -98,6 +92,11 @@ let gljSelOprObj = {
         };
         CommonAjax.post(url, postData, sucFunc, errFunc);
     },
+    getGljClassTree: function (mixedTreeData) {
+        this.treeData = mixedTreeData;
+        this.initClassTree('std', this.treeData.std);
+        gljSelOprObj.buildSheet($('#gljSelSheet')[0]);
+    },
     buildSheet: function (container) {
         let me = gljSelOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);

+ 79 - 0
web/building_saas/complementary_ration_lib/js/init.js

@@ -0,0 +1,79 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2019/9/24
+ * @version
+ */
+const initialization = (() => {
+    $(document).ready(function () {
+        $.bootstrapLoading.start();
+        CommonAjax.get('/complementaryRation/api/initData', {}, res => {
+            if (res.error) {
+                alert('数据初始化失败,请重试。');
+                setTimeout(() => {
+                    window.location.href = '/'
+                }, 1200);
+            } else {
+                const data = res.data;
+                pageOprObj.rationTreeData = data.rationTreeData;
+                pageOprObj.mixedTreeData = data.mixedTreeData;
+                pageOprObj.mixedGLJData = data.mixedGLJData;
+                rationGLJOprObj.distTypeTree = data.gljDistTypeCache;
+                rationOprObj.rationsCodes = data.rationsCodes;
+                rationOprObj.buildSheet($("#rationItemsSheet")[0]);
+                // tabPanel 下有多个Spread时,相互之间不能正确显示。改成一个Spread下多个Sheet。
+                var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 4);
+                rdSpread.options.allowUserDragFill = false;
+                rdSpread.options.allowUserDragDrop = false;
+                sheetCommonObj.spreadDefaultStyle(rdSpread);
+                rationGLJOprObj.buildSheet(rdSpread.getSheet(0));
+                rationAssistOprObj.buildSheet(rdSpread.getSheet(1));
+                rationCoeOprObj.buildSheet(rdSpread.getSheet(2));
+                rationInstObj.buildSheet(rdSpread.getSheet(3));
+                rationInstObj.getInstallation(data.installationData);
+                let rdSpreadEscSheets = [];
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(0), editStarting: rationGLJOprObj.onEditStarting, editEnded: rationGLJOprObj.onCellEditEnd});
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(1), editStarting: rationAssistOprObj.onEditStarting, editEnded: rationAssistOprObj.onEditEnded});
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(2), editStarting: rationCoeOprObj.onEditStarting, editEnded: rationCoeOprObj.onEditEnded});
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(3), editStarting: rationInstObj.onEditStarting, editEnded: rationInstObj.onEditEnded});
+                sheetCommonObj.bindEscKey(rdSpread, rdSpreadEscSheets);
+                pageOprObj.initPage();
+
+                $("#linkGLJ").click(function(){
+                    rationGLJOprObj.bindRationGljDelOpr();
+                    rdSpread.setActiveSheetIndex(0);
+                });
+
+                $("#linkFZDE").click(function(){
+                    rationAssistOprObj.bindRationAssDel();
+                    rdSpread.setActiveSheetIndex(1);
+                });
+
+                $("#linkFZTJ").click(function(){
+                    rationCoeOprObj.bindRationCoeDel();
+                    rdSpread.setActiveSheetIndex(2);
+                });
+
+                $("#linkAZZJ").click(function(){
+                    rationInstObj.bindRationInstDel();
+                    rdSpread.setActiveSheetIndex(3);
+                });
+            }
+            $.bootstrapLoading.end();
+        });
+        //解决spreadjs sheet初始化没高度宽度
+        $('#modalCon').width($(window).width()*0.5);
+        $('#gljSelTreeDiv').height($(window).height() - 300);
+        $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
+        $("#gljSelSheet").width($('#modalCon').width() * 0.63);
+        $(window).resize(function () {
+            $('#modalCon').width($(window).width()*0.5);
+            $('#gljSelTreeDiv').height($(window).height() - 300);
+            $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
+            $("#gljSelSheet").width($('#modalCon').width()* 0.63);
+        });
+    });
+})();

+ 0 - 22
web/building_saas/complementary_ration_lib/js/ration.js

@@ -92,7 +92,6 @@ let rationOprObj = {
         let me = rationOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
         sheetCommonObj.bindEscKey(me.workBook, [{sheet: me.workBook.getSheet(0), editStarting: me.onCellEditStart, editEnded: me.onCellEditEnd}]);
-        me.getRationsCodes(rationRepId);
         me.onContextmenuOpr();
         me.rationDelOpr();
         me.setCombo(me.workBook.getSheet(0), 'dynamic');
@@ -617,27 +616,6 @@ let rationOprObj = {
         obj.machinePrice = 0;
         obj.basePrice = 0;
     },
-    isValidUnit: function (rationObj, validUnits) {
-        let rst = true;
-        if(typeof rationObj.unit !== 'undefined' && rationObj.unit && validUnits.indexOf(rationObj.unit) === -1){//无效
-            rst = false;
-        }
-        return rst;
-    },
-    getRationsCodes: function (repId) {
-        let me = rationOprObj;
-        $.ajax({
-            type: 'post',
-            url: 'api/getRationsCodes',
-            data: {data: JSON.stringify({repId: repId})},
-            dataType: 'json',
-            success: function (result) {
-                if(!result.error){
-                    me.rationsCodes = result.data;
-                }
-            }
-        })
-    },
     mixUpdateRequest: function(updateArr, addArr, removeIds, callback) {
         let me = rationOprObj;
         me.saveInString(updateArr);

+ 9 - 30
web/building_saas/complementary_ration_lib/js/ration_glj.js

@@ -25,7 +25,6 @@ var rationGLJOprObj = {
         }
     },
     getDistTypeTree: function (gljDistType) {
-        let me = this;
         let distType;
         let distTypeTree = {
             prefix : 'gljDistType',
@@ -61,36 +60,16 @@ var rationGLJOprObj = {
         });
         return distTypeTree;
     },
-    getGljDistType: function (callback) {
-        let me = this;
-        $.ajax({
-            type: 'post',
-            url: "api/getGljDistType",
-            dataType: 'json',
-            success: function (result) {
-                if(!result.error && callback){
-                    me.distTypeTree = me.getDistTypeTree(result.data);
-                    callback();
-                }
-            }
-        })
-    },
     buildSheet: function(sheet) {
-        var me = this;
-        me.sheet = sheet;
-        me.getGljDistType(function () {
-           // gljSelOprObj.getGljClassTree(pageOprObj.gljLibId, function () {
-              //  gljSelOprObj.getSelGljItems(pageOprObj.gljLibId, function () {
-                    sheetCommonObj.initSheet(me.sheet, me.setting, 30);
-                    me.onContextmenuOpr();
-                    me.bindRationGljDelOpr();
-                    me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
-                    me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
-                    me.sheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStarting);
-                    me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
-                });
-          //  });
-        //});
+        this.sheet = sheet;
+        this.distTypeTree = this.getDistTypeTree(this.distTypeTree);
+        sheetCommonObj.initSheet(this.sheet, this.setting, 30);
+        this.onContextmenuOpr();
+        this.bindRationGljDelOpr();
+        this.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, this.onClipboardPasting);
+        this.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, this.onClipboardPasted);
+        this.sheet.bind(GC.Spread.Sheets.Events.EditStarting, this.onEditStarting);
+        this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onCellEditEnd);
     },
     onContextmenuOpr: function () {//右键菜单
         let me = this;

+ 11 - 17
web/building_saas/complementary_ration_lib/js/ration_installation.js

@@ -42,24 +42,18 @@ let rationInstObj = {
     isDef: function (v) {
         return v !== undefined && v !== null;
     },
-    getInstallation: function (callback) {
-        let me = this;
-        CommonAjax.post('api/getInstallation', {}, function (rstData) {
-            //建立name - ID 映射, ID - name 映射
-            me.feeItem = {};
-            me.IDMapping = {feeItem: {}, section: {}};
-            for(let feeItem of rstData){
-                me.feeItem[feeItem.feeItem] = {ID: feeItem.ID, section: {}};
-                me.IDMapping['feeItem'][feeItem.ID] = feeItem.feeItem;
-                for(let section of feeItem.section){
-                    me.feeItem[feeItem.feeItem]['section'][section.name] = section.ID;
-                    me.IDMapping['section'][section.ID] = section.name;
-                }
-            }
-            if(callback){
-                callback(rstData);
+    getInstallation: function (installationData) {
+        //建立name - ID 映射, ID - name 映射
+        this.feeItem = {};
+        this.IDMapping = {feeItem: {}, section: {}};
+        for(let feeItem of installationData){
+            this.feeItem[feeItem.feeItem] = {ID: feeItem.ID, section: {}};
+            this.IDMapping['feeItem'][feeItem.ID] = feeItem.feeItem;
+            for(let section of feeItem.section){
+                this.feeItem[feeItem.feeItem]['section'][section.name] = section.ID;
+                this.IDMapping['section'][section.ID] = section.name;
             }
-        });
+        }
     },
     getFeeItemCombo: function () {
         let feeItemArr = [];

+ 22 - 51
web/building_saas/complementary_ration_lib/js/section_tree.js

@@ -2,31 +2,14 @@
  * Created by Zhong on 2017/12/18.
  */
 let pageOprObj = {
-    refreshAllBooks: function () {
-        if (sectionTreeObj.workBook) {
-            sectionTreeObj.workBook.refresh();
-        }
-        if (rationOprObj.workBook) {
-            rationOprObj.workBook.refresh();
-        }
-        if (coeOprObj.workBook) {
-            coeOprObj.workBook.refresh();
-        } else {
-            pageObj.initPage();
-        }
-        if (gljAdjOprObj.workBook) {
-            gljAdjOprObj.workBook.refresh();
-        }
-        if (rationGLJOprObj.sheet.getParent()) {
-            rationGLJOprObj.sheet.getParent().refresh();
-        }
-    },
     rationLibName : null,
     rationLibId : null,
     gljLibId: gljLibId,
+    rationTreeData: null,
+    mixedTreeData: null,
+    mixedGLJData: null,
     initPage : function() {
-        let me = this;
-        sectionTreeObj.getSectionTree();
+        sectionTreeObj.getSectionTree(this.rationTreeData);
         //job
         jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
         $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
@@ -37,9 +20,8 @@ let pageOprObj = {
         $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
         $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
         annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
-        gljSelOprObj.getGljClassTree(gljLibId, function () {
-            gljSelOprObj.getSelGljItems(gljLibId);
-        });
+        gljSelOprObj.getGljClassTree(this.mixedTreeData);
+        gljSelOprObj.getSelGljItems(this.mixedGLJData);
     },
     getRationLibInfo: function (rationLibId, callback) {
         CommonAjax.post('api/getRationLib', {rationRepId: rationLibId}, callback);
@@ -223,32 +205,21 @@ let sectionTreeObj = {
             sheetCommonObj.setColumnWidthByRate($('#sectionSpread').width() - 65, this.workBook, [{rateWidth: 1}]);//65: 列头宽度和垂直滚动条宽度和
         }
     },
-    getSectionTree: function () {
-        let me = sectionTreeObj;
-        let url = 'api/getRationTree';
-        //type: 0-补充库 1-标准库
-        let postData = {type: 0};
-        let sucFunc = function (rstData) {
-            if(rstData.length > 0){
-                storageUtil.setSessionCache("RationGrp","repositoryID",rstData[0].rationRepId);
-            }
-            //init
-            me.buildSheet();
-            me.initTree(rstData);
-            me.cache = me.tree.items;
-            me.bindBtn();
-            me.initController(me.tree, me.sheet, me.setting.sheet);
-            me.controller.showTreeData();
-            me.setColor(me.cache);
-            me.sheet.setFormatter(-1, 0, '@');
-            me.initSelection(me.tree.selected);
-            me.loadRateWidth();
-            //explanatoryOprObj.bindEvents($('#explanationShow'), $('#ruleTextShow'));
-        };
-        let errFunc = function () {
-
-        };
-        CommonAjax.post(url, postData, sucFunc, errFunc);
+    getSectionTree: function (treeData) {
+        /*if(rstData.length > 0){
+            storageUtil.setSessionCache("RationGrp","repositoryID",rstData[0].rationRepId);
+        }*/
+        //init
+        this.buildSheet();
+        this.initTree(treeData);
+        this.cache = this.tree.items;
+        this.bindBtn();
+        this.initController(this.tree, this.sheet, this.setting.sheet);
+        this.controller.showTreeData();
+        this.setColor(this.cache);
+        this.sheet.setFormatter(-1, 0, '@');
+        this.initSelection(this.tree.selected);
+        this.loadRateWidth();
     },
 
     setColor: function (nodes) {
@@ -578,7 +549,6 @@ let sectionTreeObj = {
     },
     //模仿默认点击
     initSelection: function (node) {
-        node.tree.selected = node ? node : null;
         let me = this;
         if(!me.isDef(node)){
             sheetCommonObj.cleanSheet(rationOprObj.workBook.getActiveSheet(), rationOprObj.setting, -1);
@@ -588,6 +558,7 @@ let sectionTreeObj = {
             sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
             return;
         }
+        node.tree.selected = node ? node : null
         me.workBook.getActiveSheet().setActiveCell(node.serialNo(), 0);
         me.initTools(node);
         me.refreshBtn(node);

+ 106 - 70
web/building_saas/main/js/models/calc_base.js

@@ -427,67 +427,79 @@ let cbTools = {
     //@param {Number}baseFee(相关基数金额) {String}name(使用累进计算的基数名称)
     //@return {Number}
     getProgressiveFee: function (baseFee, name) {
-        let progressiveData = calcBase.project.property.progressiveInterval;
+        const progressiveData = calcBase.project.property.progressiveInterval;
         if (!progressiveData) {
             throw '该项目不存在累进区间数据';
         }
-        let matchData = _.find(progressiveData, function (data) {
-            //根据基数名称匹配累进库数据,标准化以免(())等不同导致不匹配
-            return cbAnalyzer.standar(data.name) === cbAnalyzer.standar(name);
-        });
-        if (!matchData) {
-            //return 0;
+        //根据基数名称匹配累进库数据,标准化以免(())等不同导致不匹配
+        const matchProgressiveData = progressiveData.find(item => cbAnalyzer.standar(item.name) === cbAnalyzer.standar(name));
+        if (!matchProgressiveData) {
             throw `计算基数{${name}}不存在累进区间数据`;
         }
-        let progression = matchData.progression;
-        //获取区间中的最小值(0, 10] = 0
-        function getMin(intervalStr) {
-            let str = cbAnalyzer.standar(intervalStr);
-            let match = /\((\d+)?/g.exec(str);
-            return typeof match[1] !== 'undefined' ? parseFloat(match[1]) * 10000 : null; //后台数据单位为万元,这里转为为元
-        }
-        //获取区间中的最大值(0, 10] = 10
-        function getMax(intervalStr) {
-            let str = cbAnalyzer.standar(intervalStr);
-            let match = /[\,,,](\d+)?/g.exec(str);
-            return typeof match[1] !== 'undefined' ? parseFloat(match[1]) * 10000 : null
-        }
-        //将累进区间进行排序
-        progression.sort(function (a, b) {
-           let aV = getMin(a.interval),
-               bV = getMin(b.interval);
-           if (aV > bV) {
-               return 1;
-           } else if (aV < bV) {
-               return -1;
-           }
-           return 0;
+        // 将原始数据转换成方便处理的数据:[{feeRate: xx, min: 0, max: 200, minOpr: '(', maxOpr: ']'}]
+        const progression = matchProgressiveData.progression.map(item => {
+            // item.interval内容: eg (0,200]、[300,500) [1000,+)....
+            const interval = cbAnalyzer.standar(item.interval);
+            // ( => 大于 [ => 大于等于 ) => 小于 ] => 小于等于
+            const minReg = /([\(\[])(\d+)/;
+            const minMatch = minReg.exec(interval);
+            if (!minMatch || !minMatch[1] || !minMatch[2]) {
+                throw `计算基数{${name}}累进区间数据错误`;
+            }
+            const minOpr = minMatch[1];
+            // 后台数据单位为万元,这里转为为元
+            const min = parseFloat(minMatch[2]) * 10000;
+            const maxReg = /[\,,]([\d\+]+)([\)\]])/;
+            const maxMatch = maxReg.exec(interval);
+            if (!maxMatch || !maxMatch[1] || !maxMatch[2]) {
+                throw `计算基数{${name}}累进区间数据错误`;
+            }
+            const max = maxMatch[1] === '+' ? 'infinity' : parseFloat(maxMatch[1]) * 10000;
+            const maxOpr = maxMatch[2];
+            return {
+                feeRate: item.feeRate,
+                min,
+                minOpr,
+                max,
+                maxOpr
+            }
         });
-        //累进计算
-        let fee = 0;
-        //找到所在区间
-        let within = _.find(progression, function (data) {
-            let min = getMin(data.interval),
-                max = getMax(data.interval);
-            return min !== null && baseFee > min  && (max !== null && baseFee <= max || max === null);
+        progression.sort((a, b) => a.min - b.min);
+        // 基数所在区间
+        const withinData = progression.find(item => {
+            const oprMiddle = item.max === 'infinity' ? '+' : '';
+            const oprLink = item.minOpr + oprMiddle + item.maxOpr;
+            switch (oprLink) {
+                case '()':
+                    return baseFee > item.min && baseFee < item.max;
+                case '(]':
+                    return baseFee > item.min && baseFee <= item.max;
+                case '[)':
+                    return baseFee >= item.min && baseFee < item.max;
+                case '[]':
+                    return baseFee >= item.min && baseFee <= item.max;
+                case '(+)':
+                case '(+]':
+                    return baseFee > item.min;
+                case '[+)':
+                case '[+]':
+                    return baseFee >= item.min;
+                default:
+                    return false;
+            }
         });
-        if (!within) {
+        if (!withinData) {
             return 0;
         }
+        // 累进计算
+        let fee = 0;
         //累进之前的区间
-        for (let i = 0; i < progression.indexOf(within); i++) {
-            let perData = progression[i],
-                min = getMin(perData.interval),
-                max = getMax(perData.interval);
-            if (min !== null && max !== null) {
-                fee += (max - min) * perData.feeRate * 0.01;
-            }
+        for (let i = 0; i < progression.indexOf(withinData); i++) {
+            const perData = progression[i];
+            fee += (perData.max - perData.min) * perData.feeRate * 0.01;
         }
         //累进所在区间
-        let min = getMin(within.interval);
-        if (min !== null) {
-            fee += (baseFee - min) * within.feeRate * 0.01;
-        }
+        fee += (baseFee - withinData.min) * withinData.feeRate * 0.01;
         return fee.toDecimal(decimalObj.bills.totalPrice);
     },
     //获取清单100章下的节点(只需要找最底层的,排除了底层,父项金额即排除了子项)
@@ -718,107 +730,125 @@ let baseFigureMap = {
     'budget': {
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '定额建筑安装工程费(不含定额设备购置费及专项费用)': {
-            base: 'DEJZAZGCFBHSBZX', fixedFlag: null,
+            base: 'DEJZAZGCFBHSBZX',
+            fixedFlag: null,
             filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         '定额建筑安装工程费(其中定额设备购置费按40%计)': {
-            base: 'DEJZAZGCSBSS', fixedFlag: null,
+            base: 'DEJZAZGCSBSS',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“安全生产费”
         '建筑安装工程费(不含安全生产费)': {
-            base: 'JZAZGCFBHSC', fixedFlag: null,
+            base: 'JZAZGCFBHSC',
+            fixedFlag: null,
             filter: [fixedFlag.SAFE_COST],
             pick: true
         },
         //只允许固定类别是“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '建筑安装工程费(不含设备费)': {
-            base: 'JZAZGCFBHSB', fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
+            base: 'JZAZGCFBHSB',
+            fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许非固定类别是“建筑安装工程费”下的清单引用
         '建筑安装工程费': {
-            base: 'JZAZGCF', fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
+            base: 'JZAZGCF',
+            fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
             filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
             pick: false
         },
         //只允许非固定类别是“建筑安装工程费”、非固定类别是“土地使用及拆迁补偿费”下的清单引用
         '土地使用及拆迁补偿费': {
-            base: 'TDSYJCQBCF', fixedFlag: fixedFlag.LAND_USED_DEMOLITION,
+            base: 'TDSYJCQBCF',
+            fixedFlag: fixedFlag.LAND_USED_DEMOLITION,
             filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION],
             pick: false,
         },
         //只允许非固定类别是“建筑安装工程费”、非固定类别是“土地使用及拆迁补偿费”、非固定类别是“养护工程其他费”下的清单引用
         '养护工程其他费': {
-            base: 'YHGCQTF', fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
+            base: 'YHGCQTF',
+            fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
             filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: false
         },
         //只允许非固定类别是“建筑安装工程费”、非固定类别是“土地使用及拆迁补偿费”、非固定类别是“养护工程其他费”、非固定类别是“预备费”下的清单引用。
         '预备费': {
-            base: 'YBF', fixedFlag: fixedFlag.BUDGET_FEE,
+            base: 'YBF',
+            fixedFlag: fixedFlag.BUDGET_FEE,
             filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES, fixedFlag.BUDGET_FEE],
             pick: false
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '施工场地建设费': {
-            base: 'SGCDJSF', fixedFlag: null,
+            base: 'SGCDJSF',
+            fixedFlag: null,
             filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '养护单位(业主)管理费': {
-            base: 'YHDWYZGLF', fixedFlag: null,
+            base: 'YHDWYZGLF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '信息化费': {
-            base: 'XXHF', fixedFlag: null,
+            base: 'XXHF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '路线工程监理费': {
-            base: 'LXGCJLF', fixedFlag: null,
+            base: 'LXGCJLF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '独立桥梁隧道工程监理费': {
-            base: 'QLSDGCJLF', fixedFlag: null,
+            base: 'QLSDGCJLF',
+            fixedFlag: null,
             filter: [ fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '设计文件审查费': {
-            base: 'SJWJSCF', fixedFlag: null,
+            base: 'SJWJSCF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '路线勘察设计费': {
-            base: 'LXKCSJF', fixedFlag: null,
+            base: 'LXKCSJF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '独立桥梁隧道维修加固勘察设计费': {
-            base: 'QLSDKCSJF', fixedFlag: null,
+            base: 'QLSDKCSJF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         '招标代理及标底(最高投标限价)编制费': {
-            base: 'ZBDLJBDBZF', fixedFlag: null,
+            base: 'ZBDLJBDBZF',
+            fixedFlag: null,
             filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
         },
         //只允许固定类别是“价差预备费”的清单使用
         '价差预备费': {
-            base: 'JCYBF', fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
+            base: 'JCYBF',
+            fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
             filter: [fixedFlag.SPREAD_BUDGET_FEE],
             pick: true
         }
@@ -829,12 +859,16 @@ let baseFigureMap = {
     * */
     'boq': {
         //仅允许用于固定类别是“第100章至700章清单”以外的清单
-        '各章清单合计': {base: 'GZQDHJ', fixedFlag: fixedFlag.ONE_SEVEN_BILLS,
+        '各章清单合计': {
+            base: 'GZQDHJ',
+            fixedFlag: fixedFlag.ONE_SEVEN_BILLS,
             filter: [fixedFlag.ONE_SEVEN_BILLS],
             pick: false
         },
         //仅允许用于固定类别是“第100章至700章清单”以外的清单
-        '专项暂定合计': {base: 'ZXZDHJ', fixedFlag: null,
+        '专项暂定合计': {
+            base: 'ZXZDHJ',
+            fixedFlag: null,
             filter: [fixedFlag.ONE_SEVEN_BILLS],
             pick: false
         },
@@ -843,7 +877,9 @@ let baseFigureMap = {
         *  因此{100章以外合计}不设置关联的清单固定行
         * */
         //仅允许用于固定类别为“100章清单”引用
-        '100章以外清单合计': {base: 'YBZYHQDHJ', fixedFlag: null,
+        '100章以外清单合计': {
+            base: 'YBZYHQDHJ',
+            fixedFlag: null,
             filter: [fixedFlag.ONE_HUNDRED_BILLS],
             pick: true
         },

+ 3 - 1
web/building_saas/main/js/models/main_consts.js

@@ -266,7 +266,9 @@ const fixedFlag = {
     //安全生产费
     SAFE_COST:27,
     //100章清单
-    ONE_HUNDRED_BILLS: 28
+    ONE_HUNDRED_BILLS: 28,
+    // 一二三部分合计
+    ONE_TO_THREE_TOTAL: 29,
 };
 
 const gljKeyArray =['code','name','specs','unit','type'];

+ 59 - 0
web/over_write/js/neimeng_2019.js

@@ -0,0 +1,59 @@
+/**
+ * Created by CSL on 2019/09/23.  内蒙计算程序、基数 等覆盖。
+ */
+
+let isNM2019 = true;
+
+function overwriteRationCalcBases (){
+    if (typeof rationCalcBases == 'undefined') return;
+    for (let key in rationCalcBases) delete rationCalcBases[key];
+
+    rationCalcBases['人工费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['材料费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['施工机械使用费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['定额人工费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额材料费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额施工机械使用费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptBasePrice, isTender);
+    };
+};
+
+(function overwriteFeeTypes() {
+    if (typeof cpFeeTypes == 'undefined') return;
+    cpFeeTypes = [
+        {type: 'direct', name: '直接费'},
+        {type: 'labour', name: '人工费'},
+        {type: 'material', name: '材料费'},
+        {type: 'machine', name: '施工机械使用费'},
+        {type: 'rDirect', name: '定额直接费'},
+        {type: 'rLabour', name: '定额人工费'},
+        {type: 'rMaterial', name: '定额材料费'},
+        {type: 'rMachine', name: '定额施工机械使用费'},
+        {type: 'measure', name: '措施费'},
+        {type: 'manage', name: '企业管理费'},
+        {type: 'force', name: '规费'},
+        {type: 'profit', name: '利润'},
+        {type: 'tax', name: '税金'},
+        {type: 'safeProduce', name: '安全生产费'},
+        {type: 'common', name: '建筑安装工程费'},
+        {type: 'rCommon', name: '定额建筑安装工程费'}
+    ];
+})();
+
+
+
+
+
+
+
+

+ 102 - 2
web/over_write/js/zhejiang_2005.js

@@ -1,5 +1,5 @@
 /**
- * Created by CSL on 2019/09/11.  江西计算程序、基数 等覆盖。
+ * Created by CSL on 2019/09/11.  江计算程序、基数 等覆盖。
  */
 
 let isZJ2005 = true;
@@ -16,7 +16,7 @@ function overwriteRationCalcBases (taxType){
     rationCalcBases['材料费'] = function (node, isTender) {
         return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender);
     };
-    rationCalcBases['施工机械使用费'] = function (node, isTender) {
+    rationCalcBases['施工机械使用费'] = function (node, isTender) {
         return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender);
     };
 };
@@ -39,8 +39,108 @@ function overwriteRationCalcBases (taxType){
     ];
 })();
 
+<<<<<<< HEAD
 if(typeof gljUtil !== 'undefined'){
     gljUtil.getCodeSortMath = getCodeSortMath
+=======
+// 清单基数,工程量清单的基数没有变化,只修改预算的
+if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
+    baseFigureMap.budget = {
+        // 除清单固定类别是“建筑安装工程费”的以外部分可显示
+        '公路养护工程费': {
+            base: 'GLYHGCF',
+            fixedFlag: fixedFlag.CONSTRUCTION_INSTALL_FEE,
+            filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE],
+            pick: false,
+        },
+        // 除清单固定类别是“建筑安装工程费”、“设备购置费”的以外部分可显示
+        '设备购置费用': {
+            base: 'SBGZFY',
+            fixedFlag: fixedFlag.EQUIPMENT_ACQUISITION_FEE,
+            filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.EQUIPMENT_ACQUISITION_FEE],
+            pick: false,
+        },
+        // 除清单固定类别是“建筑安装工程费”、“设备购置费”、“养护工程其他费用”的以外部分可显示
+        '公路养护工程其他费用': {
+            base: 'GLYHGCQTFY',
+            fixedFlag: fixedFlag.MAINTENANCE_EXPENSES,
+            filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.EQUIPMENT_ACQUISITION_FEE, fixedFlag.MAINTENANCE_EXPENSES],
+            pick: false,
+        },
+        // 只有清单固定类别是“养护工程其他费用”部分可显示
+        '养护工程管理经费': {
+            base: 'YHGCGLJF',
+            fixedFlag: null,
+            filter: [fixedFlag.MAINTENANCE_EXPENSES],
+            pick: true,
+        },
+        // 除清单固定类别是“建筑安装工程费”、“设备购置费”、“养护工程其他费用”、“一二三部分合计”的以外部分可显示
+        '一二三部分合计': {
+            base: 'YESBFHJ',
+            fixedFlag: fixedFlag.ONE_TO_THREE_TOTAL,
+            filter: [fixedFlag.CONSTRUCTION_INSTALL_FEE, fixedFlag.EQUIPMENT_ACQUISITION_FEE, fixedFlag.MAINTENANCE_EXPENSES, fixedFlag.ONE_TO_THREE_TOTAL],
+            pick: false,
+        },
+        // 只有清单固定类别是“预备费”部分可显示
+        '工程造价增涨预留费': {
+            base: 'GCZJZZYLF',
+            fixedFlag: null,
+            filter: [fixedFlag.BUDGET_FEE],
+            pick: true,
+
+        }
+    }
+}
+// 清单基数,工程量清单的基数没有变化,只修改预算的
+if (typeof baseFigureTemplate !== 'undefined' && baseFigureTemplate.budget) {
+    baseFigureTemplate.budget = {
+        // 公路养护工程费:取清单固定类别是“建筑安装工程费”的金额
+        GLYHGCF(tender) {
+            const feeField = 'common';
+            const subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
+            return cbTools.getBillsFee(calcBase.fixedFlag.CONSTRUCTION_INSTALL_FEE, feeField, subFeeField);
+        },
+        // 设备购置费用:取清单固定类别是“设备购置费”的金额
+        SBGZFY(tender) {
+            const feeField = 'common';
+            const subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
+            return cbTools.getBillsFee(calcBase.fixedFlag.EQUIPMENT_ACQUISITION_FEE, feeField, subFeeField);
+        },
+        // 公路养护工程其他费用:取清单固定类别是“养护工程其他费用”的金额。
+        GLYHGCQTFY(tender) {
+            const feeField = 'common';
+            const subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
+            return cbTools.getBillsFee(calcBase.fixedFlag.MAINTENANCE_EXPENSES, feeField, subFeeField);
+        },
+        // 养护工程管理经费:取清单固定类别是“建筑安装工程费”金额为基数,采用累进办法计算
+        YHGCGLJF(tender) {
+            const baseFee = this['GLYHGCF'](tender);
+            return cbTools.getProgressiveFee(baseFee, '养护工程管理费');
+        },
+        // 一二三部分合计:取清单固定类别是“一二三部分合计”的金额
+        YESBFHJ(tender) {
+            const feeField = 'common';
+            const subFeeField = tender ? 'tenderTotalFee' : 'totalFee';
+            return cbTools.getBillsFee(calcBase.fixedFlag.ONE_TO_THREE_TOTAL, feeField, subFeeField);
+        },
+        // 工程造价增涨预留费:以{公路养护工程费}为基数,= P * [(1+i)^(n-1) -1]
+        // P:公路养护工程费总额(元)
+        // i:年造价增长率(%)(项目属性已有字段)
+        // N:增涨计费年限(项目属性已有字段)
+        GCZJZZYLF(tender) {
+            const baseFee = this['GLYHGCF'](tender);
+            //年造价增涨
+            const costGrowthRate = calcBase.project.property.costGrowthRate
+                ? calcBase.project.property.costGrowthRate
+                : 0;
+            //增涨计费年限
+            const growthPeriod = projectObj.project.property.growthPeriod
+                ? calcBase.project.property.growthPeriod
+                : 0;
+            return (baseFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
+        }
+    };
+>>>>>>> 80e8fe33e0df952bcebe60ae109f467c547f0ad5
 }