Browse Source

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

vian 5 years ago
parent
commit
80ad8b1d79

+ 3 - 0
modules/main/controllers/installation_controller.js

@@ -74,6 +74,9 @@ async function  resetToDefault(req, res) {
         let data = req.body.data;
         data = JSON.parse(data);
         let returnData= await installation_facade.resetToDefault(data.projectID,data.installFees);
+        if(data.rationInstallations && data.rationInstallations.length > 0){
+          await ration_installation_facade.updateFromInstallationFee(data.projectID,data.rationInstallations);
+        }
         result.data=returnData;
     }catch (err){
         logger.err(err);

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

@@ -2402,10 +2402,19 @@ async function importProjects(data,req,updateData) {
 
 
 async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap){
-    let bills = [],rations = [],projectGLJs = [],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[];
+    let bills = [],rations = [],projectGLJs = [],installationFees=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[];
     let newProjectSetting =null,newCalcProgramsFile = null,newLabourCoe = null;
     let billsIDMap = {},projectGLJIDMap={},rationIDMap = {};
     let newProjectID = projectIDMap[data.projSetting.projectID];
+    //生成安装增加费设置
+    if(data.installationFees && data.installationFees.length > 0){
+        for(let ins of data.installationFees){
+          delete ins._id;
+          ins.ID = uuidV1();
+          ins.projectID = newProjectID;
+          installationFees.push(ins);
+        }
+    }
     //生成新的清单;
     if(data.bills && data.bills.length > 0){
         for(let b of data.bills){
@@ -2479,6 +2488,7 @@ async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgra
     if(newProjectSetting) await projectSettingModel.create(newProjectSetting);
     if(bills.length > 0) await insertMany(bills,billsModel);
     if(rations.length > 0) await insertMany(rations,rationModel);
+    if(installationFees.length > 0) await insertMany(installationFees,installationFeeModel);
     if(projectGLJs.length > 0) await insertMany(projectGLJs,gljListModel);
     if(rationGLJs.length > 0) await insertMany(rationGLJs,rationGLJModel);
     if(rationCoes.length > 0) await insertMany(rationCoes,rationCoeModel);

+ 4 - 2
modules/ration_glj/facade/ration_glj_facade.js

@@ -940,12 +940,14 @@ function getData(projectID, callback, isReport) {
                                         if (ration.quantityCoe._doc.labour)
                                             coe = ration.quantityCoe._doc.labour;
                                     }
-                                    else if ([gljType.GENERAL_MATERIAL,
+                                    else if (
+                                        [gljType.GENERAL_MATERIAL,
                                         gljType.CONCRETE,
                                         gljType.MORTAR,
                                         gljType.MIX_RATIO,
                                         gljType.COMMERCIAL_CONCRETE,
-                                        gljType.COMMERCIAL_MORTAR].includes(glj.type)){
+                                        gljType.COMMERCIAL_MORTAR,
+                                        gljType.OTHER_MATERIAL].includes(glj.type)){
                                         if (ration.quantityCoe._doc.material)
                                             coe = ration.quantityCoe._doc.material;
                                     }

+ 5 - 1
modules/reports/util/rpt_construct_data_util.js

@@ -1430,7 +1430,11 @@ function ext_getCalcProperty(templateIDs, calcItemKey, calcItemKeyVal, calcItemR
         if (calcTplObj) {
             for (let calcItem of calcTplObj.calcItems) {
                 if (calcItem[calcItemKey] === calcItemKeyVal) {
-                    rst.push(calcItem[calcItemRstKey]);
+                    if (calcItem[calcItemRstKey] !== undefined && calcItem[calcItemRstKey] !== null) {
+                        rst.push(calcItem[calcItemRstKey]);
+                    } else {
+                        rst.push(calcItem['feeRate']); //业务特点,如果上述key没有值的话,直接取‘feeRate’的value,省的去改指标定义了
+                    }
                     break;
                 }
             }

+ 2 - 6
pm2_server.json

@@ -2,12 +2,8 @@
   "apps": {
       "name": "constructionimport",
       "script": "server.js",
-      "args":"--max-old-space-size=2048",
-      "output": "/home/logs/out.log",
-      "error": "/home/logs/err.log",
-      "log_date_format": "YYYY-MM-DD HH:mm Z",
+      "node_args":"--max-old-space-size=2048",
       "exec_mode": "cluster_mode",                
-      "instances": 3, 
-      "merge_logs": true
+      "instances": 3
     }
 }

+ 0 - 399
web/building_saas/main/js/calc/bills_calc.js

@@ -1,399 +0,0 @@
-/**
- * Created by Mai on 2017/7/5.
- */
-
-// const rationContent = 0, rationPrice = 1, rationPriceConverse = 2, billsPrice = 3;
-
-// sumTotalFeeFlag: sum(child.totalFee), totalFeeFlag: bills.quantity × bills.unitFee
-// const sumTotalFeeFlag = 0, totalFeeFlag = 1;
-// rationContentUnitFeeFlag: sum(child.unitFee * child.quantity / bills.quantity)
-// averageQtyUnitFeeFlag: sum(child.totalFee/bills.quantity)
-// billsPriceUnitFeeFlag: 根据定额计算程序
-// converseUnitFeeFalg: bills.totalFee / bills.quantity
-// const rationContentUnitFeeFlag = 0, averageQtyUnitFeeFlag = 1, billsPriceUnitFeeFlag = 2, converseUnitFeeFlag = 3;
-
-/*let rationContentCalcFields = [
-    {'type': 'common', 'unitFeeFlag': rationContentUnitFeeFlag, 'totalFeeFlag': totalFeeFlag},
-    {'type': 'labour', 'unitFeeFlag': rationContentUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'material', 'unitFeeFlag': rationContentUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'machine', 'unitFeeFlag': rationContentUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag}
-];
-let rationPriceCalcFields = [
-    {'type': 'common', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': totalFeeFlag},
-    {'type': 'labour', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'material', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'machine', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag}
-];
-let rationPriceConverseCalcFields = [
-    {'type': 'common', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'labour', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'material', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'machine', 'unitFeeFlag': averageQtyUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag}
-];
-let billsPriceCalcFields = [
-    {'type': 'common', 'unitFeeFlag': billsPriceUnitFeeFlag, 'totalFeeFlag': totalFeeFlag},
-    {'type': 'labour', 'unitFeeFlag': billsPriceUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'material', 'unitFeeFlag': billsPriceUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag},
-    {'type': 'machine', 'unitFeeFlag': billsPriceUnitFeeFlag, 'totalFeeFlag': sumTotalFeeFlag}
-];*/
-
-/*let nodeCalcObj = {
-    node: null,
-    digit: 2,
-    field: null,
-    getFee: calcFees.getFee,
-    sumTotalFee: function() {
-        let result = 0, child;
-        for (child of this.node.children) {
-            let value = this.getFee(child.data, this.field.totalFee);
-            if (Object.prototype.toString.apply(value) === "[object String]") {
-                value = parseFloat(value);
-            }
-            result += value;
-        }
-        return result;
-    },
-    averageQty: function() {
-        let result = 0, child, qty;
-        result = this.sumTotalFee(this.field);
-        qty = this.getFee(this.node.data, 'quantity');
-        if (Object.prototype.toString.apply(qty) === "[object String]") {
-            qty = parseFloat(qty);
-        }
-        if (qty !== 0) {
-            result = result / qty;
-        }
-        return result;
-    },
-    totalFee: function () {
-        return this.getFee(this.node.data, this.field.unitFee) * this.getFee(this.node.data, 'quantity');
-    },
-    rationContentUnitFee: function () {
-        let result = 0, child, qty = this.getFee(this.node.data, 'quantity');
-        if (Object.prototype.toString.apply(qty) === "[object String]") {
-            qty = parseFloat(qty);
-        }
-        if (qty === 0) {
-            qty = 1;
-        }
-        for (child of this.node.children) {
-            let childUnitFee = this.getFee(child.data, this.field.unitFee);
-            if (Object.prototype.toString.apply(childUnitFee) === "[object String]") {
-                childUnitFee = parseFloat(childUnitFee);
-            }
-            let childQuantity = this.getFee(child.data, 'quantity');
-            if (Object.prototype.toString.apply(childQuantity) === "[object String]") {
-                childQuantity = parseFloat(childQuantity);
-            }
-            result += (childUnitFee * childQuantity / qty).toDecimal(this.digit);
-        }
-        return result;
-    },
-    converseUnitFee: function (digit) {
-        let totalFee = this.sumTotalFee().toDecimal(digit);
-        let qty = this.getFee(this.node.data, 'quantity');
-        if (qty !== 0){
-            return totalFee / qty;
-        } else {
-            return 0;
-        }
-    }
-};*/
-
-/*let baseCalcField = [
-    {
-        ID: 1,
-        // 序号
-        serialNo: '一',
-        // 费用代号
-        code: "A",
-        // 名称
-        name: "定额直接费",
-        // 计算基数
-        dispExpr: "A1+A2+A3",
-        // 基数说明
-        statement: "人工费+材料费+机械费",
-        // 费率
-        feeRate: null,
-        // 费用类别
-        type: 'RationDirect',
-        // 备注
-        memo: ''
-    }, {
-        ID: 2,
-        // 序号
-        serialNo: '1',
-        // 费用代号
-        code: "A1",
-        // 名称
-        name: "人工费",
-        // 计算基数
-        dispExpr: "H_J",
-        // 基数说明
-        statement: "合计",
-        // 费率
-        feeRate: 0,
-        // 费用类别
-        type: 'labour',
-        // 备注
-        memo: ''
-    }, {
-        ID: 3,
-        // 序号
-        serialNo: '2',
-        // 费用代号
-        code: "A2",
-        // 名称
-        name: "材料费",
-        // 计算基数
-        dispExpr: "H_J",
-        // 基数说明
-        statement: "合计",
-        // 费率
-        feeRate: 100,
-        // 费用类别
-        type: 'material',
-        // 备注
-        memo: ''
-    }, {
-        ID: 4,
-        // 序号
-        serialNo: '3',
-        // 费用代号
-        code: "A3",
-        // 名称
-        name: "机械费",
-        // 计算基数
-        dispExpr: "H_J",
-        // 基数说明
-        statement: "合计",
-        // 费率
-        feeRate: 0,
-        // 费用类别
-        type: 'machine',
-        // 备注
-        memo: ''
-    }, {
-        ID: 5,
-        // 序号
-        serialNo: '二',
-        // 费用代号
-        code: "A4",
-        // 名称
-        name: "管理费",
-        // 计算基数
-        dispExpr: "A",
-        // 基数说明
-        statement: "定额直接费",
-        // 费率
-        feeRate: 0,
-        // 费用类别
-        type: 'management',
-        // 备注
-        memo: ''
-    }, {
-        ID: 6,
-        // 序号
-        serialNo: '三',
-        // 费用代号
-        code: "B",
-        // 名称
-        name: "利润",
-        // 计算基数
-        dispExpr: "A",
-        // 基数说明
-        statement: "定额直接费",
-        // 费率
-        feeRate: 0,
-        // 费用类别
-        type: 'profit',
-        // 备注
-        memo: ''
-    }, {
-        ID: 7,
-        // 序号
-        serialNo: '四',
-        // 费用代号
-        code: "C",
-        // 名称
-        name: "风险费用",
-        // 计算基数
-        dispExpr: "",
-        // 基数说明
-        statement: "",
-        // 费率
-        feeRate: null,
-        // 费用类别
-        type: 'risk',
-        // 备注
-        memo: ''
-    }, {
-        ID: 8,
-        // 序号
-        serialNo: '',
-        // 费用代号
-        code: "",
-        // 名称
-        name: "综合单价",
-        // 计算基数
-        dispExpr: "A+B",
-        // 基数说明
-        statement: "定额直接费+利润",
-        // 费率
-        feeRate: NaN,
-        // 费用类别
-        type: 'common',
-        // 备注
-        memo: ''
-    }
-];*/
-
-/*class BillsCalcHelper {
-    constructor (project, calcFlag) {
-        this.project = project;
-        this.InitFields(project.calcFields);
-    };
-    getBillsGLjs (node) {
-        let rations = this.project.Ration.getBillsSortRation(node.source.getID());
-        let gljs = this.project.ration_glj.getGatherGljArrByRations(rations);
-        for (let glj of gljs) {
-            glj.quantity = (glj.quantity / calcFees.getFee(node.data, 'quantity')).toDecimal(4);
-        }
-        return gljs;
-    };
-    calcRationLeaf (node, fields, isIncre) {
-        nodeCalcObj.node = node;
-        nodeCalcObj.digit = this.project.Decimal.common.unitFee;
-        calcFees.checkFields(node.data, fields);
-        let nodeCalc = nodeCalcObj, virData= null, decimal = this.project.Decimal;
-
-        // 清单单价:套用定额计算程序
-        // if (this.project.projSetting.billsCalcMode === billsPrice) {
-/!*        if (this.project.property.billsCalcMode === leafBillGetFeeType.billsPrice) {
-            rationCalcObj.calcGljs = this.getBillsGLjs(node);
-            console.log(rationCalcObj.calcGljs);
-            rationCalcObj.calcFields = rationCalcFields;
-            virData = rationCalcObj.calculate();
-        }*!/
-
-        for (let field of fields) {
-            nodeCalcObj.field = field;
-            switch (field.unitFeeFlag) {
-                case rationContentUnitFeeFlag:
-                    node.data.feesIndex[field.type].unitFee = nodeCalcObj.rationContentUnitFee().toDecimal(decimal.common.unitFee);
-                    break;
-                case averageQtyUnitFeeFlag:
-                    node.data.feesIndex[field.type].unitFee = nodeCalcObj.averageQty().toDecimal(decimal.common.unitFee);
-                    break;
-                case billsPriceUnitFeeFlag:
-                    node.data.feesIndex[field.type].unitFee = virData[field.type];
-                    break;
-                case converseUnitFeeFlag:
-                    node.data.feesIndex[field.type].unitFee = nodeCalcObj.converseUnitFee(decimal.common.totalFee).toDecimal(decimal.common.unitFee);
-                    break;
-                default:
-                    node.data.feesIndex[field.type].unitFee = 0;
-            }
-            let value = 0;
-            switch (field.totalFeeFlag) {
-                case sumTotalFeeFlag:
-                    value = nodeCalcObj.sumTotalFee().toDecimal(decimal.common.totalFee);
-                    break;
-                case totalFeeFlag:
-                    value = nodeCalcObj.totalFee().toDecimal(decimal.common.totalFee);
-                    break;
-                default:
-                    value = 0;
-            }
-            this.setTotalFee(node, field, value, isIncre);
-        }
-    };
-    calcVolumePriceLeaf (node, fields, isIncre) {
-        let total = 0;
-        for (let child of node.children) {
-            total += calcFees.getFee(child.data, 'feesIndex.common.totalFee');
-        }
-    };
-    calcParent (node, fields, isIncre) {
-        nodeCalcObj.node = node;
-        calcFees.checkFields(node.data, fields);
-        for (let field of fields) {
-            nodeCalcObj.field = field;
-            let value = nodeCalcObj.sumTotalFee().toDecimal(this.project.Decimal.common.totalFee);
-            this.setTotalFee(node, field, value, isIncre);
-        }
-    };
-    clearFeeFields(node, fields, isIncre) {
-        for (let field of fields) {
-            node.data.feesIndex[field.type].unitFee = 0;
-            this.setTotalFee(node, field, 0, isIncre);
-        }
-    }
-    calcNode(node, isIncre) {
-        if (node.source.children.length > 0) {
-            this.calcParent(node, this.project.calcFields, isIncre);
-        } else {
-            if (node.children.length > 0) {
-                if (node.firstChild().sourceType === this.project.Ration.getSourceType()) {
-                    this.calcRationLeaf(node, this.project.calcFields, isIncre);
-                } else {
-                    this.calcVolumePriceLeaf(node, this.project.calcFields, isIncre);
-                }
-            } else {
-                this.clearFeeFields(node, this.project.calcFields, isIncre);
-            }
-        }
-    };
-    calcNodes (nodes) {
-        for (let node of nodes) {
-            if (node.sourceType !== this.project.Bills.getSourceType()) {
-                return;
-            }
-            if (node.source.children.length > 0) {
-                this.calcNodes(node.children);
-            }
-            this.calcNode(node);
-        }
-    };
-    updateParent (parent, field, Incre) {
-        if (parent && parent.sourceType === this.project.Bills.getSourceType()) {
-            calcFees.checkFields(parent.data, [field]);
-            parent.data.feesIndex[field.type].totalFee = (parent.data.feesIndex[field.type].totalFee + Incre).toDecimal(this.project.Decimal.common.totalFee);
-            parent.data.feesIndex[field.type].unitFee = 0;   // AAAAA 临时补上,使存储 unitFee.toFixed(2) 时不出错
-            this.updateParent(parent.parent, field, Incre);
-        }
-    };
-    setTotalFee (node, field, value, isIncre) {
-        if (isIncre) {
-            let incre = value - node.data.feesIndex[field.type].totalFee;
-            node.data.feesIndex[field.type].totalFee = value;
-            node.data.feesIndex[field.type].unitFee = 0; // AAAAA 临时补上,使存储 unitFee.toFixed(2) 时不出错
-            this.updateParent(node.parent, field, incre);
-        } else {
-            node.data.feesIndex[field.type].totalFee = value;
-            node.data.feesIndex[field.type].unitFee = 0; // AAAAA 临时补上,使存储 unitFee.toFixed(2) 时不出错
-        }
-    };
-    converseCalc (node) {
-        if (node && node.sourceType === this.project.Bills.getSourceType()) {
-            this.calcNode(node);
-            this.converseCalc(node.parent);
-        }
-    };
-    calcAll () {
-        this.calcNodes(this.project.mainTree.roots);
-    };
-    InitFields (fields) {
-        for (let field of fields) {
-            if (field.unitFee) return;
-            field.unitFee = 'feesIndex.' + field.type + '.unitFee';
-            field.unitFeeSplit = field.unitFee.split('.');
-            field.totalFee = 'feesIndex.' + field.type + '.totalFee';
-            field.totalFeeSplit = field.totalFee.split('.');
-            field.tenderUnitFee = 'feesIndex.'+ field.type + '.tenderUnitFee';
-            field.tenderUnitFeeSplit = field.tenderUnitFee.split('.');
-            field.tenderTotalFee = 'feesIndex.' + field.type + '.tenderTotalFee';
-            field.tenderTotalFeeSplit = field.tenderTotalFee.split('.');
-        }
-    };
-}*/

+ 14 - 14
web/building_saas/main/js/models/calc_program.js

@@ -1629,7 +1629,7 @@ class CalcProgram {
         me.compiledFeeTypeMaps = {};
         me.compiledFeeTypeNames = [];
         me.compiledCalcBases = {};
-        me.saveForReports = [];
+        // me.saveForReports = [];
 
         me.feeRates = this.project.FeeRate.datas.rates;
         me.labourCoes = this.project.labourCoe.datas.coes;
@@ -1647,16 +1647,16 @@ class CalcProgram {
 
 
         // 存储费率临时数据,报表用。
-        if (isInit && me.saveForReports.length > 0){
-            let saveDatas = {};
-            saveDatas.projectID = projectObj.project.projectInfo.ID;
-            saveDatas.calcItems = me.saveForReports;
-            CommonAjax.post('/calcProgram/saveCalcItems', saveDatas, function (result) {
-                if (result){
-                    me.saveForReports = [];
-                };
-            });
-        };
+        // if (isInit && me.saveForReports.length > 0){
+        //     let saveDatas = {};
+        //     saveDatas.projectID = projectObj.project.projectInfo.ID;
+        //     saveDatas.calcItems = me.saveForReports;
+        //     CommonAjax.post('/calcProgram/saveCalcItems', saveDatas, function (result) {
+        //         if (result){
+        //             me.saveForReports = [];
+        //         };
+        //     });
+        // };
     };
 
     compilePublics(){
@@ -1756,9 +1756,9 @@ class CalcProgram {
                     let cfr = me.compiledFeeRates[item.feeRateID];
                     item.feeRate = cfr ? cfr.rate : 100;
 
-                    if (!orgFeeRate || (orgFeeRate && orgFeeRate != item.feeRate)){
-                        me.saveForReports.push({templatesID: template.ID, calcItem: item});
-                    }
+                    // if (!orgFeeRate || (orgFeeRate && orgFeeRate != item.feeRate)){
+                    //     me.saveForReports.push({templatesID: template.ID, calcItem: item});
+                    // }
                 };
 
                 // 字段名映射

+ 26 - 1
web/building_saas/main/js/models/installation_fee.js

@@ -742,6 +742,17 @@ var installation_fee = {
             });
         };
 
+        installation_fee.prototype.setRationInstallToDefual = function(){
+           let ration_install=projectObj.project.ration_installation;
+           let rationInstallations = [];
+           for(let ri of ration_install.datas){
+              if(ri.unifiedSetting == 0 || ri.ruleId!==""){
+                rationInstallations.push({ID:ri.ID,doc:{'ruleId':"",unifiedSetting:1}});
+              }
+           } 
+           return rationInstallations;
+        }
+
         installation_fee.prototype.resetToDefault = function (callback) {
             let me = this;
             let installFees = [];
@@ -753,10 +764,24 @@ var installation_fee = {
                 installFees.push(ins);
             }
             //data.projectID,data.installFees
+            let rationInstallations = me.setRationInstallToDefual();
+
+
             $.bootstrapLoading.start();
-            CommonAjax.post("/installation/resetToDefault",{projectID:project.ID(),installFees:installFees},function (result) {
+            CommonAjax.post("/installation/resetToDefault",{projectID:project.ID(),installFees:installFees,rationInstallations:rationInstallations},function (result) {
                 console.log(result)
                 me.datas = result;
+                 //更新定额安装费的缓存
+                 if(rationInstallations.length > 0){
+                  for(let ri of rationInstallations){
+                      let c_ri = project.ration_installation.getByID(ri.ID);
+                      if(c_ri){
+                          for(let rkey in ri.doc){
+                              c_ri[rkey] = ri.doc[rkey];
+                          }
+                      }
+                  }
+                }
                 if(callback){
                     callback();
                 }

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

@@ -79,6 +79,7 @@ let calcProgramManage = {
         me.detailSheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onDetailEnterCell);
         me.detailSheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
         sheetCommonObj.showData(me.mainSheet, me.mainSetting, me.datas);
+        me.mainSheet.setRowCount(me.datas.length);
 
         me.detailSheet.name('calc_detail');
         feeRateObject.setFeeRateCellCol(me.detailSheet, _.findIndex(me.detailSetting.header,{'dataCode':'feeRate'}));

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

@@ -790,9 +790,9 @@ var gljOprObj = {
         let calcOptions=projectObj.project.projectInfo.property.calcOptions;
         let decimalObj = projectObj.project.projectInfo.property.decimal;
         let labourCoeDatas =  projectObj.project.labourCoe.datas;
-        let tenderCoe = projectObj.project.projectGLJ.getTenderPriceCoe(glj);
         glj = glj?glj:_.find(proGLJ.datas.gljList, {'id': data.projectGLJID});
         if(glj){
+            let tenderCoe = projectObj.project.projectGLJ.getTenderPriceCoe(glj);
             let result = gljUtil.getGLJPrice(glj,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,tenderCoe);
             data.marketPrice = result.marketPrice;
             data.tenderPrice = result.tenderPrice;

+ 2 - 2
web/building_saas/main/js/views/project_view.js

@@ -2480,8 +2480,8 @@ $('#poj-set').on('show.bs.modal', function () {
     }
     if (projectObj.project) {
         //江西重定义了leafBillGetFeeType的内容
-        let ft = projectObj.project.property.billsCalcMode !== undefined &&
-                 projectObj.project.property.billsCalcMode !== null ? projectObj.project.property.billsCalcMode : leafBillGetFeeType.rationContent;
+        let ft = (projectObj.project.property.billsCalcMode !== undefined && projectObj.project.property.billsCalcMode !== null) ?
+            projectObj.project.property.billsCalcMode : leafBillGetFeeType.rationContent;   // 广东默认取1不是0,但这里不动,防止这种情况:旧项目默认无值,按取0算的,你改成1了,计算结果会变。
         let zg = projectObj.project.property.zanguCalcMode !== undefined &&
                  projectObj.project.property.zanguCalcMode !== null ? projectObj.project.property.zanguCalcMode : zanguCalcType.common;
         setCalcFlag($('#rationContent'), leafBillGetFeeType.rationContent, ft);

+ 5 - 0
web/building_saas/main/js/views/tender_price_view.js

@@ -500,6 +500,11 @@ $(function () {
             }
             tender_obj.showTenderData();
             projectObj.project.projectGLJ.calcQuantity();
+            // 刷新造价书界面的相关显示。刷新放在这里是为了切换UI时体验更流畅。
+            if($('#linkJSCX').hasClass('active'))
+                calcProgramObj.refreshCalcProgram(projectObj.project.mainTree.selected, 2)
+            if($('#linkGLJ').hasClass('active'))
+                gljOprObj.refreshView();
         };
         projectObj.project.calcProgram.doTenderCalc(callback);
     });

+ 1 - 1
web/over_write/js/chongqing_2018.js

@@ -51,7 +51,7 @@ let isCQ2018 = true;
 
 if(typeof baseMaterialTypes !== 'undefined'){
     baseMaterialTypes.push(gljType.OTHER_MATERIAL);
-    allMaterialTypes.delete(gljType.EQUIPMENT);
+    // allMaterialTypes.delete(gljType.EQUIPMENT);  新规定里重庆材料类型里需要包含设备费。
     baseMachineTypes.delete(gljType.MACHINE_COMPOSITION);
     baseMachineTypes.push(gljType.INSTRUMENT, gljType.FUEL_POWER_FEE, gljType.DEPRECIATION_FEE,
         gljType.INSPECTION_FEE, gljType.MAINTENANCE, gljType.DISMANTLING_FREIGHT_FEE,

+ 17 - 2
web/over_write/js/guangdong_2018.js

@@ -18,7 +18,7 @@ function overwriteRationCalcBases (){
     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);
     };
     rationCalcBases['主材费'] = function (node, isTender) {
@@ -31,7 +31,7 @@ function overwriteRationCalcBases (){
     rationCalcBases['管理费'] = function (node, isTender) {
         let rst = 0;
         if (calcTools.isRationItem(node) && node.data.gljList && node.data.manageFeeRate) {
-            rst = (rationCalcBases['人工费'](node, isTender) + rationCalcBases['施工机具费'](node, isTender)) * node.data.manageFeeRate * 0.01;
+            rst = (rationCalcBases['人工费'](node, isTender) + rationCalcBases['机具费'](node, isTender)) * node.data.manageFeeRate * 0.01;
             rst = rst.toDecimal(decimalObj.ration.unitPrice);
         };
         return rst;
@@ -214,4 +214,19 @@ if (typeof commonConstants !== 'undefined') {
         '{暂估材料费(从子目汇总)}': 'ZGCLFCZMHZ', // 自增
         '{税金}': 'SJ',
     };
+}
+
+if(typeof module !== 'undefined'){
+    module.exports = {
+        getBillsCalcMode: getBillsCalcMode,
+        getAreaName: getAreaName
+    };
+}
+
+function getBillsCalcMode() {
+    return 1
+}
+
+function getAreaName() {
+    return 'guangdong_2018'
 }