소스 검색

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

TonyKang 5 년 전
부모
커밋
2b3b65c4b7

+ 3 - 3
modules/main/facade/project_facade.js

@@ -369,15 +369,15 @@ function getReportData(nameList,items,prjTypeNames,compilationScopes,decimal,isP
         let temTotalPrice = 0;
         for(let c of children){
             if(level == 0) rootFlag = c.flag;//取最顶层节点的固定清单类别
-            let sumChildren = setChildrenDatas(c.children,arr,level+1,rootFlag);
             let tbill = getBillDatas(c,level,rootFlag);
+            arr.push(tbill);
+            let sumChildren = setChildrenDatas(c.children,arr,level+1,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
+        return temTotalPrice;
     }
 
     function getBillDatas(bills,level,rootFlag) {

+ 4 - 1
modules/unit_price_file/controllers/unit_price_controller.js

@@ -22,13 +22,15 @@ module.exports={
       let mixRatioList = await mixRatioModel.find({unit_price_file_id:unitPriceFileID}).lean();
       let mixRatioMap = _.groupBy(mixRatioList,"connect_key");
       let com_electrovalence = await com_electrovalence_model.findOne({"unit_price_file_id":unitPriceFileID}).lean();
+      let projectID = null;
 
       let gljTypeMap = glj_type_util.getStdGljTypeCacheObj().innerGljTypeObj;
       let usedTenderList = [];
-      if (tenderData !== null) {
+      if (tenderData !== null && tenderData.length > 0) {
           for (let tmp of tenderData) {
               usedTenderList.push(tmp.name);
           }
+          projectID = tenderData[0].ID;
       }
       let usedTenderString = "人材机单价的变化,将自动影响以下单位工程造价:<br>"+usedTenderList.join("<br>");
       res.render('building_saas/unit_price_file/index.html',
@@ -36,6 +38,7 @@ module.exports={
           userAccount: req.session.userAccount,
           userID: req.session.sessionUser.id,
           unitPriceFileID:unitPriceFileID,
+          projectID:projectID,
           versionName: req.session.compilationVersion,
           unitFileName:unitPriceFile.name,
           rootProjectName:project.name,

+ 1 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -3634,7 +3634,7 @@ function a_updateFiles(updateDatas, callback){
                 callback();
             }
         }
-    })
+    }) 
 }
 
 function set_file_table(target, poj_tenders, fileList, type){

+ 2 - 0
web/building_saas/unit_price_file/index.html

@@ -38,6 +38,8 @@
 </head>
 <script type="text/javascript">
   let unitPriceFileID = parseInt('<%- unitPriceFileID %>');
+  let userID = '<%- userID %>';
+  let projectID = '<%- projectID %>';
   let unitPriceList = JSON.parse(`<%- unitpriceList %>`);
   let gljTypeMap = JSON.parse(`<%- gljTypeMap %>`);
   let mixRatioMap = JSON.parse(`<%- mixRatioMap %>`);

+ 1 - 1
web/building_saas/unit_price_file/index.js

@@ -562,7 +562,7 @@ let unitPriceObj = {
     unitPriceObj.showSubDatas();
     try {
       await ajaxPost("/project/markUpdateProject",{updateInfo:{unitFileID:unitPriceFileID,isInclude:true},type:"unitFile"});
-      socket.emit('unitFileChangeNotify', {'unitFileID':unitPriceFileID});
+      socket.emit('unitFileChangeNotify', {projectID:_.isEmpty(projectID)?null:parseInt(projectID),'unitFileID':unitPriceFileID,userID:userID});
     } catch (error) {
       console.log(error)
       alert(error)