zhangweicheng 6 年之前
父节点
当前提交
dfff2f5c8d

+ 2 - 0
config/gulpConfig.js

@@ -42,6 +42,8 @@ module.exports = {
         'public/web/sheet/sheet_common.js',
         'public/web/common_ajax.js',
         'lib/JSExpressionEval_src/Date.js',
+        'web/building_saas/glj/js/socket.io.slim.js',
+        'public/web/socket/connection.js',
         'web/building_saas/pm/js/**/*.js',
         'lib/ztree/*.js',
         'lib/jquery-contextmenu/jquery.contextMenu.min.js'

+ 1 - 1
modules/all_models/stdBills_bills.js

@@ -17,7 +17,7 @@ const stdBills_bills = new Schema({
             jobs: [],
             items: [],
             recharge:String,
-            billsLibId: Number,
+            billsLibId: {type:Number, index: true},
             deleted: Boolean
     },
     {versionKey: false}

+ 1 - 2
modules/main/models/project.js

@@ -29,7 +29,6 @@ var moduleMap = {};
 
 moduleMap[projectConsts.BILLS] = billsData;
 moduleMap[projectConsts.RATION] = rationData;
-//moduleMap[projectConsts.GLJ] = GLJData;
 moduleMap[projectConsts.RATION_GLJ] = ration_glj_data;
 moduleMap[projectConsts.RATION_COE] = ration_coe_data;
 moduleMap[projectConsts.RATION_ASS] = ration_ass_data;
@@ -37,13 +36,13 @@ moduleMap[projectConsts.RATION_INSTALLATION] = ration_installation;
 moduleMap[projectConsts.QUANTITY_DETAIL] = quantity_detail_data;
 moduleMap[projCounter.collectionName] = projCounter;
 moduleMap[projSetting.collectionName] = projSetting;
-// moduleMap[volumePriceData.collectionName] = volumePriceData;
 moduleMap[projectConsts.FEERATE] = fee_rate_data;
 moduleMap[projectConsts.LABOUR_COE] = labour_coe_facade;
 moduleMap[projectConsts.CALC_PROGRAM] = calc_program_facade;
 moduleMap[projectConsts.PROJECTGLJ] = new GLJController();
 moduleMap[projectConsts.INSTALLATION_FEE] = installation_facade;
 
+
 var Project = function (){};
 
 Project.prototype.datas = [];

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

@@ -612,7 +612,7 @@ async function getSummaryInfo(projectIDs){
     if(tenders.length > 0){
         for(let tender of tenders){
             tenderIDs.push(tender.ID);
-            IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: ''};
+            IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: '',changeMark:tender.changeMark,property:tender.property};
             let buildingArea = getBuildingArea(tender.property.projectFeature);
             if(buildingArea){
                 IDMapping[tender.ID]['buildingArea'] = buildingArea;

+ 12 - 5
public/web/socket/connection.js

@@ -3,17 +3,24 @@
  */
 socketObject={
   roomInfo : null,
-  connect:function () {
+  connect:function (from) {
       // 连接socket服务器
       var hostName = window.location.hostname;
       let me = this;
       let port = window.location.protocol ==='http:'?3300:3301;
       socket = io(window.location.protocol+'//'+hostName+':'+port);
       socket.on('connect', function () {
-          me.roomInfo={
-              feeRate:me.getFeeRateRoomID(),
-              unitFile:me.getUnitFileRoomID()
-          };
+          if(from == 'pm'){
+              me.roomInfo={
+                  userID:userID
+              };
+          }else {
+              me.roomInfo={
+                  feeRate:me.getFeeRateRoomID(),
+                  unitFile:me.getUnitFileRoomID()
+              };
+          }
+
           socket.emit('join', me.roomInfo);
           console.log('连接成功');
       });

+ 0 - 1
socket.js

@@ -22,7 +22,6 @@ socketIO.on('connection', function(socket) {
     });
     // 数据更改通知
     socket.on('unitFileChangeNotify', function(data) {
-        console.log(roomInfo);
         socket.broadcast.to(roomInfo['unitFile']).emit('unitFileChange', data);
     });
     socket.on('feeRateChangeNotify', function(data) {

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

@@ -21,6 +21,7 @@
         // 这里的变量供页面调用
         var userAccount = '<%- userAccount %>';
         var userID = '<%- userID %>';
+        console.log(userID);
     </script>
     <style type="text/css">
         .hidden-area{
@@ -38,6 +39,7 @@
 <img src="/web/dest/css/img/project.png" id="proj_pic" style="display: none">
 <img src="/web/dest/css/img/engineering.png" id="eng_pic" style="display: none">
 <img src="/web/dest/css/img/tender.png" id="tender_pic" style="display: none">
+<img src="/web/dest/css/img/refresh.png" id="refresh_pic" style="display: none">
 <div class="header">
     <div class="top-msg clearfix">
         <div class="alert alert-warning mb-0 py-0" role="alert" style="display: none;">
@@ -682,6 +684,8 @@
 <script src="/public/web/sheet/sheet_common.js"></script>
 <script type="text/javascript" src="/public/web/common_ajax.js"></script>
 <script src="/lib/JSExpressionEval_src/Date.js"></script>
+<script src="/web/building_saas/glj/js/socket.io.slim.js"></script>
+<script src="/public/web/socket/connection.js"></script>
 <script src="/web/building_saas/pm/js/pm_ajax.js"></script>
 <script src="/web/building_saas/pm/js/pm_newMain.js"></script>
 <script src="/web/building_saas/pm/js/pm_gc.js"></script>

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

@@ -725,9 +725,11 @@ const projTreeObj = {
                         imgWidth = 14;
                     }
                     else if(node.data.projType === projectType.tender){
-                        img = document.getElementById('tender_pic');
+                        //如果单位工程不是实时计算结果,则显示刷新标记
+                        img = node.data.changeMark && node.data.changeMark!=""? document.getElementById('refresh_pic'):document.getElementById('tender_pic');
                         imgWidth = 14;
                     }
+
                     ctx.drawImage(img, centerX+indent/2+3, centerY - 7, imgWidth,imgHeight);
                 }
                 // Draw Vertical Line
@@ -1659,6 +1661,7 @@ function init() {
     billValuation = billValuation.replace(/\n/g, '\\n');
     rationValuation = rationValuation.replace(/\n/g, '\\n');
     //init spread and pmTree
+    socketObject.connect('pm');//socket 连接;
     $.bootstrapLoading.start();
     GetAllProjectData(function (datas) {
         CommonAjax.post('/options/getOptions', [], function (rstData) {
@@ -3377,6 +3380,8 @@ function refreshProjSummary(project, summaryInfo) {
             node.data.rate = nodeInfo.rate;
             node.data.buildingArea = nodeInfo.buildingArea;
             node.data.perCost = nodeInfo.perCost;
+            node.data.changeMark = nodeInfo.changeMark;
+            if(nodeInfo.property) node.data.property = nodeInfo.property;
         }
     }
     projTreeObj.refreshNodeData(refreshNodes);