Browse Source

分享项目,只读

zhongzewei 7 years ago
parent
commit
a8f0f60526
28 changed files with 294 additions and 36 deletions
  1. 8 1
      modules/main/routes/main_route.js
  2. 2 1
      modules/pm/controllers/pm_controller.js
  3. 6 2
      modules/pm/models/project_model.js
  4. 8 4
      public/web/tree_sheet/tree_sheet_helper.js
  5. 3 0
      web/building_saas/main/html/main.html
  6. 2 2
      web/building_saas/main/js/models/calc_base.js
  7. 4 2
      web/building_saas/main/js/views/calc_base_view.js
  8. 14 2
      web/building_saas/main/js/views/calc_program_manage.js
  9. 1 1
      web/building_saas/main/js/views/calc_program_view.js
  10. 9 3
      web/building_saas/main/js/views/character_content_view.js
  11. 11 3
      web/building_saas/main/js/views/fee_rate_view.js
  12. 7 1
      web/building_saas/main/js/views/glj_view.js
  13. 3 0
      web/building_saas/main/js/views/main_tree_col.js
  14. 22 1
      web/building_saas/main/js/views/project_glj_view.js
  15. 4 0
      web/building_saas/main/js/views/project_info.js
  16. 3 0
      web/building_saas/main/js/views/project_property_basicInfo.js
  17. 3 0
      web/building_saas/main/js/views/project_property_bills_quantity_decimal.js
  18. 8 2
      web/building_saas/main/js/views/project_property_labour_coe_view.js
  19. 3 0
      web/building_saas/main/js/views/project_property_projFeature.js
  20. 102 3
      web/building_saas/main/js/views/project_view.js
  21. 3 0
      web/building_saas/main/js/views/side_tools.js
  22. 1 1
      web/building_saas/main/js/views/std_billsGuidance_lib.js
  23. 6 0
      web/building_saas/main/js/views/sub_fee_rate_views.js
  24. 20 2
      web/building_saas/main/js/views/sub_view.js
  25. 3 1
      web/building_saas/main/js/views/tender_price_view.js
  26. 3 0
      web/building_saas/main/js/views/zmhs_view.js
  27. 34 3
      web/building_saas/pm/js/pm_share.js
  28. 1 1
      web/common/html/header.html

+ 8 - 1
modules/main/routes/main_route.js

@@ -15,12 +15,19 @@ module.exports =function (app) {
                 // 获取项目信息
                 const projectId = req.query.project;
                 const projectData = await projectModel.project.getProject(projectId);
+                //分享的项目,只读
+                let projectReadOnly = false;
+                if(req.session.sessionUser.id !== projectData.userID){
+                    projectData._doc.readOnly = true;
+                    projectReadOnly = true;
+                }
                 res.render('building_saas/main/html/main.html',
                     {
                         userAccount: req.session.userAccount,
                         userID: req.session.sessionUser.id,
                         projectData: projectData,
-                        versionName: req.session.sessionCompilation.name + '免费版'
+                        versionName: req.session.sessionCompilation.name + '免费版',
+                        projectReadOnly: projectReadOnly
                     });
             } else {
                 res.redirect('/pm');

+ 2 - 1
modules/pm/controllers/pm_controller.js

@@ -44,7 +44,8 @@ module.exports = {
              * result._doc.userID(Number): MongoDB
              * userId(String): Session.userID
              */
-            if (result._doc.userID == userId && result._doc.projType === projType.tender) {
+            //result._doc.userID == userId &&
+            if (result._doc.projType === projType.tender) {
                 callback(true);
             } else {
                 callback(false);

+ 6 - 2
modules/pm/models/project_model.js

@@ -71,10 +71,14 @@ ProjectsDAO.prototype.getUserProjects = async function (userId, compilation, cal
 };
 
 ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
-    Projects.findOne({userID: userId, ID: ProjId}, '-_id', function (err, template) {
+    Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], ID: ProjId}, '-_id', function (err, template) {
         if (err) {
             callback(1, '找不到标段数据', null);
         } else {
+            //打开分享的项目,只读
+            if(template && userId !== template.userID){
+                template._doc.readOnly = true;
+            }
             callback(0, '', template);
         }
     });
@@ -396,7 +400,7 @@ ProjectsDAO.prototype.getProject = function (key, callback) {
             }
         });
     } else {
-        return Projects.findOne({'ID': key}).exec();
+        return Projects.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'ID': key}).exec();
     }
 };
 

+ 8 - 4
public/web/tree_sheet/tree_sheet_helper.js

@@ -167,13 +167,17 @@ var TREE_SHEET_HELPER = {
                 if(colSetting.editChecking&&colSetting.editChecking(node)){
                     cell.locked(true);
                 }else if (colSetting.readOnly) {
-                    if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
-                        cell.locked(colSetting.readOnly(node));
-                    } else {
+                    if(projectReadOnly){
                         cell.locked(true);
+                    }else {
+                        if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
+                            cell.locked(colSetting.readOnly(node));
+                        } else {
+                            cell.locked(true);
+                        }
                     }
                 } else {
-                    cell.locked(false);
+                    cell.locked(projectReadOnly ? true : false);
                 }
             });
             if(setting.setAutoFitRow){

+ 3 - 0
web/building_saas/main/html/main.html

@@ -25,6 +25,9 @@
         let lockBills = '<%- projectData.property.lockBills %>';
         let userAccount = '<%- userAccount %>';
         let userID = '<%- userID %>';
+        let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
+        console.log(`projectReadOnly`);
+        console.log(projectReadOnly);
     </script>
 </head>
 

+ 2 - 2
web/building_saas/main/js/models/calc_base.js

@@ -948,11 +948,11 @@ let baseFigureTemplate = {
                 }
                 //量人 type 2, subType 1
                 else if(ration.type === rationType.volumePrice && ration.subType === volumePriceMaps['量人']){
-                    rst = parseFloat(rst + ration[quantityType]).toDecimal(decimalObj.glj.quantity);
+                    rst = parseFloat(rst + parseFloat(ration[quantityType])).toDecimal(decimalObj.glj.quantity);
                 }
                 //定额类型的人工工料机,type 3, subType 1
                 else if(ration.type === rationType.gljRation && ration.subType === gljType.LABOUR){
-                    rst = parseFloat(rst + ration[quantityType]).toDecimal(decimalObj.glj.quantity);
+                    rst = parseFloat(rst + parseFloat(ration[quantityType])).toDecimal(decimalObj.glj.quantity);
                 }
             }
         }

+ 4 - 2
web/building_saas/main/js/views/calc_base_view.js

@@ -338,7 +338,7 @@ let calcBaseView = {
             // ctx.fillText(value,x+w-3,y+h-3);
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
             // }
-            if(calcBaseView.editingCell){
+            if(calcBaseView.editingCell && !projectReadOnly){
                 if(calcBaseView.editingCell.row==options.row&&calcBaseView.editingCell.col==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
                     var imageHeight = h-2*imageMagin;
@@ -390,7 +390,9 @@ let calcBaseView = {
                 var imageHeight = hitinfo.cellRect.height-2*imageMagin;
                 var imageWidth = hitinfo.cellRect.width*2/7;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    calcBaseView.initCalctor(type);
+                    if(!projectReadOnly){
+                        calcBaseView.initCalctor(type);
+                    }
                 }
             }
         };

+ 14 - 2
web/building_saas/main/js/views/calc_program_manage.js

@@ -71,8 +71,20 @@ let calcProgramManage = {
         dSheet.getRange(-1, _.findIndex(me.detailSetting.header, {'dataCode': 'dispExprUser'}), -1, 1).cellType(calcBaseView.getCalcBaseCellType('ration'));
         sheetCommonObj.showData(dSheet, me.detailSetting, me.datas[0].calcItems);
 
-        me.loadMainContextMenu();
-        me.loadDetailContextMenu();
+        if(!projectReadOnly){
+            me.loadMainContextMenu();
+            me.loadDetailContextMenu();
+        }
+        else {
+            if(me.mainSetting.view.lockColumns){
+                me.mainSetting.view.lockColumns = null;
+            }
+            if(me.detailSetting.view.lockColumns){
+                me.detailSetting.view.lockColumns = null;
+            }
+            disableSpread(me.mainSpread);
+            disableSpread(me.detailSpread);
+        }
     },
     onMainEnterCell: function(sender, args) {
         var me = calcProgramManage;

+ 1 - 1
web/building_saas/main/js/views/calc_program_view.js

@@ -16,7 +16,7 @@ let calcProgramObj = {
             {headerName: "费率", headerWidth: CP_Col_Width.feeRate, dataCode: "feeRate", dataType: "Number"},
             {headerName: "单价", headerWidth: CP_Col_Width.unitFee, dataCode: "unitFee", dataType: "Number"},
             {headerName: "合价", headerWidth: CP_Col_Width.totalFee, dataCode: "totalFee", dataType: "Number"},
-            {headerName:"费用类别", headerWidth:CP_Col_Width.displayFieldName, dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
+            {headerName: "费用类别", headerWidth:CP_Col_Width.displayFieldName, dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
             {headerName: "基数说明", headerWidth: CP_Col_Width.statement, dataCode: "statement", dataType: "String"},
             {headerName: "备注", headerWidth: CP_Col_Width.memo, dataCode: "memo", dataType: "String"}
         ],

+ 9 - 3
web/building_saas/main/js/views/character_content_view.js

@@ -17,7 +17,9 @@ let contentOprObj = {
         me.workBook.options.allowUserDragDrop = false;
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.options.allowCopyPasteExcelStyle = false;
-        me.onContextmenuOpr();//右键菜单
+        if(!projectReadOnly){
+            me.onContextmenuOpr();//右键菜单
+        }
         me.bindEvents(me.workBook);
     },
     bindEvents: function (workBook) {
@@ -399,7 +401,9 @@ let characterOprObj = {
         me.workBook.options.allowUserDragDrop = false;
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.options.allowCopyPasteExcelStyle = false;
-        me.onContextmenuOpr();
+        if(!projectReadOnly){
+            me.onContextmenuOpr();
+        }
         me.bindEvents(me.workBook);
     },
     bindEvents: function (workBook) {
@@ -917,7 +921,9 @@ let pageCCOprObj = {
     },
     //设置特征及内容currentCache
     setCacheAndShow: function (node) {
-        this.refreshRuleTools(projectObj.project.isBillsLocked());
+        if(!projectReadOnly){
+            this.refreshRuleTools(projectObj.project.isBillsLocked());
+        }
         if(node && node.sourceType === projectObj.project.Bills.getSourceType()){
             let theCont = contentOprObj, theCha = characterOprObj;
             node.data.jobContent = node && typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];

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

@@ -265,7 +265,7 @@ var feeRateObject={
                // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
              GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
            // }
-            if(feeRateObject.editingCell){
+            if(feeRateObject.editingCell && !projectReadOnly){
                 if(feeRateObject.editingCell.row==options.row&&feeRateObject.editingCell.col==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
                     var imageHeight = h-2*imageMagin;
@@ -317,7 +317,9 @@ var feeRateObject={
                 var imageHeight = hitinfo.cellRect.height-2*imageMagin;
                 var imageWidth = hitinfo.cellRect.width*2/7;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    me.showSelectModal(hitinfo);
+                    if(!projectReadOnly){
+                        me.showSelectModal(hitinfo);
+                    }
                 }
             }
         };
@@ -390,7 +392,9 @@ var feeRateObject={
         this.mainFeeRateSpread = sheetCommonObj.buildSheet($('#divFee')[0], this.mainFeeRateSetting,rowCount);
         this.mainFeeRateSpread.options.scrollbarMaxAlign = true;
         this.mainFeeRateSheet = this.mainFeeRateSpread.getSheet(0);
-        sheetCommonObj.lockCells(this.mainFeeRateSheet , this.mainFeeRateSetting);
+        if(!projectReadOnly){
+            sheetCommonObj.lockCells(this.mainFeeRateSheet , this.mainFeeRateSetting);
+        }
         this.mainFeeRateSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onMainFeeRateSheetValueChange);
         this.mainFeeRateSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, this.onMainFeeRateSelectChanged);
         this.mainFeeRateSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMainFeeRateRangeChanged);
@@ -402,6 +406,10 @@ var feeRateObject={
         });
         this.mainFeeRateSheet.name('mainFeeRateSheet');
         disableRightMenu("divFee",this.mainFeeRateSpread,this.rightClickCallback);
+        //打开他人分享的项目、只读
+        if(projectReadOnly){
+            disableSpread(this.mainFeeRateSpread);
+        }
     },
     rightClickCallback:function (row) {
         let me = feeRateObject;

+ 7 - 1
web/building_saas/main/js/views/glj_view.js

@@ -254,7 +254,9 @@ var gljOprObj = {
                 args.cancel = true;
             }
         });
-        gljContextMenu.loadGLJSpreadContextMenu();
+        if(!projectReadOnly){
+            gljContextMenu.loadGLJSpreadContextMenu();
+        }
     },
     initDetailSheet: function (sheet) {
         var me = this;
@@ -418,6 +420,7 @@ var gljOprObj = {
         }
     },
     onCellClick: function (sender, args) {
+        console.log('cellClick');
         var me = gljOprObj;
         if (args.row >= me.sheetData.length) {
             return;
@@ -547,6 +550,9 @@ var gljOprObj = {
     },
     showDataIfRationSelect: function (node,selectedNodeId) {
         var isShow = false;
+        if(projectReadOnly && this.setting.view.lockColumns){
+            this.setting.view.lockColumns = null;
+        }
         if(selectedNodeId){
             this.selectedNodeId = selectedNodeId;
         }

+ 3 - 0
web/building_saas/main/js/views/main_tree_col.js

@@ -448,6 +448,9 @@ let colSettingObj = {
 $('#poj-set').on('shown.bs.modal', function (e) {
     if (!colSettingObj.settingSpread) {
         colSettingObj.initSettingSpread();
+        if(projectReadOnly){
+            disableSpread(colSettingObj.settingSpread);
+        }
     }
 });
 

+ 22 - 1
web/building_saas/main/js/views/project_glj_view.js

@@ -91,6 +91,14 @@ projectGljObject={
         this.initProjectGljSheet();
         this.initMaterialTreeSheet();
         disableRightMenu("project_glj_sheet",this.projectGljSpread,this.rightClickCallback);
+        //打开别人分享的项目,只读
+        if(projectReadOnly){
+            //锁定逻辑走disabledSpread里的
+            if(this.projectGljSetting.view.lockColumns){
+                this.projectGljSetting.view.lockColumns = null;
+            }
+            disableSpread(this.projectGljSpread);
+        }
     },
     initProjectGljSheet:function () {
         this.projectGljSheet = this.projectGljSpread .getSheet(0);
@@ -103,7 +111,9 @@ projectGljObject={
         let me = projectGljObject;
         if(me.mixRatioSpread==null){
             me.initMixRatioSpread();
-            me.initRightClick();
+            if(!projectReadOnly){
+                me.initRightClick();
+            }
         }
     },
     initMixRatioSpread:function () {
@@ -112,6 +122,12 @@ projectGljObject={
         this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
         this.mixRatioSheet.name('mixRatioSheet');
         this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
+        if(projectReadOnly){
+            if(this.mixRatioSetting.view.lockColumns){
+                this.mixRatioSetting.view.lockColumns = null;
+            }
+            disableSpread(this.mixRatioSpread);
+        }
     },
     initMaterialTreeSheet:function () {
         this.materialTreeSheet = this.projectGljSpread.getSheet(1);
@@ -122,6 +138,11 @@ projectGljObject={
         this.materialTreeSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onProjectGljEditStarting);
         this.materialTreeSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onProjectGLJValueChange);
         this.materialTreeSheet.name('materialTreeSheet');
+        if(projectReadOnly && this.materialSetting.view.lockColumns){
+            if(this.materialSetting.view.lockColumns){
+                this.materialSetting.view.lockColumns = null;
+            }
+        }
     },
     createMaterialTreeSheetSetting:function () {
         return sheetCommonObj.transferToTreeSetting(this.materialSetting,this.materialTreeSetting);

+ 4 - 0
web/building_saas/main/js/views/project_info.js

@@ -31,6 +31,10 @@ var projectInfoObj = {
         CommonAjax.post('/pm/api/getProject', {"user_id": userID, "proj_id": scUrlUtil.GetQueryString('project')}, function (data) {
             if (data) {
                 that.projectInfo = data;
+                if(!data.engineeringInfo.billsGuidance_lib || data.engineeringInfo.billsGuidance_lib.length === 0){
+                    $('#stdBillsGuidanceTab').addClass('disabled');
+                }
+
                 //init decimal
                 setDecimal(decimalObj, data.property.decimal);
                 billsQuanDecimal.datas = data.property.billsQuantityDecimal || [billsDecimalView.angleDecimal];

+ 3 - 0
web/building_saas/main/js/views/project_property_basicInfo.js

@@ -443,6 +443,9 @@ $(document).ready(function () {
         basicInfoView.initDatas(basicInfoView.orgDatas);
         basicInfoView.buildSheet();
         basicInfoView.showData(basicInfoView.datas);
+        if(projectReadOnly){
+            disableSpread(basicInfoView.workBook);
+        }
     });
 
     $('#poj-set').on('hidden.bs.modal', function (e) {

+ 3 - 0
web/building_saas/main/js/views/project_property_bills_quantity_decimal.js

@@ -351,6 +351,9 @@ $(document).ready(function () {
         }
         billsDecimalView.buildSheet();
         billsDecimalView.showData(billsDecimalView.cache);
+        if(projectReadOnly){
+            disableSpread(billsDecimalView.workBook);
+        }
     });
 
     $('#poj-set').on('hidden.bs.modal', function (e) {

+ 8 - 2
web/building_saas/main/js/views/project_property_labour_coe_view.js

@@ -50,6 +50,9 @@ let labourCoeView = {
         sheet.bind(GC.Spread.Sheets.Events.CellChanged, me.onCellChanged);
         sheet.resumeEvent();
         sheet.resumePaint();
+        if(projectReadOnly){
+            disableSpread(me.spread);
+        }
     },
     loadCrossData(datas){          // 交叉表:树结构转换二维表显示,行列转换
         let me = this;
@@ -70,8 +73,11 @@ let labourCoeView = {
         me.sheet.setColumnCount(libArr.length + 1, GC.Spread.Sheets.SheetArea.viewport);    // 还多一列行名称
         me.sheet.setRowCount(row, GC.Spread.Sheets.SheetArea.viewport);
         me.sheet.setText(0, 0, "定额工种", GC.Spread.Sheets.SheetArea.colHeader);
-        me.sheet.options.isProtected = true;
-        me.sheet.getRange(-1, 1, -1, libArr.length + 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
+        //项目只读的话,单元格锁定在disableSpread控制
+        if(!projectReadOnly){
+            me.sheet.options.isProtected = true;
+            me.sheet.getRange(-1, 1, -1, libArr.length + 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
+        }
 
         // 列名称
         for (let c = 0; c <= libArr.length - 1; c++) {

+ 3 - 0
web/building_saas/main/js/views/project_property_projFeature.js

@@ -401,6 +401,9 @@ $(document).ready(function () {
         projFeatureView.initDatas(projFeatureView.orgDatas);
         projFeatureView.buildSheet();
         projFeatureView.showData(projFeatureView.datas);
+        if(projectReadOnly){
+            disableSpread(projFeatureView.workBook);
+        }
     });
 
     $('#poj-set').on('hidden.bs.modal', function (e) {

+ 102 - 3
web/building_saas/main/js/views/project_view.js

@@ -584,6 +584,7 @@ var projectObj = {
             this.mainSpread = SheetDataHelper.createNewSpread($('#billsSpread')[0]);
             this.mainSpread.getActiveSheet().selectionPolicy(GC.Spread.Sheets.SelectionPolicy.muliRange);
             this.mainSpread.getActiveSheet().name('mainSheet');
+            this.mainSpread.getActiveSheet().options.isProtected = true;
         }
     },
     refreshMainSpread: function () {
@@ -680,7 +681,9 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
 
                 //let loadOtherStartTime = +new Date();
-                that.loadMainSpreadContextMenu();
+                if(!projectReadOnly){
+                    that.loadMainSpreadContextMenu();
+                }
                 that.loadFocusLocation();
                 socketObject.connect();//连接socket服务器
                 let endTime = +new Date();
@@ -694,6 +697,9 @@ var projectObj = {
                 //定位到会话中的选项
                 let mainTabFocus = sessionStorage.getItem('mainTab') ? sessionStorage.getItem('mainTab') : '#tab_zaojiashu';
                 $(`${mainTabFocus}`).click();
+                if(projectReadOnly){
+                    disableSpread(that.mainSpread);
+                }
                 $.bootstrapLoading.end();
             }
             else {
@@ -1498,7 +1504,9 @@ $("a[name='lockBills']").click(function () {//
         controller.refreshTreeNode(nodes);
         projectObj.mainController.setTreeSelected(selected);//触发树节点选中事件
         projectObj.loadLockBillsButton();
-        pageCCOprObj.refreshRuleTools(lockBills);
+        if(!projectReadOnly){
+            pageCCOprObj.refreshRuleTools(lockBills);
+        }
     });
 });
 $('#ZLFB_btn').click(function () {
@@ -2139,4 +2147,95 @@ $(function () {
             spread?spread.focus():'';
         }
     }
-});
+    //项目为只读
+    if(projectReadOnly){
+        disableTools();
+    }
+});
+
+//项目只读,处理不可操作的工具栏
+function disableTools(){
+    //造价书按钮
+    $('#delete').remove();
+    $('#upLevel').remove();
+    $('#downLevel').remove();
+    $('#upMove').remove();
+    $('#downMove').remove();
+    $('#ZLFB_btn').remove();
+    $('a[name="lockBills"]').remove();
+    //关于计算
+    $('#poj-settings-4').find('input').prop('disabled', 'disabled');
+    //小数位数
+    $('#poj-settings-decimal').find('input').prop('disabled', 'disabled');
+    //人工单价调整
+    $('#std_labour_coe_files').prop('disabled', 'disabled');
+    //呈现选项
+    $('#display-setting').find('input').prop('disabled', 'disabled');
+    //项目属性确定
+    $('#property_ok').addClass('disabled');
+    //特征及内容
+    $('#add-rule').find('select').prop('disabled', 'disabled');
+    $('#use-to-current').addClass('disabled');
+    $('#use-to-all').addClass('disabled');
+    $('.bottom-tools').remove();
+    //导入
+    $('#uploadConfirm').addClass('disabled');
+    //选项
+    $('#generalOpts1').prop('disabled', 'disabled');
+    $('#generalOpts2').prop('disabled', 'disabled');
+    //补充库编辑器
+    $('#compleRationLib').addClass('disabled');
+    $('#compleGljLib').addClass('disabled')
+    //库
+    $('#stdBillsGuidanceTab').addClass('disabled');
+    $('#stdBillsTab').addClass('disabled');
+    $('#stdRationTab').addClass('disabled');
+    //人材机汇总,选择其他、另存使用
+    $('a[data-target="#change-unitFile"]').remove();
+    $('a[data-target="#unitFile-save-as"]').remove();
+    //费率,选择其他、另存使用、重选标准、统一设置相同参数
+    $('a[data-target="#change-lv"]').remove();
+    $('a[data-target="#copy-lv"]').remove();
+    $('#standardSelect').prop('disabled', 'disabled');
+    $('#cascadeSet').prop('disabled', 'disabled');
+    //计算程序标准
+    $('#calcProgramFileSelect').prop('disabled', 'disabled');
+    //调价
+    $('#calcPriceOption').prop('disabled', 'disabled');
+    $('#gljPriceTenderCoe').prop('disabled', 'disabled');
+    $('#tenderGLJQuantity').prop('disabled', 'disabled');
+    $('#tenderRationQuantity').prop('disabled', 'disabled');
+    $('#tenderPrice').prop('disabled', 'disabled');
+    $('#cleanTender').prop('disabled', 'disabled');
+}
+//项目只读,表格只读
+function disableSpread(spread){
+    spread.unbind(GC.Spread.Sheets.Events.ButtonClicked);
+    let sheetCount = spread.getSheetCount();
+    console.log(sheetCount);
+    for(let i = 0; i < sheetCount; i++){
+        let sheet = spread.getSheet(i);
+        sheet.unbind(GC.Spread.Sheets.Events.ButtonClicked);
+        sheet.unbind(GC.Spread.Sheets.Events.EditStarting);
+        sheet.unbind(GC.Spread.Sheets.Events.EditEnded);
+        sheet.unbind(GC.Spread.Sheets.Events.RangeChanged);
+        sheet.unbind(GC.Spread.Sheets.Events.ClipboardChanging);
+        sheet.unbind(GC.Spread.Sheets.Events.ClipboardChanged);
+        sheet.unbind(GC.Spread.Sheets.Events.CellDoubleClick);
+        sheet.unbind(GC.Spread.Sheets.Events.CellClick);
+        sheet.unbind(GC.Spread.Sheets.Events.ValueChanged);
+        console.log(sheet.name());
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        sheet.options.isProtected = true;
+        let rowCount = sheet.getRowCount();
+        let colCount = sheet.getColumnCount();
+        for(let row = 0; row < rowCount; row++){
+            for(let col = 0; col < colCount; col++){
+                sheet.getCell(row, col).locked(true);
+            }
+        }
+        sheet.resumePaint();
+        sheet.resumeEvent();
+    }
+}

+ 3 - 0
web/building_saas/main/js/views/side_tools.js

@@ -112,6 +112,9 @@ var sideToolsObj = {
 
 $('.side-tabs ul li a').bind('click', function () {
     var tab = $(this), tabPanel = $(tab.attr('relaPanel'));
+    if(tab.hasClass('disabled')){
+        return;
+    }
     if (!tab.hasClass('active')) {
         $('.side-tabs ul li a').removeClass('active');
         tab.addClass('active');

+ 1 - 1
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -526,7 +526,7 @@ const billsGuidance = (function () {
     function bindBtn(){
         //打开清单指引库
         $('#stdBillsGuidanceTab').click(function () {
-            if(libSel.children().length === 0){
+            if(libSel.children().length === 0 && !projectReadOnly){
                 initLibs(projectInfoObj.projectInfo.engineeringInfo.billsGuidance_lib);
             }
         });

+ 6 - 0
web/building_saas/main/js/views/sub_fee_rate_views.js

@@ -97,6 +97,12 @@ var subRateObject={
         console.log(subRateObject.valueMap);
         subRateObject.showSubRateData();
         disableRightMenu("subRate",this.subRateSpread);
+        if(projectReadOnly){
+            if(this.subRateSetting.view.lockColumns){
+                this.subRateSetting.view.lockColumns = null;
+            }
+            disableSpread(this.subRateSpread);
+        }
     },
     showSubRateData:function () {
         this.subRateSheet.setRowCount(0);

+ 20 - 2
web/building_saas/main/js/views/sub_view.js

@@ -32,7 +32,9 @@ SheetDataHelper.protectdSheet(subSpread.getSheet(1));
 //安装增加费
 installationFeeObj.initRationInstallSheet(subSpread.getSheet(3));
 SheetDataHelper.protectdSheet(subSpread.getSheet(3));
-gljContextMenu.loadGLJSpreadContextMenu();
+if(!projectReadOnly){
+    gljContextMenu.loadGLJSpreadContextMenu();
+}
 
 $("#linkGLJ").click(function(){
     $("#subItems").children().hide();//控制显示subSpread,隐藏特征及内容spread
@@ -118,6 +120,9 @@ $("#linkTZJNR").click(function () {
 // 应用到选中清单
 let isSaving = false;
 $("#use-to-current").click(function() {
+    if(projectReadOnly){
+        return false;
+    }
     if (isSaving) {
         return false;
     }
@@ -144,6 +149,9 @@ $("#use-to-current").click(function() {
 });
 // 应用到所有的清单
 $("#use-to-all").click(function() {
+    if(projectReadOnly){
+        return false;
+    }
     let treeNode = projectObj.mainController.tree;
     const setting = getAddRuleSetting();
     if (treeNode.items === undefined || treeNode.items.length <= 0) {
@@ -295,6 +303,10 @@ function setRule(setting) {
     $("#child-display-format").change();
 
     $("#serial-type").val(setting.serialType);
+
+    if(projectReadOnly){
+        disableTools();
+    }
 }
 
 function activeSubSheetIs(idx){
@@ -384,4 +396,10 @@ $('#linkGCLMX').on('shown.bs.tab', function () {
 
 $('#linkAZZJF').on('shown.bs.tab', function () {
     gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected, '111111');
-});
+});
+
+if(projectReadOnly){
+    disableSpread(subSpread);
+    disableSpread(contentOprObj.workBook);
+    disableSpread(characterOprObj.workBook);
+}

+ 3 - 1
web/building_saas/main/js/views/tender_price_view.js

@@ -388,7 +388,9 @@ let tender_obj={
         $('#calcPriceOption').val(calcPriceOption);
         $('#gljPriceTenderCoe').val(gljPriceTenderCoe);
         if(calcPriceOption == 'coeBase'){
-            $('#tenderPrice').removeAttr("disabled");
+            if(!projectReadOnly){
+                $('#tenderPrice').removeAttr("disabled");
+            }
             $('#tenderGLJQuantity').attr("disabled",true);
             $('#tenderRationQuantity').attr("disabled",true);
         }else {

+ 3 - 0
web/building_saas/main/js/views/zmhs_view.js

@@ -46,6 +46,9 @@ let zmhs_obj = {
         this.assSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);
         this.assSheet.name('ration_ass');
         SheetDataHelper.protectdSheet(this.coeSheet);
+        if(projectReadOnly){
+            disableSpread(zmhs_obj.coeSpread);
+        }
     },
     showCoeData:function (node) {
         let selected = node?node:projectObj.project.mainTree.selected;

+ 34 - 3
web/building_saas/pm/js/pm_share.js

@@ -300,11 +300,28 @@ const pmShare = (function () {
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             let offset = -1;
             let node = tree.items[hitinfo.row];
-            tree.selected = node;
             let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
-            let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;;
+            let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
+            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
+            let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
+                zoom = hitinfo.sheet.zoom();
+            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
+            //(图标+名字)区域
+            function withingClickArea(){
+                return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
+            }
+            //点击单位工程
+            if(node.data.projType === projectType.tender && withingClickArea()){
+                let newTab = window.open('about:blank');
+                BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
+                    let mainUrl = `/main?project=${node.data.ID}`;
+                    CommonAjax.get(mainUrl, [], function () {
+                        newTab.location.href = mainUrl;
+                    });
+                });
+            }
             if (!node || node.children.length === 0) { return; }
-
             if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
                 node.setExpanded(!node.expanded);
                 TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
@@ -318,6 +335,20 @@ const pmShare = (function () {
                 hitinfo.sheet.repaint();
             }
         };
+        TreeNodeCellType.prototype.processMouseMove = function (hitInfo) {
+            let sheet = hitInfo.sheet;
+            let div = sheet.getParent().getHost();
+            let canvasId = div.id + "vp_vp";
+            let canvas = $(`#${canvasId}`)[0];
+            //改变鼠标图案
+            if (sheet && hitInfo.isReservedLocation) {
+                canvas.style.cursor='pointer';
+                return true;
+            }else{
+                canvas.style.cursor='default';
+            }
+            return false;
+        };
         return new TreeNodeCellType();
     }
     //

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

@@ -12,7 +12,7 @@
             <div class="dropdown-menu">
                 <!--<a class="dropdown-item" href="/complementaryRation/main">定额库编辑器</a>-->
                 <a class="dropdown-item" href="javascript:void(0);" aria-expanded="false" data-toggle="modal" data-target="#opts-set"><i class="fa fa-sliders"></i> 选项</a>
-                <a class="dropdown-item" href="javascript:void(0);" data-toggle="modal" data-target="#comple-ration">定额库编辑器</a>
+                <a id="compleRationLib" class="dropdown-item" href="javascript:void(0);" data-toggle="modal" data-target="#comple-ration">定额库编辑器</a>
                 <a id="compleGljLib" class="dropdown-item" href="javascript:void(0);">人材机库编辑器</a>
             </div>
         </li>