Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

vian 5 gadi atpakaļ
vecāks
revīzija
e454290ec2

+ 4 - 0
modules/all_models/engineering_lib.js

@@ -107,6 +107,10 @@ let modelSchema = {
     engineering:Number,
     //是否计算安装增加费
     isInstall:{type: Boolean, default: false},
+    //是否计算子目增加费
+    isItemIncrease:{type: Boolean, default: false},
+    //是否计算面积增加费
+    isAreaIncrease:{type: Boolean, default: false},
     indexName:String,//指标专业名称
     seq:Number//序列号
 };

+ 11 - 2
modules/main/facade/project_facade.js

@@ -14,7 +14,8 @@ module.exports = {
     getSEIProjects:getSEIProjects,
     loadSEIProjectData:loadSEIProjectData,
     setSEILibData:setSEILibData,
-    getIndexReportData:getIndexReportData
+    getIndexReportData:getIndexReportData,
+    setDefaultItemIncrease:setDefaultItemIncrease
 };
 
 let mongoose = require('mongoose');
@@ -51,7 +52,6 @@ async function calcInstallationFee(data) {
     if(billTasks.length>0){
         await bill_model.model.bulkWrite(billTasks);
     }
-    console.log(rationTasks);
     if(rationTasks.length>0){
         await ration_model.model.bulkWrite(rationTasks);
     }
@@ -556,6 +556,15 @@ async function setSEILibData(property){
     }
 }
 
+function setDefaultItemIncrease(property) {
+    property.itemIncreaseSetting = [
+        {"name":"在生产车间边生产边施工","base":"人工费","coe":10,"scope":{}},
+        {"name":"在有害身体健康的场所内施工","base":"人工费","coe":10,"scope":{}},
+        {"name":"在洞内、地下室内、库内或暗室内进行施工","base":"人工费","coe":40,"scope":{}},
+        {"name":"在洞内、地下室内、库内或暗室内进行施工(模板拆除)","base":"人工费","coe":10,"scope":{}}
+    ]
+}
+
 async function getIndexReportData(projectID,keyArr) {
     let project = await projectsModel.findOne({ID:projectID});
     let bills = await bill_model.getDataSync(projectID);

+ 4 - 1
modules/main/facade/ration_facade.js

@@ -228,6 +228,9 @@ async function addRationSubList(stdRation,newRation,needInstall,compilation,clea
         console.log("添加定额install时间-----"+(addRationInstallFeeTime - addRationCoeTime));
         //添加定额模板子目
         ration_template = await addRationTemplate(stdRation,newRation);
+    }else if(newRation.areaIncreaseFee == true){//清空子目换算时,如果有面积增加费,子目调整状态要生成
+        let t = await glj_calculate_facade.calculateQuantity({rationID:newRation.ID},true);
+        newRation.adjustState = t.adjustState;
     }
     return {ration:newRation,ration_gljs:ration_gljs,ration_coes:ration_coes,ration_installations:ration_installations,ration_templates:ration_template?[ration_template]:[]};
 }
@@ -577,7 +580,7 @@ async function  updateRation(std,defaultLibID,rationID,billsItemID,projectID,cal
          "marketUnitFee":1,
          'marketTotalFee':1,
          "maskName":1
-     }
+     };
     let newRation = await ration_model.model.findOneAndUpdate({ID:rationID,projectID:projectID},{"$set":ration,"$unset":unsetObject},{new: true});//;
     return newRation;
 }

+ 4 - 0
modules/pm/models/project_model.js

@@ -192,6 +192,10 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     if(data.updateData.property.isInstall == true || data.updateData.property.isInstall=='true'){//判断是否安装工程
                         await installationFacade.copyInstallationFeeFromLib(data.updateData.ID,data.updateData.property.engineering_id);
                     }
+                    //子目增加费
+                    if(data.updateData.property.isItemIncrease == true || data.updateData.property.isItemIncrease=='true'){//判断是否需计算子目增加费
+                        projectFacade.setDefaultItemIncrease(data.updateData.property);
+                    }
                     //锁定清单
                     data.updateData.property.lockBills = false;
                     //工料机单价调整系数

+ 1 - 1
modules/ration_glj/facade/glj_calculate_facade.js

@@ -57,7 +57,7 @@ async function calculateQuantity(query,noNeedCal,refreshRationName = false,areaI
          if(!impactRation){//如果定额不存在或者已删除,返回空
              return null;
          }
-        if(areaIncreaseFee !== null || areaIncreaseFee !== undefined) impactRation.areaIncreaseFee = areaIncreaseFee;
+        if(areaIncreaseFee !== null && areaIncreaseFee !== undefined) impactRation.areaIncreaseFee = areaIncreaseFee;
          if(impactRation._doc.hasOwnProperty("rationAssList")&&impactRation.rationAssList.length>0){
              let temTimes = [];
              let thirdRationCodes=[];

+ 2 - 0
web/building_saas/main/js/models/calc_program.js

@@ -1873,6 +1873,8 @@ class CalcProgram {
                     ftObj.fieldName = 'common';
                     ftObj.unitFee = parseFloatPlus(treeNode.data.feesIndex.common.unitFee);
                     ftObj.totalFee = (ftObj.unitFee * nQ).toDecimal(decimalObj.bills.totalPrice);
+                    ftObj.tenderUnitFee = ftObj.unitFee;
+                    ftObj.tenderTotalFee = (ftObj.tenderUnitFee * nTQ).toDecimal(decimalObj.bills.totalPrice);
                     calcTools.checkFeeField(treeNode, ftObj);
                 }
             } else{

+ 6 - 2
web/building_saas/main/js/views/area_increase_fee_view.js

@@ -23,7 +23,9 @@ let areaIncreaseFeeObj = {
         datas.push(data);
         setChildren(node,newval,datas);//同步设置所有子项
         let nodes = await projectObj.project.syncUpdateNodesAndRefresh(datas);
-        projectObj.project.calcProgram.calcNodesAndSave(nodes);
+        projectObj.project.calcProgram.calcNodesAndSave(nodes,function () {
+            OVER_HEIGHT.reCalcOverHeightFee();
+        });
 
 
         function setChildren(pnode,newValue,datas) {//同步设置所有子项
@@ -113,7 +115,9 @@ let areaIncreaseFeeObj = {
             d.data.areaIncreaseFee = false;
         }
         let nodes = await projectObj.project.syncUpdateNodesAndRefresh(datas);
-        projectObj.project.calcProgram.calcNodesAndSave(nodes);
+        projectObj.project.calcProgram.calcNodesAndSave(nodes,function () {
+            OVER_HEIGHT.reCalcOverHeightFee();
+        });
     }
     
 };

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

@@ -1508,7 +1508,7 @@ var projectObj = {
                     name:"面积增加费",
                     icon: 'fa-sign-in',
                     visible:function () {
-                        return typeof cpFeeTypes != 'undefined';
+                        return  projectObj.project.property.isAreaIncrease == true;
                     },
                     items:{
                         "calcAreaIncreaseFee":{
@@ -1538,6 +1538,31 @@ var projectObj = {
                         }
                     }
                 },
+                "itemIncreaseFee":{
+                    name:"子目增加费",
+                    icon: 'fa-sign-in',
+                    visible:function () {
+                        return  projectObj.project.property.isItemIncrease == true;
+                    },
+                    items:{
+                        "setItem":{
+                            name:"设置范围",
+                            icon: 'fa-sign-in',
+                            callback:function(){
+                                $("#areaIncreaseFeeDiv").modal('show');
+                            }
+                        },
+                        "cancelAreaIncreaseFee":{
+                            name:"取消子目增加费",
+                            icon: 'fa-sign-in',
+                            callback:function(){
+                                /*colSettingObj.setVisible('areaIncreaseFee', false);
+                                colSettingObj.updateColSetting(true);
+                                areaIncreaseFeeObj.cancelAreaIncreaseFee();*/
+                            }
+                        }
+                    }
+                },
                 "setBookMark": {
                     name: '设置书签批注',
                     icon: 'fa-flag',

+ 2 - 0
web/building_saas/pm/js/pm_import.js

@@ -257,6 +257,8 @@ const importView = (() => {
             engineeringName: curEngineering.lib.name,
             taxType: parseInt(tbcObj.taxType),    //计税方法
             isInstall: !!curEngineering.lib.isInstall,  //是安装工程?
+            isItemIncrease: !!curEngineering.lib.isItemIncrease,  //是否子目增加费?
+            isAreaIncrease: !!curEngineering.lib.isAreaIncrease,  //是否子目增加费?
             feeStandardName: curEngineering.lib.feeName,    //费用标准
             engineering: curEngineering.lib.engineering,    //定额取费专业
             projectEngineering: curEngineering.lib.projectEngineering,  //单位工程取费专业

+ 2 - 0
web/building_saas/pm/js/pm_newMain.js

@@ -3869,6 +3869,8 @@ function AddTender() {
             valuationType: valuationType,
             valuationName: valuationName,
             isInstall: libs.isInstall !== undefined ? libs.isInstall : false,
+            isItemIncrease: !!libs.isItemIncrease,
+            isAreaIncrease: !!libs.isAreaIncrease,
             engineering: libs.engineering,//定额默认取费专业
             projectEngineering:libs.projectEngineering,//单位工程默认取费专业(造价书中插入量价、工料机时用)
             engineering_id: libs._id,