chenshilong 7 سال پیش
والد
کامیت
be9687af50

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

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

+ 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>

+ 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算法基于定额、工料机定额的计算结果是正确的,实际上有时它们的计算结果并不是最新的)

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

@@ -142,7 +142,7 @@ 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.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;

+ 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);
     }
 };
 

+ 20 - 15
web/building_saas/main/js/views/project_view.js

@@ -695,7 +695,7 @@ $('#property_ok').click(function () {
     let b = parseInt($("input[name='calcFlag']:checked").val());
 
     if (b !== project.property.billsCalcMode) {
-        let bData = {updateType: 'update', updateData: {ID: projectID, 'property.billsCalcMode': b}};
+        let bData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.billsCalcMode': b}};
         properties.push(bData);
         project.property.billsCalcMode = b;
         reCalcBills = true;
@@ -703,7 +703,7 @@ $('#property_ok').click(function () {
 
     let zg = parseInt($("input[name='zangu']:checked").val());
     if (zg !== project.property.zanguCalcMode) {
-        let zgData = {updateType: 'update', updateData: {ID: projectID, 'property.zanguCalcMode': zg}};
+        let zgData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.zanguCalcMode': zg}};
         properties.push(zgData);
         project.property.zanguCalcMode = zg;
         reCalcBills = true;
@@ -711,19 +711,19 @@ $('#property_ok').click(function () {
 
     //基本信息
     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)){
         reCalcBills = true;
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.billsQuantityDecimal': newBillsDecimalDatas}};
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.billsQuantityDecimal': newBillsDecimalDatas}};
         properties.push(updateData);
     }
     //小数位数
@@ -732,9 +732,10 @@ $('#property_ok').click(function () {
     if(toUpdateDecimal(decimalObj, updateDecimal)){
         reCalcRations = true;
         reCalcBills = true;
-        let updateData = {updateType: 'update', updateData: {ID: projectID, 'property.decimal': updateDecimal}};
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.decimal': updateDecimal}};
         properties.push(updateData);
-    }
+    };
+
     // 人工系数
     let lcData;
     if (labourCoeView.needSave()){
@@ -745,18 +746,19 @@ $('#property_ok').click(function () {
         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 = {projectID: projectID, libID: libID, libName: libName, newItemArr: labourCoeView.needUpdateDatas};
+        lcData = {sourceType: 'labourCoe', projectID: projectID, libID: libID, libName: libName, newItemArr: labourCoeView.needUpdateDatas};
         properties.push(lcData);
     };
 
     // 呈现选项
-    const autoHeight = $("#autoHeight:checked").length > 0;
-    const disPlayMainMaterial = $("#disPlayMainMaterial:checked").length > 0;
-    if (projDisplayView.needUpdate(autoHeight, disPlayMainMaterial)) {
+    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 = {updateType: 'update', updateData: {ID: projectID, 'property.displaySetting': displaySetting}};
+        let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting': displaySetting}};
         properties.push(updateData);
-    }
+    }*/
 
     // 重新计算树节点
     let changedNodes = [];
@@ -778,14 +780,17 @@ $('#property_ok').click(function () {
                 feeRate: node.data.feeRate,
                 feeRateID: node.data.feeRateID
             };
-            let dataObj = {updateType: 'ut_update', updateData: data};
-            properties.push(changedNodes);
+            let dataObj = {sourceType: node.sourceType, updateType: 'ut_update', updateData: data};
+            properties.push(dataObj);
         };
     };
 
     console.log(properties);
     if(properties.length > 0){
         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;
         });