Browse Source

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhangweicheng 7 years ago
parent
commit
d95bf4c52a

+ 2 - 2
modules/common/base/base_model.js

@@ -22,9 +22,9 @@ class BaseModel {
      * @return {void}
      */
     constructor() {
-        if (new.target === BaseModel) {
+/*        if (new.target === BaseModel) {
             throw new Error('BaseModel不能实例化,只能继承使用。');
-        }
+        }*/
     }
 
     /**

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

@@ -3,6 +3,7 @@
  */
 import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
 let ProjectsData = require('../models/project_model').project;
+let projectM = require('../../main/models/project');
 let projType = require('../models/project_model').projType;
 let fileType = require('../models/project_model').fileType;
 const engineering = require("../../common/const/engineering");
@@ -58,6 +59,25 @@ module.exports = {
             }
         });
     },
+    // 该方法主要用于项目属性位置提交保存混合型数据,这些数据来自不同的表,包括projects.property、ration、bills、labour_coes.
+    updateMixDatas: function(req, res){
+        let callBackInner = function (err, message, data) {
+            if (err === 0) {
+                callback(req, res, err, message, data);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        };
+        let datas = JSON.parse(req.body.data);
+        for (let data of datas){
+              if (data.sourceType == 'properties'){
+                  ProjectsData.updateUserProjects(req.session.sessionUser.ssoId, data.updateData, callBackInner);
+              }
+              else{
+                projectM.save(data, callBackInner);
+              }
+        };
+    },
     updateFiles: async function(req, res){
         let data = JSON.parse(req.body.data);
         let updateDatas = data.updateDatas;

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

@@ -13,7 +13,7 @@ const defaultDecimal = {
 };
 const displaySetting = {
     autoHeight:true,
-    disPlayMainMateria:true
+    disPlayMainMaterial:true
 }
 
 /*

+ 1 - 0
modules/pm/routes/pm_route.js

@@ -31,6 +31,7 @@ module.exports = function (app) {
      data.updateData.updateType: 1 of ['new', 'update', 'delete']
      */
     pmRouter.post('/updateProjects', pmController.updateProjects);
+    pmRouter.post('/updateMixDatas', pmController.updateMixDatas);
 
     /*
      req.body = {data: '{user_id: user_id, updateData: [{updateType, updateData}]}'}

+ 3 - 3
test/unit/reports/test_tpl_09_1.js

@@ -40,8 +40,8 @@ let demoRptId = 226, pagesize = "A4";
 
 let userId_Leng = 1142; //小冷User Id
 // demoPrjId = 720; //QA: DW3
-demoPrjId = 838; //QA:
-/*/
+demoPrjId = 1296; //QA:
+//*/
 let userId_Dft = userId_Leng;
 /*/
 let userId_Dft = 76075;
@@ -120,8 +120,8 @@ test('测试 - 测试模板啦: ', function (t) {
         rptTplDataFacade.prepareProjectData(userId_Dft, demoPrjId, filter, function (err, msg, rawDataObj) {
             if (!err) {
                 try {
-                    let tplData = rptDataUtil.assembleData(rawDataObj);
                     // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.js");
+                    let tplData = rptDataUtil.assembleData(rawDataObj);
                     //it's time to build the report!!!
                     let printCom = JpcEx.createNew();
                     rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pagesize;

+ 2 - 2
web/building_saas/main/html/main.html

@@ -448,13 +448,13 @@
                                         <fieldset class="form-group">
                                             <div class="form-check">
                                                 <label class="form-check-label">
-                                                    <input class="form-check-input" id="autoHeight" value="1" type="checkbox">
+                                                    <input class="form-check-input" id="autoHeight" type="checkbox">
                                                     造价书表格自动调整行高
                                                 </label>
                                             </div>
                                             <div class="form-check">
                                                 <label class="form-check-label">
-                                                    <input class="form-check-input" id="disPlayMainMaterial" value="1" type="checkbox">
+                                                    <input class="form-check-input" id="disPlayMainMaterial" type="checkbox">
                                                     定额下显示主材、设备
                                                 </label>
                                             </div>

+ 6 - 4
web/building_saas/main/js/main.js

@@ -7,7 +7,7 @@ $(function () {
     loadSize("main", function() {
         refreshSubSpread();
     });
-
+    $("#header-menu").removeAttr('style');
     projectInfoObj.showProjectInfo();
     projectObj.checkMainSpread();
     projectObj.loadProjectData();
@@ -79,12 +79,12 @@ function slideResize(rootElement, callback) {
             // 判断拖动范围不能超出
             topChangeHeight = topContentHeight + moveHeight;
             topChangeHeight = topChangeHeight < 170 ? 170 : topChangeHeight;
-            topChangeHeight = topChangeHeight > 700 ? 700 : topChangeHeight;
+            topChangeHeight = topChangeHeight > 700 ? 709 : topChangeHeight;
             topContentEle.children(".main-data-top").height(topChangeHeight);
 
             bottomChangeHeight = bottomContentHeight - moveHeight;
             bottomChangeHeight = bottomChangeHeight < 170 ? 170 : bottomChangeHeight;
-            bottomChangeHeight = bottomChangeHeight > 700 ? 700 : bottomChangeHeight;
+            bottomChangeHeight = bottomChangeHeight > 700 ? 709 : bottomChangeHeight;
             bottomContentEle.children().find(".main-data-bottom").height(bottomChangeHeight - navHeight);
         }
     });
@@ -96,6 +96,8 @@ function slideResize(rootElement, callback) {
             drag = false;
             // 存入本地缓存
             const id = rootElement.attr('id');
+            topChangeHeight = topChangeHeight >= 700 ? 709 : topChangeHeight;
+            bottomChangeHeight = bottomChangeHeight >= 700 ? 709 : bottomChangeHeight;
             setLocalCache('topHeight:' + id, topChangeHeight);
             setLocalCache('bottomHeight:' + id, bottomChangeHeight);
         }
@@ -123,6 +125,6 @@ function loadSize(tag, callback) {
     bottomHeight = parseFloat(bottomHeight);
     $("#"+ tag +" .main-data-top").height(topHeight);
     $("#"+ tag +" .main-data-bottom").height(bottomHeight - navHeight);
-    $("#"+ tag +" .bottom-content").height(bottomHeight);
+    // $("#"+ tag +" .bottom-content").height(bottomHeight);
     callback();
 }

+ 6 - 3
web/building_saas/main/js/models/calc_base.js

@@ -277,7 +277,7 @@ let baseFigureTemplate = {
         return 0;
     },
     'FBFXGCLQDJJZJGCF': function () {
-        return this['FBFXDEJJRGF']() + this['FBFXDEJJCLF']() + this['FBFXDEJJJXF']();
+        return (this['FBFXDEJJRGF']() + this['FBFXDEJJCLF']() + this['FBFXDEJJJXF']()).toDecimal(decimalObj.bills.totalPrice);
     },
     'CSXMF': function () {
         let bill = calcBase.fixedBills[calcBase.fixedFlag.MEASURE]['bill'];
@@ -292,7 +292,7 @@ let baseFigureTemplate = {
         return bill.feesIndex.common.totalFee || 0;
     },
     'ZZCSXMDEJJZJGCF': function () {
-        return this['ZZCSXMDEJJRGF']() + this['ZZCSXMDEJJCLF']() + this['ZZCSXMDEJJJXF']()
+        return (this['ZZCSXMDEJJRGF']() + this['ZZCSXMDEJJCLF']() + this['ZZCSXMDEJJJXF']()).toDecimal(decimalObj.bills.totalPrice);
     },
     'ZZCSXMDEJJRGF': function () {
         let bill = calcBase.fixedBills[calcBase.fixedFlag.CONSTRUCTION_ORGANIZATION]['bill'];
@@ -364,7 +364,7 @@ let baseFigureTemplate = {
         return 0;
     },
     'JSCSXMQDDEJJZJGCF': function () {
-        return this['JSCSXMDEJJRGF']() + this['JSCSXMDEJJCLF']() + this['JSCSXMDEJJJXF']();
+        return (this['JSCSXMDEJJRGF']() + this['JSCSXMDEJJCLF']() + this['JSCSXMDEJJJXF']()).toDecimal(decimalObj.bills.totalPrice);
     },
     'QTXMF': function () {
         let bill = calcBase.fixedBills[calcBase.fixedFlag.OTHER]['bill'];
@@ -579,6 +579,9 @@ let calcBase = {
     getBaseByClass: function (node) {
         return cbTools.getFigure(node);
     },
+    getBaseBill: function (node) {
+        return cbTools.getBaseBill(node);
+    },
     calculate: function (node) {
         let me = calcBase,
             $CBA = cbAnalyzer,

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

@@ -954,7 +954,8 @@ class CalcProgram {
         };
 
         calcNodes(me.project.mainTree.roots);
-        me.saveNodes(needSaveNodes);
+        // me.saveNodes(needSaveNodes);   保存要与计算分离,否则实际应用场景中,会产生多次通讯。
+        return needSaveNodes;
     };
 
     // 重新计算叶子清单下的所有子结点:如定额、工料机定额等(calculate算法基于定额、工料机定额的计算结果是正确的,实际上有时它们的计算结果并不是最新的)

+ 5 - 5
web/building_saas/main/js/models/fee_rate.js

@@ -243,7 +243,7 @@ var FeeRate = {
                 })
             }
             project.calcProgram.compileAllTemps();
-            rationPM.refreshDetailSheet();
+            calcProgramManage.refreshDetailSheet();
         }
         FeeRate.prototype.refreshCalProgramByRateID=function (rateID,value) {
             var templates = project.calcProgram.datas.templates;
@@ -255,7 +255,7 @@ var FeeRate = {
                 })
             }
             project.calcProgram.compileAllTemps();
-            rationPM.refreshDetailSheet();
+            calcProgramManage.refreshDetailSheet();
         };
         FeeRate.prototype.refreshBillsByRateID=function(rateID,value){
             var nodes = _.filter(projectObj.project.mainTree.items,function (n) {
@@ -379,12 +379,12 @@ var FeeRate = {
                 editInfo.calcItem.feeRate=value;
                 editInfo.calcItem.feeRateID=null;
                 var data={'projectID': projectObj.project.ID(),'templatesID': editInfo.template.ID,'calcItem': editInfo.calcItem};
-                rationPM.saveCalcItem(data,function (result) {
+                calcProgramManage.saveCalcItem(data,function (result) {
                     project.calcProgram.compileAllTemps();
-                    rationPM.refreshDetailSheet();
+                    calcProgramManage.refreshDetailSheet();
                 })
             }else {
-                rationPM.refreshDetailSheet();
+                calcProgramManage.refreshDetailSheet();
             }
         };
         FeeRate.prototype.updateFeeRateByCalc=function (rate,value) {

+ 2 - 1
web/building_saas/main/js/models/project.js

@@ -142,7 +142,8 @@ var PROJECT = {
                     newNode.source = br[i];
                     newNode.sourceType = that.Ration.getSourceType();
                     newNode.data = br[i];
-                    if(projectInfoObj.projectInfo.property.displaySetting.disPlayMainMateria==true){
+                    if(projectInfoObj.projectInfo.property.displaySetting !== undefined &&
+                        projectInfoObj.projectInfo.property.displaySetting.disPlayMainMaterial==true){
                         loadRationGLJNode(newNode);
                     }
                 }

+ 1 - 1
web/building_saas/main/js/models/project_glj.js

@@ -184,7 +184,7 @@ ProjectGLJ.prototype.updateBasePriceFromRG=function(recode,updateField,newval){
     }
 }
 ProjectGLJ.prototype.refreshTreeNodePriceIfNeed = function (data) {
-    if((data.unit_price.type = gljType.MAIN_MATERIAL||data.type==gljType.EQUIPMENT)&&projectInfoObj.projectInfo.property.displaySetting.disPlayMainMateria==true){
+    if((data.unit_price.type = gljType.MAIN_MATERIAL||data.type==gljType.EQUIPMENT)&&projectInfoObj.projectInfo.property.displaySetting.disPlayMainMaterial==true){
         var nodes = _.filter(projectObj.project.mainTree.items,function (tem) {
             if(tem.sourceType==ModuleNames.ration_glj&&tem.data.projectGLJID ==data.id){
                 tem.data.marketUnitFee = data.unit_price.market_price;

+ 4 - 4
web/building_saas/main/js/views/calc_program_manage.js

@@ -2,7 +2,7 @@
  * Created by CSL on 2017-08-03.
  * 计算程序管理。
  */
-let rationPM = {
+let calcProgramManage = {
     datas: [],
     mainSpread: null,
     detailSpread: null,
@@ -68,7 +68,7 @@ let rationPM = {
         sheetCommonObj.showData(dSheet, me.detailSetting, me.datas[0].calcItems);
     },
     onMainEnterCell: function(sender, args) {
-        var me = rationPM;
+        var me = calcProgramManage;
         var row = args.sheet.getActiveRowIndex();
 
         me.detailSpread.suspendPaint();
@@ -79,7 +79,7 @@ let rationPM = {
         me.detailSpread.resumePaint();
     },
     onEditEnded: function(sender, args) {
-        var me = rationPM;
+        var me = calcProgramManage;
         if(me.detailSetting.header[args.col].dataCode=='feeRate'){
             var editInfo= me.getSelectionInfo();
             projectObj.project.FeeRate.updateFeeRateFromCalc(args.editingText,editInfo);
@@ -126,7 +126,7 @@ let rationPM = {
 $(document).ready(function(){
     $('#tab_calc_program_manage').on('shown.bs.tab', function (e) {
         $(e.relatedTarget.hash).removeClass('active');
-        rationPM.buildSheet();
+        calcProgramManage.buildSheet();
     });
 });
 

+ 3 - 3
web/building_saas/main/js/views/fee_rate_view.js

@@ -660,14 +660,14 @@ var feeRateObject={
     },
     submitFeeRateFromCalc:function () {
         var rate = feeRateObject.feeRateSelection;
-        var calInfo = rationPM.getSelectionInfo();
+        var calInfo = calcProgramManage.getSelectionInfo();
         calInfo.calcItem.feeRateID=rate.ID;
         calInfo.calcItem.feeRate=null;
         var data={'projectID': projectObj.project.ID(),'templatesID': calInfo.template.ID,'calcItem': calInfo.calcItem};
-        rationPM.saveCalcItem(data,function (result) {
+        calcProgramManage.saveCalcItem(data,function (result) {
             calInfo.calcItem.feeRate=rate.rate;
             projectObj.project.calcProgram.compileAllTemps();
-            rationPM.refreshDetailSheet();
+            calcProgramManage.refreshDetailSheet();
             $("#fee_rate_tree").modal('hide');
         });
         console.log(calInfo);

+ 16 - 8
web/building_saas/main/js/views/project_property_decimal_view.js

@@ -178,20 +178,28 @@ function v_initPanel(data){
 function e_validIn(inputs){
     for(let i = 0, len = inputs.length; i < len; i++){
         let orgV = $(inputs[i]).val();
-        $(inputs[i]).keydown(function () {
-            let v = $(this).val();
-            if(v.trim().length > 0 && isValidDigit(v)){
-                orgV = v;
-            }
-        });
-        $(inputs[i]).keyup(function () {
+        $(inputs[i]).bind('input', function () {
             let v = $(this).val();
+            let inputName = $(this).attr('name');
             if(v.trim().length === 0 || !isValidDigit(v)){
                 alert('小数位数范围在0-6!');
                 $(this).val(orgV);
             }
             else{
-                //let newV = parseInt(v);
+                orgV = v;
+                //清单单价、合价 与定额单价、合价同步
+                if(inputName === 'bills-unitPrice'){
+                    $("input[name='ration-unitPrice']").val(v);
+                }
+                else if(inputName === 'bills-totalPrice'){
+                    $("input[name='ration-totalPrice']").val(v);
+                }
+                else if(inputName === 'ration-unitPrice'){
+                    $("input[name='bills-unitPrice']").val(v);
+                }
+                else if(inputName === 'ration-totalPrice'){
+                    $("input[name='bills-totalPrice']").val(v);
+                }
             }
         });
     }

+ 8 - 5
web/building_saas/main/js/views/project_property_display_view.js

@@ -12,6 +12,9 @@ let projDisplayView = {
  },
 
     needUpdate: function(autoHeight, disPlayMainMaterial) {
+        if(this.datas==null){
+            return;
+        }
         return autoHeight !== this.datas.autoHeight || disPlayMainMaterial !== this.datas.disPlayMainMaterial;
     },
 
@@ -20,13 +23,13 @@ let projDisplayView = {
             return;
         }
         var autoHeight = $('#autoHeight').prop('checked');
-        var disPlayMainMateria = $('#disPlayMainMateria').prop('checked');
-        if(this.datas.autoHeight!==autoHeight||this.datas.disPlayMainMateria!==disPlayMainMateria){
+        var disPlayMainMaterial = $('#disPlayMainMaterial').prop('checked');
+        if(this.datas.autoHeight!==autoHeight||this.datas.disPlayMainMaterial!==disPlayMainMaterial){
             this.datas.autoHeight=autoHeight;
-            this.datas.disPlayMainMateria=disPlayMainMateria;
+            this.datas.disPlayMainMaterial=disPlayMainMaterial;
+            let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting':this.datas}};
+            properties.push(updateData);
         }
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.displaySetting':this.datas}};
-        properties.push(updateData);
     }
 };
 

+ 11 - 3
web/building_saas/main/js/views/project_property_labour_coe_view.js

@@ -131,7 +131,15 @@ let labourCoeView = {
         me.loadData(datas);
     },
 
-    save(){
+    refresh(data){
+        let me = this;
+        projectObj.project.labourCoe.refreshData(data);
+        me.needUpdateDatas.splice(0, me.needUpdateDatas.length);
+        $("#std_labour_coe_files").val('');
+        calcProgramManage.buildSheet();
+    }
+
+/*  save(){
         let me = this;
         if (me.needUpdateDatas.length > 0){
             let projectID = projectInfoObj.projectInfo.ID;
@@ -143,11 +151,11 @@ let labourCoeView = {
                 me.needUpdateDatas.splice(0, me.needUpdateDatas.length);
                 projectObj.project.calcProgram.compileAllTemps();
                 projectObj.project.calcProgram.calcAllNodes(calcAllType.catRations);
-                rationPM.buildSheet();
                 $("#std_labour_coe_files").val('');
+                calcProgramManage.buildSheet();
             });
         }
-    }
+    }*/
 };
 
 $(document).ready(function(){

+ 81 - 33
web/building_saas/main/js/views/project_view.js

@@ -399,7 +399,8 @@ var projectObj = {
                 that.project.projSetting.mainGridSetting = JSON.parse(str);
                 that.project.projSetting.mainGridSetting.frozenCols = 4;
                 TREE_SHEET_HELPER.initSetting($('#billsSpread')[0], that.project.projSetting.mainGridSetting);
-                const autoHeight = that.project.property.displaySetting.autoHeight;
+                const autoHeight = that.project.property.displaySetting !== undefined ?
+                    that.project.property.displaySetting.autoHeight : false;
                 that.project.projSetting.mainGridSetting.cols.forEach(function (col) {
                     // for test.  后端没有绑定,暂时写死用于测试。
 /*                    if (col.data.field == '' && col.head.titleNames[0] == "取费专业") {
@@ -557,8 +558,8 @@ var projectObj = {
                 "calculateAll_RationContent": {
                     name: '造价计算',
                     callback: function () {
-                        // projectObj.calculateAll();
-                        project.calcProgram.calcAllNodes();
+                        let changedNodes = project.calcProgram.calcAllNodes();
+                        project.calcProgram.saveNodes(changedNodes);
                     }
                 }
             }
@@ -689,74 +690,121 @@ $('#poj-set').on('show.bs.modal', function () {
     if (projectObj.project) {
         // let mode = projectObj.project.projSetting.billsCalcMode;
         // let settingConst = projectObj.project.projSetting.settingConst;
-        let mode = projectObj.project.property.billsCalcMode ? projectObj.project.property.billsCalcMode : leafBillGetFeeType.rationContent;
-        setCalcFlag($('#rationContent'), leafBillGetFeeType.rationContent, mode);
-        setCalcFlag($('#rationPriceConverse'), leafBillGetFeeType.rationPriceConverse, mode);
-        setCalcFlag($('#rationPrice'), leafBillGetFeeType.rationPrice, mode);
-        setCalcFlag($('#billsPrice'), leafBillGetFeeType.billsPrice, mode);
+        let ft = projectObj.project.property.billsCalcMode ? projectObj.project.property.billsCalcMode : leafBillGetFeeType.rationContent;
+        setCalcFlag($('#rationContent'), leafBillGetFeeType.rationContent, ft);
+        setCalcFlag($('#rationPriceConverse'), leafBillGetFeeType.rationPriceConverse, ft);
+        setCalcFlag($('#rationPrice'), leafBillGetFeeType.rationPrice, ft);
+        setCalcFlag($('#billsPrice'), leafBillGetFeeType.billsPrice, ft);
 
         // mode = projectObj.project.projSetting.zanguCalcType;
-        mode = projectObj.project.property.zanguCalcMode ? projectObj.project.property.zanguCalcMode : zanguCalcType.common;
-        setCalcFlag($('#zangu_common'), zanguCalcType.common, mode);
-        setCalcFlag($('#zangu_gatherMaterial'), zanguCalcType.gatherMaterial, mode);
+        let zg = projectObj.project.property.zanguCalcMode ? projectObj.project.property.zanguCalcMode : zanguCalcType.common;
+        setCalcFlag($('#zangu_common'), zanguCalcType.common, zg);
+        setCalcFlag($('#zangu_gatherMaterial'), zanguCalcType.gatherMaterial, zg);
     }
 });
 $('#property_ok').click(function () {
     let properties = [], projectID = parseInt(scUrlUtil.GetQueryString('project'));
-    let project = projectObj.project, reCalc= false;
+    let project = projectObj.project, reCalcBills= false, reCalcRations= false;
     let b = parseInt($("input[name='calcFlag']:checked").val());
+
     if (b !== project.property.billsCalcMode) {
-        let data1 = {updateType: 'update', updateData: {ID: projectID, 'property.billsCalcMode': b}};
-        properties.push(data1);
+        let bData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.billsCalcMode': b}};
+        properties.push(bData);
         project.property.billsCalcMode = b;
-        reCalc = true;
+        reCalcBills = true;
     };
 
     let zg = parseInt($("input[name='zangu']:checked").val());
     if (zg !== project.property.zanguCalcMode) {
-        let data2 = {updateType: 'update', updateData: {ID: projectID, 'property.zanguCalcMode': zg}};
-        properties.push(data2);
+        let zgData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.zanguCalcMode': zg}};
+        properties.push(zgData);
         project.property.zanguCalcMode = zg;
-        reCalc = true;
+        reCalcBills = true;
     };
 
-    if (labourCoeView.needSave()){
-        labourCoeView.save();
-        reCalc = true;
-    }
-
-    if (reCalc) {
-        project.calcProgram.calcAllNodes(calcAllType.catBills);
-    }
     //基本信息
     if(basicInfoView.toUpdate(basicInfoView.orgDatas, basicInfoView.datas)){
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.basicInformation': basicInfoView.toSaveDatas(basicInfoView.datas)}};
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.basicInformation': basicInfoView.toSaveDatas(basicInfoView.datas)}};
         properties.push(updateData);
     }
     //工程特征
     if(projFeatureView.toUpdate(projFeatureView.orgDatas, projFeatureView.datas)){
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.projectFeature': projFeatureView.toSaveDatas(projFeatureView.datas)}};
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.projectFeature': projFeatureView.toSaveDatas(projFeatureView.datas)}};
         properties.push(updateData);
     }
     //清单工程量精度
     let newBillsDecimalDatas = billsDecimalView.toBillsDecimalDatas(billsDecimalView.cache);
     if(billsDecimalView.toUpdate(billsQuanDecimal.datas, newBillsDecimalDatas)){
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.billsQuantityDecimal': newBillsDecimalDatas}};
+        reCalcBills = true;
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.billsQuantityDecimal': newBillsDecimalDatas}};
         properties.push(updateData);
     }
     //小数位数
     //获取更新的数据
     let updateDecimal = m_getDecimalData($('input', '#poj-settings-decimal'));
     if(toUpdateDecimal(decimalObj, updateDecimal)){
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.decimal': updateDecimal}};
+        reCalcRations = true;
+        reCalcBills = true;
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.decimal': updateDecimal}};
         properties.push(updateData);
-    }
- // 呈现选项
+    };
+
+    // 人工系数
+    let lcData;
+    if (labourCoeView.needSave()){
+        reCalcRations = true;
+        reCalcBills = true;
+        project.calcProgram.compileAllTemps();
+
+        let projectID = projectInfoObj.projectInfo.ID;
+        let libID = $("#std_labour_coe_files").children("option:selected").val();
+        let libName = $("#std_labour_coe_files").children("option:selected").text();
+        lcData = {sourceType: 'labourCoe', projectID: projectID, libID: libID, libName: libName, newItemArr: labourCoeView.needUpdateDatas};
+        properties.push(lcData);
+    };
+
+    // 呈现选项
     projDisplayView.updateChecking(projectID,properties);
+ /*   const autoHeight = $("#autoHeight:checked").length > 0;
+    const disPlayMainMaterial = $("#disPlayMainMaterial:checked").length > 0;*/
+/*    if (projDisplayView.needUpdate(autoHeight, disPlayMainMaterial)) {
+        const displaySetting = { autoHeight, disPlayMainMaterial };
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting': displaySetting}};
+        properties.push(updateData);
+    }*/
+
+    // 重新计算树节点
+    let changedNodes = [];
+    if (reCalcRations)    // 定额动,全部计算。
+        changedNodes = project.calcProgram.calcAllNodes(calcAllType.catAll)
+    else if (reCalcBills)  // 清单动,可以只计算清单。
+        changedNodes = project.calcProgram.calcAllNodes(calcAllType.catBills);
+    if (changedNodes.length > 0) {
+        for (let node of changedNodes){
+            let data = {
+                projectID: project.ID(),
+                ID: node.data.ID,
+                quantity: node.data.quantity,
+                calcBase: node.data.calcBase,
+                calcBaseValue: node.data.calcBaseValue,
+                marketUnitFee: node.data.marketUnitFee,
+                marketTotalFee: node.data.marketTotalFee,
+                fees: node.data.fees,
+                feeRate: node.data.feeRate,
+                feeRateID: node.data.feeRateID
+            };
+            let dataObj = {sourceType: node.sourceType, updateType: 'ut_update', updateData: data};
+            properties.push(dataObj);
+        };
+    };
 
     console.log(properties);
     if(properties.length > 0){
-        CommonAjax.post('/pm/api/updateProjects', {user_id: userID, updateData: properties}, function (rstData) {
+        CommonAjax.post('/pm/api/updateMixDatas', {user_id: userID, updateData: properties}, function (rstData) {
+            if (changedNodes.length > 0) {
+                for (let node of changedNodes){delete node.changed};
+            };
+            if (lcData) labourCoeView.refresh(lcData);
             window.location.href = '/main?project=' + projectID;
         });
     }

+ 12 - 0
web/building_saas/main/js/views/sub_view.js

@@ -115,7 +115,11 @@ $("#linkTZJNR").click(function () {
 });
 
 // 应用到选中清单
+let isSaving = false;
 $("#use-to-current").click(function() {
+    if (isSaving) {
+        return false;
+    }
     // 添加位置
     const position = $("#add-position").val();
     // 添加内容
@@ -134,8 +138,16 @@ $("#use-to-current").click(function() {
         position,
         displayFormat,
     };
+    isSaving = true;
+    const self = $(this);
+    self.attr('disabled', 'disabled');
     let selectedNode = projectObj.mainController.tree.selected;
     pageCCOprObj.setCharacterBySetting(selectedNode, setting);
+    // 防止连续点击1秒后才能再次发起请求
+    setTimeout(function() {
+        isSaving = false;
+        self.removeAttr('disabled');
+    }, 1000);
 });
 // 添加位置选择
 $("#add-position").change(function() {

+ 0 - 3
web/building_saas/pm/html/project-management.html

@@ -26,9 +26,6 @@
         #summary-engineering,#summary-project{
             display: none;
         }
-        #header-menu{
-            display: none;
-        }
     </style>
 </head>
 

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

@@ -1,6 +1,6 @@
 <nav class="navbar navbar-expand-lg p-0 d-flex">
     <a class="header-logo px-2" href="/pm" style="text-decoration: none;">纵横云造价</a>
-    <ul class="nav navbar-nav px-1" id="header-menu">
+    <ul class="nav navbar-nav px-1" id="header-menu" style="display: none;">
         <li class="nav-item">
             <a class="nav-link" href="#" aria-expanded="false" data-toggle="modal" data-target="#poj-set"><i class="fa fa-cube"></i> 项目属性</a>
         </li>