Sfoglia il codice sorgente

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

TonyKang 5 anni fa
parent
commit
b7be060aff

+ 1 - 0
config/gulpConfig.js

@@ -18,6 +18,7 @@ module.exports = {
         'public/web/commonAlert.js',
         'public/web/headerOpr.js',
         'public/common_util.js',
+        'public/common_constants.js',
         'lib/jquery-editable-select/jquery.editable-select.min.js'
     ],
     common_css:[

+ 1 - 1
modules/main/controllers/bills_controller.js

@@ -12,7 +12,7 @@ let raiton_facade = require("../facade/ration_facade");
 let stdBillsModel = mongoose.model('std_bills_lib_bills');
 let stdBillJobsModel = mongoose.model('std_bills_lib_jobContent');
 let stdBillCharacterModel = mongoose.model('std_bills_lib_itemCharacter');
-import fixedFlag from  '../../common/const/bills_fixed';
+const { fixedFlag } = require('../../../public/common_constants');
 let LZString = require('lz-string');
 const uuidV1 = require('uuid/v1');
 const billType ={

+ 66 - 12
modules/main/facade/project_facade.js

@@ -32,7 +32,8 @@ const gljUtil = require('../../../public/gljUtil');
 let stdColSettingModel = mongoose.model('std_main_col_lib');
 let decimal_facade = require('../../main/facade/decimal_facade');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
-import fixedFlag from  '../../common/const/bills_fixed';
+const calcUtil = require('../../../public/calculate_util')
+const { fixedFlag } = require('../../../public/common_constants');
 import GLJListModel from "../../glj/models/glj_list_model";
 const projectDao = require('../../pm/models/project_model').project;
 
@@ -287,13 +288,14 @@ async function getDefaultColSetting(libID){
     return await stdColSettingModel.findOne({ID: libID, deleted: false}, '-_id main_tree_col');
 }
 
-async function getBudgetSummayDatas(projectIDs){
+async function getBudgetSummayDatas(projectIDs,overWriteUrl){
     try {
         let projects = [];
         let names = [];
         let prjTypeNames = [];
         let compilationScopes = [];
         let decimal = null;
+        let isProgressiveType = false;
         for(let ID of projectIDs){
             projects.push(await getBillsByProjectID(ID)) ;
         }
@@ -309,9 +311,11 @@ async function getBudgetSummayDatas(projectIDs){
             names.push(projects[i].name);
             prjTypeNames.push(projects[i].prjTypeName);
             compilationScopes.push(projects[i].compilationScope);
-            decimal = await mergeProject(mp.roots,projects[i].roots)
+            decimal = await mergeProject(mp.roots,projects[i].roots);
+            if(projects[i].progressiveType == 0)  isProgressiveType = true;
         }
-        let SummaryAuditDetail = getReportData(names,mp.roots,prjTypeNames,compilationScopes,decimal);
+
+        let SummaryAuditDetail = getReportData(names,mp.roots,prjTypeNames,compilationScopes,decimal,isProgressiveType,mp.progressiveInterval,overWriteUrl);
         let parentProject = await projectsModel.findOne({ID:mp.ParentID});
         let result = {
             prj: {},
@@ -330,9 +334,23 @@ async function getBudgetSummayDatas(projectIDs){
 }
 
 
-function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal) {
+function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal,isProgressiveType,progressiveInterval,overWriteUrl) {
     let datas = [],totalItem = null;
+    let overWrite = null;
+    if(overWriteUrl && overWriteUrl!=""){
+      overWrite = require("../../.."+compilation.overWriteUrl);
+    }
     setChildrenDatas(items,datas);
+    let totalExp = totalItem.calcBase;
+    if(isProgressiveType&&progressiveInterval){
+      for(let t of datas){
+        totalExp.replace(t.ID,t.billsTtlPrice+"");
+      }
+      totalExp.replace(/@/g,"");
+      let nTotal = eval(totalExp);
+      totalItem.billsTtlPrice = scMathUtil.roundForObj(nTotal,decimal.bills.totalPrice);
+    }
+
     for(let d of datas){
         if(d.billsTtlPrice&&totalItem.billsTtlPrice){
             d['各项费用比例'] = scMathUtil.roundForObj(d.billsTtlPrice/totalItem.billsTtlPrice * 100,2)
@@ -340,19 +358,31 @@ function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal) {
         d['prjNames'] = nameList;
         d['prjTypeNames'] = prjTypeNames;
         d['编制范围明细'] = compilationScopes;
+        
     }
+   
+
     return datas;
 
 
-    function setChildrenDatas(children,arr,level = 0) {
+    function setChildrenDatas(children,arr,level = 0,rootFlag) {
+        let temTotalPrice = 0;
         for(let c of children){
-            arr.push(getBillDatas(c,level));
-            setChildrenDatas(c.children,arr,level+1);
+            if(level == 0) rootFlag = c.flag;//取最顶层节点的固定清单类别
+            let sumChildren = setChildrenDatas(c.children,arr,level+1,rootFlag);
+            let tbill = getBillDatas(c,level,rootFlag);
+            if(isProgressiveType && progressiveInterval && rootFlag == fixedFlag.MAINTENANCE_EXPENSES){//如果要累进的,父节点要重新汇总
+              if(level>0) temTotalPrice = scMathUtil.roundForObj(tbill.billsTtlPrice + temTotalPrice,decimal.bills.totalPrice); 
+              if(c.children.length > 0) tbill.billsTtlPrice = sumChildren;
+            }
+            arr.push(tbill);
         }
+        return temTotalPrice
     }
 
-    function getBillDatas(bills,level) {
+    function getBillDatas(bills,level,rootFlag) {
         let tem = {
+            ID:bills.ID,
             billsName:bills.name,
             billsCode:bills.code,
             billsUnit:bills.unit,
@@ -367,10 +397,12 @@ function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal) {
         };
         let total = 0;
         let rationTotal =0;
+        let baseTotal = 0;
         for(let n of nameList){
             let  p = 0;//金额
             let up =0;//单价
             let ra = 0;//定额建安费
+            let bt = 0; //累计相关
             if(bills.unitPrices[n]) up = scMathUtil.roundForObj(bills.unitPrices[n],decimal.bills.unitPrice);
             tem.billsUnitPrices.push(up);
             if(bills.prices[n]){
@@ -390,8 +422,22 @@ function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal) {
                 tem.billsAmounts.push(0);
                 tem['技术经济指标'].push(scMathUtil.roundForObj(p,2));
             }
+            if(rootFlag == fixedFlag.MAINTENANCE_EXPENSES){//如果是第三部分下的子清单,才要计算累计的相关信息
+              if(bills.baseProgressiveFees[n]){
+                bt =  scMathUtil.roundForObj(bills.baseProgressiveFees[n],decimal.bills.totalPrice);
+                baseTotal = scMathUtil.roundForObj(bt+baseTotal,decimal.process);
+              }
+            }
+        }
+        if(progressiveInterval && isProgressiveType&&calcUtil.isProgressive(bills.calcBase,overWrite?overWrite.progression:undefined) && rootFlag == fixedFlag.MAINTENANCE_EXPENSES){
+          let calcTotal = calcUtil.getProgressiveFee(baseTotal,bills.calcBase,progressiveInterval,decimal.bills.totalPrice,overWrite?overWrite.deficiency:undefined);
+          tem.billsTtlPrice = calcTotal;
+          let rate =  scMathUtil.roundForObj(calcTotal * 100/baseTotal,decimal.feeRate);
+          tem.billsMemos = "费率:"+rate+"%"; 
+          //“费率:n%”,n为汇总后重算的金额/汇总后的基数
+        }else{
+          tem.billsTtlPrice = scMathUtil.roundForObj(total,decimal.bills.totalPrice);
         }
-        tem.billsTtlPrice = scMathUtil.roundForObj(total,decimal.bills.totalPrice);
         tem.rationTotal =  scMathUtil.roundForObj(rationTotal,decimal.bills.totalPrice);//定额总建安费
         tem['技术经济综合指标'] = (tem.billsTtlAmt && parseFloat(tem.billsTtlAmt) !== 0)?scMathUtil.roundForObj(tem.billsTtlPrice/tem.billsTtlAmt,2):scMathUtil.roundForObj(tem.billsTtlPrice,2);
         if(bills.flag == fixedFlag.TOTAL_COST) totalItem = tem;
@@ -427,6 +473,7 @@ async function mergeItem(a,b,decimal,project) {
         a.rationCommons[name] = b.rationCommons[name];
         a.quantityMap[name] = b.quantityMap[name];
         a.unitPrices[name]=b.unitPrices[name];
+        a.baseProgressiveFees[name] = b.baseProgressiveFees[name];
     }
     for(let name in a.quantityMap){
         a.quantityMap[name] = a.quantityMap[name]?scMathUtil.roundForObj(a.quantityMap[name],bqDecimal):0;
@@ -513,6 +560,8 @@ async function getBillsByProjectID(projectID){
     let auditor='';//审核人
     let compilationScope='';//编制范围
     let engineering='';//养护类别
+    let progressiveType = 0;//累进计算类型
+    let progressiveInterval = null;
     if(project.property&&project.property.projectFeature){
         for(let f of project.property.projectFeature){
             if(f.key == 'author') author = f.value;
@@ -520,6 +569,8 @@ async function getBillsByProjectID(projectID){
             if(f.key =='compilationScope') compilationScope = f.value;
             if(f.key == 'engineering') engineering = f.value;
         }
+        if(project.property.progressiveType) progressiveType = project.property.progressiveType;
+        progressiveInterval = project.property.progressiveInterval;
     }
    for(let b of  bills){
        let commonFee =_.find(b._doc.fees,{"fieldName":"common"});
@@ -527,13 +578,16 @@ async function getBillsByProjectID(projectID){
        let quantityMap={};
        let unitPrices ={};
        let rationCommons={};
+       let baseProgressiveFees ={};
        let rationFee = _.find(b._doc.fees,{"fieldName":"rationCommon"});
        if(commonFee&&commonFee.totalFee) prices[projectName] =  commonFee.totalFee;
        if(commonFee&&commonFee.unitFee) unitPrices[projectName] = commonFee.unitFee;
        if(rationFee&&rationFee.totalFee) rationCommons[projectName] = rationFee.totalFee;
+       baseProgressiveFees = baseProgressiveFees[projectName] = b.baseProgressiveFee;
+
        quantityMap[projectName] = b.quantity;
        let flagIndex = _.find(b._doc.flags,{'fieldName':'fixed'});
-       let doc = {ID:b.ID,name:b.name,code:b.code,unit:b.unit,projectID:b.projectID, ParentID:b.ParentID,NextSiblingID:b.NextSiblingID,unitPrices:unitPrices,quantity:b.quantity,prices:prices,rationCommons:rationCommons,quantityMap:quantityMap,flag:flagIndex?flagIndex.flag:-99,remark:b.remark};//选取有用字段
+       let doc = {ID:b.ID,name:b.name,code:b.code,unit:b.unit,projectID:b.projectID, ParentID:b.ParentID,NextSiblingID:b.NextSiblingID,unitPrices:unitPrices,quantity:b.quantity,prices:prices,rationCommons:rationCommons,quantityMap:quantityMap,flag:flagIndex?flagIndex.flag:-99,remark:b.remark,calcBase:b.calcBase,baseProgressiveFees:baseProgressiveFees};//选取有用字段
        if(b.ParentID == -1) roots.push(doc);
        parentMap[b.ParentID]?parentMap[b.ParentID].push(doc):parentMap[b.ParentID]=[doc];
    }//设置子节点
@@ -541,7 +595,7 @@ async function getBillsByProjectID(projectID){
         setChildren(r,parentMap,1);
    }
     roots = sortChildren(roots);
-    return {name:projectName,roots:roots,author:author,auditor:auditor,compilationScope:compilationScope,ParentID:project.ParentID,prjTypeName:engineering}
+    return {name:projectName,roots:roots,author:author,auditor:auditor,compilationScope:compilationScope,ParentID:project.ParentID,prjTypeName:engineering,progressiveType:progressiveType,progressiveInterval:progressiveInterval}
 }
 
 function setChildren(bill,parentMap,level) {

+ 1 - 1
modules/main/models/bills.js

@@ -14,7 +14,7 @@ let rationGljModel = mongoose.model('ration_glj');
 let rationCoeModel = mongoose.model('ration_coe');
 let rationInstModel = mongoose.model('ration_installation');
 let quantityDelModel = mongoose.model('quantity_detail');
-const fixedFlag = require('../../common/const/bills_fixed');
+const { fixedFlag } = require('../../../public/common_constants');
 
 let bills = mongoose.model("bills");
 let baseModel = require('./base_model');

+ 1 - 0
modules/pm/controllers/pm_controller.js

@@ -93,6 +93,7 @@ module.exports = {
                 }
             });
         } catch (err) {
+            console.log(err);
             callback(req, res, 1, String(err), null);
         }
     },

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

@@ -93,7 +93,7 @@ import SectionTreeDao from '../../complementary_ration_lib/models/sectionTreeMod
 let sectionTreeDao = new SectionTreeDao();
 import CounterModel from "../../glj/models/counter_model";
 import moment from 'moment-timezone';
-import billsFlags from '../../common/const/bills_fixed';
+const { fixedFlag } = require('../../../public/common_constants');
 const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
 let cipher = require('../../../public/cipher');
 const compilationModel = mongoose.model('compilation');
@@ -966,8 +966,8 @@ async function getSummaryInfoByTender(tenderID, summaryType) {
         return null;
     }
     let flagFieldMapping = {
-        [billsFlags.TOTAL_COST]: [{name: 'totalCost', feeField: 'common'}], // 总造价
-        [billsFlags.CONSTRUCTION_INSTALL_FEE]: [{name: 'constructionInstallFee', feeField: 'rationCommon'},], // 建安费
+        [fixedFlag.TOTAL_COST]: [{name: 'totalCost', feeField: 'common'}], // 总造价
+        [fixedFlag.CONSTRUCTION_INSTALL_FEE]: [{name: 'constructionInstallFee', feeField: 'rationCommon'},], // 建安费
     };
     let summaryInfo = await getSummaryInfo([project.ID], flagFieldMapping);
     // 汇总到建设项目层(没有单项工程层了)
@@ -990,7 +990,7 @@ async function getTendersFeeInfo(tenders) {
     let IDMapping = {};
     //固定清单类别与汇总金额字段映射
     let flagFieldMapping = {
-        [billsFlags.TOTAL_COST]: [{name: 'totalCost', feeField: 'common'}]
+        [fixedFlag.TOTAL_COST]: [{name: 'totalCost', feeField: 'common'}]
     };
     let tenderIDs = [];
     if(tenders.length > 0){
@@ -1039,7 +1039,7 @@ async function getSummaryInfo(projectIDs, flagFieldMapping = null){
     //固定清单类别与汇总金额字段映射
     if (!flagFieldMapping) {
         flagFieldMapping = {
-            [billsFlags.TOTAL_COST]: [{name: 'totalCost', feeField: 'common'}], // 总造价
+            [fixedFlag.TOTAL_COST]: [{name: 'totalCost', feeField: 'common'}], // 总造价
         };
     }
     let projects = await projectModel.find({ID: {$in : projectIDs}, projType: projectType.project, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});

+ 1 - 1
modules/pm/models/project_model.js

@@ -32,7 +32,7 @@ import {
     bookmarkSetting
 } from './project_property_template';
 import optionSetting from '../../options/models/optionTypes';
-import fixedFlag from '../../common/const/bills_fixed';
+const { fixedFlag } = require('../../../public/common_constants');
 let FeeRateFiles = mongoose.model('fee_rate_file');
 let counter = require("../../../public/counter/counter.js");
 

+ 14 - 14
public/calculate_util.js

@@ -21,15 +21,17 @@
         exp = exp.replace(new RegExp('f', 'g'), 'F');
         return exp;
     }
+
     /**
      * 获取累进办法计算的金额
      * @param {Number} baseFee - 基准金额
      * @param {String} name - 使用累进计算的基数名称(需要与累进库中的名称匹配)
      * @param {Array} progressiveData - 项目的累进数据(property.progressiveInterval)
      * @param {Number} decimal - 精度
+     * @param {Object} deficiency - 不足处理映射 @example: {'路线工程监理费': 20000 } // 不足2万按2万
      * @return {Number}
      */
-    function getProgressiveFee(baseFee, name, progressiveData, decimal) {
+    function getProgressiveFee(baseFee, name, progressiveData, decimal, deficiency) {
         if (!progressiveData) {
             throw '该项目不存在累进区间数据';
         }
@@ -101,26 +103,24 @@
             fee += (perData.max - perData.min) * perData.feeRate * 0.01;
         }
         //累进所在区间
-        fee += (baseFee - withinData.min) * withinData.feeRate * 0.01;
-        return scMathUtil.roundForObj(fee, decimal);
+        fee = scMathUtil.roundForObj(fee + (baseFee - withinData.min) * withinData.feeRate * 0.01, decimal);
+        // 不足处理
+        const deficiencyFee = deficiency && deficiency[name] || 0;
+        return deficiencyFee
+            ? fee > 0 && fee < deficiencyFee
+                ? deficiencyFee
+                : fee
+            : fee;
     }
-    
-    // 所有编办的累进基数(如果以后编办基数有冲突,则此判断方法不可用了。如在编办A、B均有计算x,且A中x为累进基数,B中x为非累进基数)
-    const progression = [
-        '施工场地建设费', '养护单位(业主)管理费', '信息化费', '路线工程监理费', '独立桥梁隧道工程监理费', // 重庆2018
-        '设计文件审查费', '路线勘察设计费', '独立桥梁隧道维修加固勘察设计费', '招标代理及标底(最高投标限价)编制费',
-        '养护单位管理费', '养护项目信息化费', '工程监理费', '前期工作费', // 安徽2019
-        '养护单位项目管理费', // 内蒙2019
-        '养护工程管理费' // 浙江2005
-    ];
 
     /**
      * 判断该基数是否包含累进基数
      * @param {String} calcBase - 计算基数
+     * @param {Array} progression - 累进基数名称数组
      * @return {Boolean}
      */
-    function isProgressive(calcBase) {
-        if (typeof calcBase !== 'string') {
+    function isProgressive(calcBase, progression) {
+        if (typeof calcBase !== 'string' || !progression) {
             return false;
         }
         const reg = /{[^}]+}/g;

+ 83 - 0
public/common_constants.js

@@ -0,0 +1,83 @@
+// 部分数据从main_consts.js中抽出来,因为除了造价书界面,有一些页面也需要用到其中的变量
+// 但是其他页面直接引入整个main_consts.js不合理,且会报错(main_consts.js正常运行依赖main.html的一些内容)
+((factory) => {
+    if (typeof module !== 'undefined') {
+        module.exports = factory();
+    } else {
+        window.commonConstants = factory();
+    }
+})(() => {
+    // 清单固定行
+    const fixedFlag = {
+        // 建筑安装工程费
+        CONSTRUCTION_INSTALL_FEE: 1,
+        // 土地使用及拆迁补偿费
+        LAND_USED_DEMOLITION: 2,
+        // 养护工程其他费用
+        MAINTENANCE_EXPENSES: 3,
+        // 预备费
+        BUDGET_FEE: 4,
+        // 基本预备费
+        BASE_BUDGET_FEE: 5,
+        // 价差预备费
+        SPREAD_BUDGET_FEE: 6,
+        // 一二三四部分合计
+        ONE_TO_FOUR_TOTAL: 7,
+        // 贷款利息
+        LOAN_INTEREST: 8,
+        // 总造价
+        TOTAL_COST: 9,
+        // 设备购置费
+        EQUIPMENT_ACQUISITION_FEE: 10,
+        // 专项费用 Special cost
+        SPECIAL_COST: 11,
+        // 施工场地建设费
+        CONSTRUCTION_PLANT_COST: 12,
+        // 养护单位(业主)管理费
+        MAINTENANCE_MANAGENENT_FEE: 13,
+        // 信息化费 Informatization fee
+        INFORMATIZATION_FEE: 14,
+        // 工程监理费 Engineering supervision fee
+        ENGINEERING_SUP_FEE: 15,
+        // 设计文件审查费 Design Document Review Fee
+        DOCUMENT_REVIEW_FEE: 16,
+        // 勘察设计费 Survey and design fees
+        SURVEY_DESIGN_FEE: 17,
+        // 招标代理及标底编制费 Bidding Agent and Preparing Fee of Bid Base
+        AGENT_BASE_FEE: 18,
+        //第100章至700章清单
+        ONE_SEVEN_BILLS: 19,
+        //专项暂定合计
+        PROVISIONAL_TOTAL: 20,
+        //清单合计扣除专项暂定合计
+        BILLS_TOTAL_WT_PROV: 21,
+        //计日工 daywork labor
+        DAYWORK_LABOR: 22,
+        //劳务
+        LABOUR_SERVICE: 23,
+        //材料
+        MATERIAL: 24,
+        //施工机械
+        CONSTRUCTION_MACHINE: 25,
+        //暂列金额
+        PROVISIONAL: 26,
+        //安全生产费
+        SAFE_COST: 27,
+        //100章清单
+        ONE_HUNDRED_BILLS: 28,
+        // 一二三部分合计
+        ONE_TO_THREE_TOTAL: 29,
+        // 前期工作费
+        PRELIMINARY_WORK: 30,
+        // 小修费
+        MINOR_REPAIR_FEE: 31,
+        // 预防养护费
+        PREVENTIVE_MAINTENANCE_FEE: 32,
+        // 修复养护费
+        REPAIR_MAINTENANCE_FEE: 33,
+    };
+
+    return {
+        fixedFlag
+    };
+})

+ 5 - 0
web/building_saas/main/html/main.html

@@ -952,6 +952,11 @@
                                                     自动根据定额单位转换定额工程量
                                                 </label>
                                             </div>
+                                            <h5 class="mt-3">累进计算费用</h5>
+                                            <div class="">
+                                              <input type="radio" class="form-radio" name="progressiveType" id="progressive_unite" value=0>统一累进办法&nbsp;&nbsp;
+                                              <input type="radio" class="form-radio" name="progressiveType" id="progressive_sum" value=1>各汇总工程相加&nbsp;&nbsp;
+                                            </div>
                                         </fieldset>
                                             <label style="margin-top: 320px">*将影响所有建设项目</label>
                                     </div>

+ 14 - 16
web/building_saas/main/js/models/calc_base.js

@@ -604,7 +604,7 @@ let baseFigureTemplate = {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '施工场地建设费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '施工场地建设费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{养护单位(业主)管理费}
         // 使用累进办法计算,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
@@ -613,7 +613,7 @@ let baseFigureTemplate = {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '养护单位(业主)管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '养护单位(业主)管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{信息化费}
         // 使用累进办法计算,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
@@ -622,37 +622,34 @@ let baseFigureTemplate = {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '信息化费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '信息化费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{路线工程监理费}
         //使用累进办法计算,不足2万按2万,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
         'LXGCJLF': function (tender) {
-            let baseFee = this['DEJZAZGCSBSS'](tender),
-                fee = calculateUtil.getProgressiveFee(baseFee, '路线工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            let baseFee = this['DEJZAZGCSBSS'](tender);
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return fee > 0 && fee < 20000 ? 20000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '路线工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{独立桥梁隧道工程监理费}
         //使用累进办法计算,不足2万按2万,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
         'QLSDGCJLF': function (tender) {
-            let baseFee = this['DEJZAZGCSBSS'](tender),
-                fee = calculateUtil.getProgressiveFee(baseFee, '独立桥梁隧道工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            let baseFee = this['DEJZAZGCSBSS'](tender);
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return fee > 0 && fee < 20000 ? 20000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '独立桥梁隧道工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{设计文件审查费}
         // 使用累进办法计算,不足3千按3千,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
         'SJWJSCF': function (tender) {
-            let baseFee = this['DEJZAZGCSBSS'](tender),
-                fee = calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            let baseFee = this['DEJZAZGCSBSS'](tender);
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return fee > 0 && fee < 3000 ? 3000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{路线勘察设计费}
         // 使用累进办法计算,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
@@ -661,7 +658,7 @@ let baseFigureTemplate = {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '路线勘察设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '路线勘察设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{独立桥梁隧道维修加固勘察设计费}
         // 使用累进办法计算,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
@@ -670,7 +667,7 @@ let baseFigureTemplate = {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '独立桥梁隧道维修加固勘察设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '独立桥梁隧道维修加固勘察设计费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{招标代理及标底(最高投标限价)编制费} (招标代理及标底编制费ZBDLJBDBZF)
         // 使用累进办法计算,计算基数为{定额建筑安装工程(其中定额设备购置费按 40%计)}
@@ -679,7 +676,7 @@ let baseFigureTemplate = {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '招标代理及标底(最高投标限价)编制费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '招标代理及标底(最高投标限价)编制费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         //{价差预备费}
         //以建筑安装工程费为基数
@@ -1403,12 +1400,13 @@ let calcBase = {
             node.updateData.calcBase = exp;
             node.updateData.calcBaseValue = parseFloat(calcBaseValue).toDecimal(decimalObj.decimal('totalPrice', node));
             node.updateData.tenderCalcBaseValue = parseFloat(tenderCalcBaseValue).toDecimal(decimalObj.decimal('totalPrice', node));
-            if (calculateUtil.isProgressive(exp)) {
+            if (calculateUtil.isProgressive(exp, progression)) {
                 node.updateData.baseProgressiveFee = me.baseProgressiveFee;
             }
             node.changed = true;
         }
         catch (err){
+            console.log(err);
             if(typeof err === 'object'){
                 err = '表达式不正确'
             }

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

@@ -210,74 +210,7 @@ const materialTypeMap = {
 }
 
 //清单固定行
-const fixedFlag = {
-    // 建筑安装工程费
-    CONSTRUCTION_INSTALL_FEE: 1,
-    // 土地使用及拆迁补偿费
-    LAND_USED_DEMOLITION: 2,
-    // 养护工程其他费用
-    MAINTENANCE_EXPENSES: 3,
-    // 预备费
-    BUDGET_FEE: 4,
-    // 基本预备费
-    BASE_BUDGET_FEE: 5,
-    // 价差预备费
-    SPREAD_BUDGET_FEE: 6,
-    // 一二三四部分合计
-    ONE_TO_FOUR_TOTAL: 7,
-    // 贷款利息
-    LOAN_INTEREST: 8,
-    // 总造价
-    TOTAL_COST: 9,
-    // 设备购置费
-    EQUIPMENT_ACQUISITION_FEE: 10,
-    // 专项费用 Special cost
-    SPECIAL_COST: 11,
-    // 施工场地建设费
-    CONSTRUCTION_PLANT_COST: 12,
-    // 养护单位(业主)管理费
-    MAINTENANCE_MANAGENENT_FEE: 13,
-    // 信息化费 Informatization fee
-    INFORMATIZATION_FEE: 14,
-    // 工程监理费 Engineering supervision fee
-    ENGINEERING_SUP_FEE: 15,
-    // 设计文件审查费 Design Document Review Fee
-    DOCUMENT_REVIEW_FEE: 16,
-    // 勘察设计费 Survey and design fees
-    SURVEY_DESIGN_FEE: 17,
-    // 招标代理及标底编制费 Bidding Agent and Preparing Fee of Bid Base
-    AGENT_BASE_FEE: 18,
-    //第100章至700章清单
-    ONE_SEVEN_BILLS: 19,
-    //专项暂定合计
-    PROVISIONAL_TOTAL: 20,
-    //清单合计扣除专项暂定合计
-    BILLS_TOTAL_WT_PROV: 21,
-    //计日工 daywork labor
-    DAYWORK_LABOR: 22,
-    //劳务
-    LABOUR_SERVICE:23,
-    //材料
-    MATERIAL:24,
-    //施工机械
-    CONSTRUCTION_MACHINE:25,
-    //暂列金额
-    PROVISIONAL:26,
-    //安全生产费
-    SAFE_COST:27,
-    //100章清单
-    ONE_HUNDRED_BILLS: 28,
-    // 一二三部分合计
-    ONE_TO_THREE_TOTAL: 29,
-    // 前期工作费
-    PRELIMINARY_WORK: 30,
-    // 小修费
-    MINOR_REPAIR_FEE: 31,
-    // 预防养护费
-    PREVENTIVE_MAINTENANCE_FEE: 32,
-    // 修复养护费
-    REPAIR_MAINTENANCE_FEE: 33,
-};
+const fixedFlag = commonConstants.fixedFlag;
 
 const gljKeyArray =['code','name','specs','unit','type'];
 const rationKeyArray =['code','name','specs','unit','subType'];

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

@@ -2309,13 +2309,16 @@ $('#poj-set').on('show.bs.modal', function () {
 
         let zg = projectObj.project.property.zanguCalcMode !== undefined &&
                  projectObj.project.property.zanguCalcMode !== null ? projectObj.project.property.zanguCalcMode : zanguCalcType.common;
+        let progressiveType = projectObj.project.property.progressiveType?projectObj.project.property.progressiveType:0;   
         setCalcFlag($('#rationContent'), leafBillGetFeeType.rationContent, ft);
         setCalcFlag($('#rationPriceConverse'), leafBillGetFeeType.rationPriceConverse, ft);
         setCalcFlag($('#rationPrice'), leafBillGetFeeType.rationPrice, ft);
         setCalcFlag($('#billsPrice'), leafBillGetFeeType.billsPrice, ft);
         setCalcFlag($('#zangu_common'), zanguCalcType.common, zg);
         setCalcFlag($('#zangu_gatherMaterial'), zanguCalcType.gatherMaterial, zg);
-
+        setCalcFlag($('#progressive_unite'), 0, progressiveType);
+        setCalcFlag($('#progressive_sum'), 1, progressiveType);
+        
         let showAdjustPrice = projectObj.project.projSetting.glj_col?projectObj.project.projSetting.glj_col.showAdjustPrice:false;
         showAdjustPrice === true ? $("#tab_poj-settings-6").show():$("#tab_poj-settings-6").hide();
         projDisplayView.init();
@@ -2473,6 +2476,13 @@ $('#property_ok').click(function () {
         project.property.zanguCalcMode = zg;
         reCalcRations = true;
     };
+
+    let progressiveType = parseInt($("input[name='progressiveType']:checked").val())
+    if (progressiveType !== project.property.progressiveType) {
+      properties['property.progressiveType'] = progressiveType;
+      project.property.progressiveType = progressiveType;
+  };
+
     //价差预备费,预算项目才有
     if (project.property.valuationType === 'bill') {
         let costGrowthRateV = $('#costGrowthRate').val(),

+ 1 - 0
web/common/html/header.html

@@ -292,5 +292,6 @@
 <script type="text/javascript" src="/public/web/commonAlert.js"></script>
 <script type="text/javascript" src="/public/web/headerOpr.js"></script>
 <script type="text/javascript" src="/public/common_util.js"></script>
+<script src="/public/common_constants.js"></script>
 <script type="text/javascript" src="/lib/jquery-editable-select/jquery.editable-select.min.js"></script>
 <!-- endinject -->

+ 55 - 28
web/over_write/js/anhui_2019.js

@@ -3,7 +3,7 @@
  */
 
 let isAH2019 = true;
-
+const { fixedFlag } = commonConstants;
 function overwriteRationCalcBases() {
     if (typeof rationCalcBases == 'undefined') return;
     for (let key in rationCalcBases) delete rationCalcBases[key];
@@ -33,18 +33,18 @@ function overwriteRationCalcBases() {
     rationCalcBases['定额施工机械使用费'] = function (node, isTender) {
         return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptBasePrice, isTender);
     };
-	rationCalcBases['定额商品砼费'] = function (node, isTender) {
-		return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptBasePrice, isTender);
-	};
+    rationCalcBases['定额商品砼费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptBasePrice, isTender);
+    };
     rationCalcBases['定额设备费'] = function (node, isTender) {
         return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptBasePrice, isTender);
     };
     rationCalcBases['定额外购砼构件费'] = function (node, isTender) {
-		return calcTools.rationBaseFee(node, [gljType.PURCHASE_COMPONENT], priceTypes.ptBasePrice, isTender);
-	};
-	rationCalcBases['定额绿化苗木费'] = function (node, isTender) {
-		return calcTools.rationBaseFee(node, [gljType.GREEN_SEEDLING], priceTypes.ptBasePrice, isTender);
-	};
+        return calcTools.rationBaseFee(node, [gljType.PURCHASE_COMPONENT], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额绿化苗木费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.GREEN_SEEDLING], priceTypes.ptBasePrice, isTender);
+    };
 };
 
 (function overwriteFeeTypes() {
@@ -54,13 +54,13 @@ function overwriteRationCalcBases() {
         { type: 'marketMaterial', name: '材料费' },
         { type: 'marketMachine', name: '施工机械使用费' },
         { type: 'marketMachineLabour', name: '施工机械人工费' },
-        {type: 'marketEquipment', name: '设备购置费'},
+        { type: 'marketEquipment', name: '设备购置费' },
         { type: 'marketDirect', name: '直接费' },
 
         { type: 'labour', name: '定额人工费' },
         { type: 'material', name: '定额材料费' },
         { type: 'machine', name: '定额施工机械使用费' },
-        {type: 'equipment', name: '定额设备费'},
+        { type: 'equipment', name: '定额设备费' },
         { type: 'direct', name: '定额直接费' },
 
         { type: 'measure', name: '措施费' },
@@ -75,8 +75,11 @@ function overwriteRationCalcBases() {
 })();
 
 // 清单基数
+const progression = [];
+const deficiency = {};
 if (typeof baseFigureMap !== 'undefined') {
-    baseFigureMap.budget = {
+    const { fixedFlag } = commonConstants;
+    const budgetMap = {
         // 显示:除清单固定类别是“建筑安装工程费”的以外部分可显示。
         '建筑安装工程费': {
             base: 'JZAZGCF',
@@ -135,6 +138,7 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 显示:仅清单固定类别是“施工场地建设费”的可显示。
         '施工场地建设费': {
+            isProgressive: true,
             base: 'SGCDJSF',
             fixedFlag: null,
             filter: [fixedFlag.CONSTRUCTION_PLANT_COST],
@@ -142,6 +146,7 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
         '养护单位管理费': {
+            isProgressive: true,
             base: 'YHDWGLF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_EXPENSES],
@@ -149,6 +154,8 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
         '养护项目信息化费': {
+            isProgressive: true,
+            deficiency: 20000,
             base: 'YHXMXXHF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_EXPENSES],
@@ -156,6 +163,8 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 显示:仅清单固定类别是“养护工程其他费用”部分可显示。
         '工程监理费': {
+            isProgressive: true,
+            deficiency: 20000,
             base: 'GCJLF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_EXPENSES],
@@ -163,6 +172,7 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 显示:只有清单固定类别是“养护工程其他费用”部分可显示。
         '设计文件审查费': {
+            isProgressive: true,
             base: 'SJWJSCF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_EXPENSES],
@@ -170,6 +180,8 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 显示:只有清单固定类别是“养护工程其他费用”部分可显示。
         '前期工作费': {
+            isProgressive: true,
+            deficiency: 30000,
             base: 'QQGZF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_EXPENSES],
@@ -183,8 +195,7 @@ if (typeof baseFigureMap !== 'undefined') {
             pick: true,
         },
     };
-
-    baseFigureMap.boq = {
+    const boqMap = {
         //仅允许用于固定类别是“第100章至700章清单”以外的清单
         '各章清单合计': {
             base: 'GZQDHJ',
@@ -211,9 +222,21 @@ if (typeof baseFigureMap !== 'undefined') {
             pick: true
         }
     };
+    for (const name in budgetMap) {
+        const item = budgetMap[name];
+        if (item.isProgressive) {
+            progression.push(item.progressiveName || name);
+        }
+        if (item.deficiency) {
+            deficiency[item.progressiveName || name] = item.deficiency;
+        }
+    }
+    baseFigureMap.budget = budgetMap;
+    baseFigureMap.boq = boqMap;
 }
 
 if (typeof baseFigureTemplate !== 'undefined') {
+    const { fixedFlag } = commonConstants;
     baseFigureTemplate.budget = {
         // 建筑安装工程费 算法:取清单固定类别是“建筑安装工程费”的金额。
         JZAZGCF(tender) {
@@ -271,7 +294,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '施工场地建设费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '施工场地建设费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 养护单位管理费 算法:以{定额建筑安装工程费(不含专项管理费) }为基数,采用累进办法计算。
         YHDWGLF(tender) {
@@ -279,7 +302,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '养护单位管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '养护单位管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 养护项目信息化费 算法:以{定额建筑安装工程费}为基数,采用累进办法计算。(不足20000元时按20000元计算)
         YHXMXXHF(tender) {
@@ -287,8 +310,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            const fee = calculateUtil.getProgressiveFee(baseFee, '养护项目信息化费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
-            return fee > 0 && fee < 20000 ? 20000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '养护项目信息化费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 工程监理费 算法:以{定额建筑安装工程费(不含专项管理费) }为基数,采用累进办法计算。(不足20000元时按20000元计算)
         GCJLF(tender) {
@@ -296,8 +318,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            const fee = calculateUtil.getProgressiveFee(baseFee, '工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
-            return fee > 0 && fee < 20000 ? 20000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 设计文件审查费 算法:以{定额建筑安装工程费(不含专项管理费) }为基数,采用累进办法计算。
         SJWJSCF(tender) {
@@ -305,7 +326,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 前期工作费 算法:以{定额建筑安装工程费(不含专项管理费) }为基数,采用累进办法计算。(不足30000元时按30000元计算)
         QQGZF(tender) {
@@ -313,8 +334,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            const fee = calculateUtil.getProgressiveFee(baseFee, '前期工作费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
-            return fee > 0 && fee < 30000 ? 30000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '前期工作费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         /*  价差预备费 算法:以建筑安装工程费为基数,按设计文件编制年始至养护项目工程竣工年终的年数和年工程造价增涨率计算。
             价差预备费 P * [(1+i)^(n-1) -1]
@@ -326,12 +346,12 @@ if (typeof baseFigureTemplate !== 'undefined') {
             //建筑安装工程费作为基数
             const installFee = this['JZAZGCF'](tender);
             //年造价增涨
-            const costGrowthRate = calcBase.project.property.costGrowthRate 
-                ? calcBase.project.property.costGrowthRate 
+            const costGrowthRate = calcBase.project.property.costGrowthRate
+                ? calcBase.project.property.costGrowthRate
                 : 0;
             //增涨计费年限
-            const growthPeriod = projectObj.project.property.growthPeriod 
-                ? calcBase.project.property.growthPeriod 
+            const growthPeriod = projectObj.project.property.growthPeriod
+                ? calcBase.project.property.growthPeriod
                 : 0;
             //= P * [(1+i)^(n-1) -1]
             return (installFee * (Math.pow(1 + costGrowthRate, growthPeriod - 1) - 1)).toDecimal(decimalObj.bills.totalPrice);
@@ -396,8 +416,15 @@ if (typeof baseFigureTemplate !== 'undefined') {
 
 // 安徽养护在新建分段的时候需要隐藏养护类别和费用标准
 if (typeof $ !== 'undefined') { // 后端也有引用这个文件,后端引用时$没有定义会报错
-    $(document).ready(function() {
+    $(document).ready(function () {
         $('#tender-engineering-group').hide();
         $('#tender-feeStandard-group').hide();
     });
+}
+
+if (typeof module !== 'undefined') {
+    module.exports = {
+        progression,
+        deficiency
+    };
 }

+ 32 - 13
web/over_write/js/chongqing_2018.js

@@ -5,17 +5,36 @@
 
 //重庆综合里程、工地转移费率值修改特殊处理
 
-if(typeof feeRateObject !== 'undefined'){
-   feeRateObject.feeRateSpecialHandle = function (subRate,value) {
-       let result = {};
-       if(subRate.name == "工地转移(km)"&& value && value < 50){//工地转移50km以内按50km算
-           result.valueKey = "50";
-           result.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
-       }
-       if(subRate.name == "综合里程(km)"&& value && value < 3){//综合里程3km以内按3km算
-           result.valueKey = "3";
-           result.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
-       }
-       return result;
-   }
+if (typeof feeRateObject !== 'undefined') {
+    feeRateObject.feeRateSpecialHandle = function (subRate, value) {
+        let result = {};
+        if (subRate.name == "工地转移(km)" && value && value < 50) {//工地转移50km以内按50km算
+            result.valueKey = "50";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "综合里程(km)" && value && value < 3) {//综合里程3km以内按3km算
+            result.valueKey = "3";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        return result;
+    }
 }
+
+// 累进的基数名称
+const progression = [
+    '施工场地建设费', '养护单位(业主)管理费', '信息化费', '路线工程监理费', '独立桥梁隧道工程监理费',
+    '设计文件审查费', '路线勘察设计费', '独立桥梁隧道维修加固勘察设计费', '招标代理及标底(最高投标限价)编制费'
+];
+// 累进计算金额不足时的处理映射
+const deficiency = {
+    '路线工程监理费': 20000, // 不足2万按2万
+    '独立桥梁隧道工程监理费': 20000,
+    '设计文件审查费': 3000
+};
+
+if (typeof module !== 'undefined') {
+    module.exports = {
+        progression,
+        deficiency
+    };
+}

+ 64 - 39
web/over_write/js/neimeng_2019.js

@@ -3,7 +3,6 @@
  */
 
 let isNM2019 = true;
-
 function overwriteRationCalcBases() {
     if (typeof rationCalcBases == 'undefined') return;
     for (let key in rationCalcBases) delete rationCalcBases[key];
@@ -50,33 +49,36 @@ function overwriteRationCalcBases() {
 (function overwriteFeeTypes() {
     if (typeof cpFeeTypes == 'undefined') return;
     cpFeeTypes = [
-        {type: 'marketLabour', name: '人工费'},
-        {type: 'marketMaterial', name: '材料费'},
-        {type: 'marketMachine', name: '施工机械使用费'},
-        {type: 'marketMachineLabour', name: '施工机械人工费'},
-        {type: 'marketEquipment', name: '设备购置费'},
-        {type: 'marketDirect', name: '直接费'},
+        { type: 'marketLabour', name: '人工费' },
+        { type: 'marketMaterial', name: '材料费' },
+        { type: 'marketMachine', name: '施工机械使用费' },
+        { type: 'marketMachineLabour', name: '施工机械人工费' },
+        { type: 'marketEquipment', name: '设备购置费' },
+        { type: 'marketDirect', name: '直接费' },
 
-        {type: 'labour', name: '定额人工费'},
-        {type: 'material', name: '定额材料费'},
-        {type: 'machine', name: '定额施工机械使用费'},
-        {type: 'equipment', name: '定额设备购置费'},
-        {type: 'direct', name: '定额直接费'},
+        { type: 'labour', name: '定额人工费' },
+        { type: 'material', name: '定额材料费' },
+        { type: 'machine', name: '定额施工机械使用费' },
+        { type: 'equipment', name: '定额设备购置费' },
+        { type: 'direct', name: '定额直接费' },
 
-        {type: 'measure', name: '措施费'},
-        {type: 'manage', name: '企业管理费'},
-        {type: 'force', name: '规费'},
-        {type: 'profit', name: '利润'},
-        {type: 'tax', name: '税金'},
-        {type: 'common', name: '建安费'},
-        {type: 'rationCommon', name: '定额建安费'},
-        {type: 'safeProduce', name: '安全生产费'}
+        { type: 'measure', name: '措施费' },
+        { type: 'manage', name: '企业管理费' },
+        { type: 'force', name: '规费' },
+        { type: 'profit', name: '利润' },
+        { type: 'tax', name: '税金' },
+        { type: 'common', name: '建安费' },
+        { type: 'rationCommon', name: '定额建安费' },
+        { type: 'safeProduce', name: '安全生产费' }
     ];
 })();
 
 // 清单基数
-if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
-    baseFigureMap.budget = {
+const progression = [];
+const deficiency = {};
+if (typeof baseFigureMap !== 'undefined') {
+    const { fixedFlag } = commonConstants;
+    const budgetMap = {
         // 清单固定类别是“建筑安装工程费”的以外部分可显示
         '定额建筑安装工程费(定额设备购置费按40%计)': {
             base: 'DEJZAZGCFSBSS',
@@ -121,6 +123,7 @@ if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
         },
         // 仅在清单固定类别是“养护单位项目管理费”的清单显示
         '养护单位项目管理费': {
+            isProgressive: true,
             base: 'YHDWXMGLF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_MANAGENENT_FEE],
@@ -128,6 +131,7 @@ if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
         },
         // 仅在清单固定类别是“信息化费”的清单显示
         '信息化费': {
+            isProgressive: true,
             base: 'XXHF',
             fixedFlag: null,
             filter: [fixedFlag.INFORMATIZATION_FEE],
@@ -135,6 +139,7 @@ if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
         },
         // 仅在清单固定类别是“工程监理费”的清单显示
         '工程监理费': {
+            isProgressive: true,
             base: 'GCJLF',
             fixedFlag: null,
             filter: [fixedFlag.ENGINEERING_SUP_FEE],
@@ -142,12 +147,15 @@ if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
         },
         // 仅在清单固定类别是“设计文件审查费”的清单显示
         '设计文件审查费': {
+            isProgressive: true,
+            deficiency: 3000,
             base: 'SJWJSCF',
             fixedFlag: null,
             filter: [fixedFlag.DOCUMENT_REVIEW_FEE],
             pick: true,
         },
         '前期工作费': {
+            isProgressive: true,
             base: 'QQGZF',
             fixedFlag: null,
             filter: [fixedFlag.PRELIMINARY_WORK],
@@ -160,8 +168,7 @@ if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
             pick: true,
         },
     };
-    
-    baseFigureMap.boq = {
+    const boqMap = {
         //仅允许用于固定类别是“第100章至700章清单”以外的清单
         '各章清单合计': {
             base: 'GZQDHJ',
@@ -188,10 +195,22 @@ if (typeof baseFigureMap !== 'undefined' && baseFigureMap.budget) {
             pick: true
         }
     };
+    for (const name in budgetMap) {
+        const item = budgetMap[name];
+        if (item.isProgressive) {
+            progression.push(item.progressiveName || name);
+        }
+        if (item.deficiency) {
+            deficiency[item.progressiveName || name] = item.deficiency;
+        }
+    }
+    baseFigureMap.budget = budgetMap;
+    baseFigureMap.boq = boqMap;
 }
 
 // 清单基数
 if (typeof baseFigureTemplate !== 'undefined') {
+    const { fixedFlag } = commonConstants;
     baseFigureTemplate.budget = {
         // 定额建筑安装工程费(定额设备购置费按40%计):取清单固定类别是“建筑安装工程”的定额建安费,其中定额设备购置费按40%计算
         DEJZAZGCFSBSS(tender) {
@@ -241,7 +260,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '养护单位项目管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '养护单位项目管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 信息化费:以累进办法计算,计算基数为“定额建筑安装工程费(定额设备购置费按40%计)”
         XXHF(tender) {
@@ -249,7 +268,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '信息化费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '信息化费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 工程监理费:以累进办法计算,计算基数为“定额建筑安装工程费(定额设备购置费按40%计)
         GCJLF(tender) {
@@ -257,7 +276,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '工程监理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 设计文件审查费:以累进办法计算,计算基数为“定额建筑安装工程费(定额设备购置费按40%计)”;设计文件审查费不足3000元的,按3000元计算
         SJWJSCF(tender) {
@@ -265,8 +284,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            const fee = calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
-            return fee > 0 && fee < 3000 ? 3000 : fee;
+            return calculateUtil.getProgressiveFee(baseFee, '设计文件审查费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 前期工作费:以累进办法计算,计算基数为“定额建筑安装工程费(定额设备购置费按40%计)
         QQGZF(tender) {
@@ -274,7 +292,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '前期工作费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '前期工作费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 价差预备费
         JCYBF(tender) {
@@ -346,23 +364,30 @@ if (typeof baseFigureTemplate !== 'undefined') {
     };
 }
 
-if(typeof materialCalcObj !== 'undefined' && materialCalcObj.rationSetting){
-    let h =_.find(materialCalcObj.rationSetting.header,{"dataCode":"feeType"});
-    if(h) h.visible = true;
-    let mt = _.find(materialCalcObj.freightSetting.header,{"dataCode":"materialType"});
-    if(mt) mt.visible = true;
+if (typeof materialCalcObj !== 'undefined' && materialCalcObj.rationSetting) {
+    let h = _.find(materialCalcObj.rationSetting.header, { "dataCode": "feeType" });
+    if (h) h.visible = true;
+    let mt = _.find(materialCalcObj.freightSetting.header, { "dataCode": "materialType" });
+    if (mt) mt.visible = true;
 }
 
 
 //内蒙施工进出场(km)费率值修改特殊处理
 
-if(typeof feeRateObject !== 'undefined'){
-    feeRateObject.feeRateSpecialHandle = function (subRate,value) {
+if (typeof feeRateObject !== 'undefined') {
+    feeRateObject.feeRateSpecialHandle = function (subRate, value) {
         let result = {};
-        if(subRate.name == "施工进出场(km)"&& value && value < 5){//输入的数值(公里数)< 5时,该项费用不计取。
+        if (subRate.name == "施工进出场(km)" && value && value < 5) {//输入的数值(公里数)< 5时,该项费用不计取。
             result.valueKey = "0";
-            result.value = scMathUtil.roundForObj(value,getDecimal("feeRate")) ;//设置显示的节点值
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
         }
         return result;
     }
+}
+
+if (typeof module !== 'undefined') {
+    module.exports = {
+        progression,
+        deficiency
+    };
 }

+ 66 - 45
web/over_write/js/zhejiang_2005.js

@@ -3,9 +3,9 @@
  */
 
 let isZJ2005 = true;
-
+const { fixedFlag } = commonConstants;
 // 一般计税取不含税市场价、不含税定额价。简易计税取含税市场价、含税定额价。打开项目时,4个价格根据计税类型只载入其二,所以这里可不作区分。
-function overwriteRationCalcBases (taxType){
+function overwriteRationCalcBases(taxType) {
     if (typeof rationCalcBases == 'undefined') return;
     for (let key in rationCalcBases) delete rationCalcBases[key];
     // let isJY = taxType == '2';
@@ -24,24 +24,27 @@ function overwriteRationCalcBases (taxType){
 (function overwriteFeeTypes() {
     if (typeof cpFeeTypes == 'undefined') return;
     cpFeeTypes = [
-        {type: 'directWork', name: '直接工程费'},
-        {type: 'direct', name: '直接费'},
-        {type: 'marketLabour', name: '人工费'},
-        {type: 'marketMaterial', name: '材料费'},
-        {type: 'marketMachine', name: '施工机械使用费'},
-        {type: 'otherDirect', name: '其他直接费'},
-        {type: 'local', name: '现场经费'},
-        {type: 'indirect', name: '间接费'},
-        {type: 'profit', name: '计划利润'},
-        {type: 'tax', name: '税金'},
-        {type: 'composite', name: '年度经费综合费'},
-        {type: 'common', name: '养护工程费'}
+        { type: 'directWork', name: '直接工程费' },
+        { type: 'direct', name: '直接费' },
+        { type: 'marketLabour', name: '人工费' },
+        { type: 'marketMaterial', name: '材料费' },
+        { type: 'marketMachine', name: '施工机械使用费' },
+        { type: 'otherDirect', name: '其他直接费' },
+        { type: 'local', name: '现场经费' },
+        { type: 'indirect', name: '间接费' },
+        { type: 'profit', name: '计划利润' },
+        { type: 'tax', name: '税金' },
+        { type: 'composite', name: '年度经费综合费' },
+        { type: 'common', name: '养护工程费' }
     ];
 })();
 
 // 清单基数
+const progression = [];
+const deficiency = {};
 if (typeof baseFigureMap !== 'undefined') {
-    baseFigureMap.budget = {
+    const { fixedFlag } = commonConstants;
+    const budgetMap = {
         // 除清单固定类别是“建筑安装工程费”的以外部分可显示
         '公路养护工程费': {
             base: 'GLYHGCF',
@@ -65,6 +68,8 @@ if (typeof baseFigureMap !== 'undefined') {
         },
         // 只有清单固定类别是“养护工程其他费用”部分可显示
         '养护工程管理经费': {
+            progressiveName: '养护工程管理费', // 累进库里配置的名称与基数名称应该是一样的,但是这里不一样且已经在yun上线。特殊处理
+            isProgressive: true,
             base: 'YHGCGLJF',
             fixedFlag: null,
             filter: [fixedFlag.MAINTENANCE_EXPENSES],
@@ -83,11 +88,10 @@ if (typeof baseFigureMap !== 'undefined') {
             fixedFlag: null,
             filter: [fixedFlag.BUDGET_FEE],
             pick: true,
-
+    
         }
     };
-
-    baseFigureMap.boq = {
+    const boqMap = {
         //仅允许用于固定类别是“第100章至700章清单”以外的清单
         '各章清单合计': {
             base: 'GZQDHJ',
@@ -114,9 +118,21 @@ if (typeof baseFigureMap !== 'undefined') {
             pick: true
         }
     };
+    for (const name in budgetMap) {
+        const item = budgetMap[name];
+        if (item.isProgressive) {
+            progression.push(item.progressiveName || name);
+        }
+        if (item.deficiency) {
+            deficiency[item.progressiveName || name] = item.deficiency;
+        }
+    }
+    baseFigureMap.budget = budgetMap;
+    baseFigureMap.boq = boqMap;
 }
 
 if (typeof baseFigureTemplate !== 'undefined') {
+    const { fixedFlag } = commonConstants;
     baseFigureTemplate.budget = {
         // 公路养护工程费:取清单固定类别是“建筑安装工程费”的金额
         GLYHGCF(tender) {
@@ -142,7 +158,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
             if (!tender) {
                 calcBase.baseProgressiveFee = baseFee;
             }
-            return calculateUtil.getProgressiveFee(baseFee, '养护工程管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice);
+            return calculateUtil.getProgressiveFee(baseFee, '养护工程管理费', projectObj.project.property.progressiveInterval, decimalObj.bills.totalPrice, deficiency);
         },
         // 一二三部分合计:取清单固定类别是“一二三部分合计”的金额
         YESBFHJ(tender) {
@@ -272,7 +288,7 @@ if (typeof gljOprObj !== 'undefined') {
 
 }
 
-if(typeof gljUtil !== 'undefined'){
+if (typeof gljUtil !== 'undefined') {
     gljUtil.getCodeSortMath = getCodeSortMath;
     gljUtil.getElecCoe = function () {
         return 0.24;
@@ -283,54 +299,54 @@ if(typeof gljUtil !== 'undefined'){
 }
 
 
-if(typeof electrovalenceObj !== 'undefined'){
+if (typeof electrovalenceObj !== 'undefined') {
     electrovalenceObj.options = [
-        {code:"270",name:"电网电",specs:"",unit:"kW·h",type:"201"},
-        {code:"905",name:"5kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"906",name:"15kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"907",name:"30kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"908",name:"50kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"909",name:"75kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"910",name:"100kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"911",name:"120kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"912",name:"160kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"913",name:"200kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"914",name:"250kW以内柴油发电机组",specs:"",unit:"台班",type:"301"},
-        {code:"915",name:"320kW以内柴油发电机组",specs:"",unit:"台班",type:"301"}
+        { code: "270", name: "电网电", specs: "", unit: "kW·h", type: "201" },
+        { code: "905", name: "5kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "906", name: "15kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "907", name: "30kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "908", name: "50kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "909", name: "75kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "910", name: "100kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "911", name: "120kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "912", name: "160kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "913", name: "200kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "914", name: "250kW以内柴油发电机组", specs: "", unit: "台班", type: "301" },
+        { code: "915", name: "320kW以内柴油发电机组", specs: "", unit: "台班", type: "301" }
     ]
 }
 
-if(typeof materialCalcObj !== 'undefined'){
+if (typeof materialCalcObj !== 'undefined') {
     materialCalcObj.getAssistProductionLabel = function () {
         return "辅助生产现场经费费率(%)";
     }
 }
 
-if(typeof projectObj !== 'undefined'){
-  projectObj.isInsertEquipmentVisable = function(selected){
-    return false;   //浙江不管是预算或者工程量清单,都是隐藏   
-  }
+if (typeof projectObj !== 'undefined') {
+    projectObj.isInsertEquipmentVisable = function (selected) {
+        return false;   //浙江不管是预算或者工程量清单,都是隐藏   
+    }
 
 }
 
 
 
-if(typeof module !== 'undefined'){
-    let _= require('lodash');
+if (typeof module !== 'undefined') {
+    let _ = require('lodash');
 
     module.exports = {
-        sortRationGLJ: function(list){
+        sortRationGLJ: function (list) {
             list = _.sortByAll(list, [function (item) {
-                return getMainType(item.gljType?item.gljType:item.type);
+                return getMainType(item.gljType ? item.gljType : item.type);
             }, getCodeSortMath()]);
             return list;
 
             function getMainType(type) {
                 let str = type + "";
-                return parseInt(str.substr(0,1));
+                return parseInt(str.substr(0, 1));
             }
         },
-        getDefalutAssistProductionFeeRate:function () {
+        getDefalutAssistProductionFeeRate: function () {
             return 15
         }
     };
@@ -343,4 +359,9 @@ function getCodeSortMath() {
     }
 }
 
-
+if (typeof module !== 'undefined') {
+    module.exports = {
+        progression,
+        deficiency
+    };
+}