Browse Source

快速列设置

zhongzewei 7 years ago
parent
commit
ec6a77b19d

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

@@ -88,6 +88,7 @@
                       <% } else { %>
                       <a href="javascript:void(0)" class="btn btn-sm" name="lockBills"  title=""> <i class="fa fa-lock" aria-hidden="true"></i> 锁定清单</a>
                       <% } %>
+                      <a id="switchTznr" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征内容</a>
                   </div>
                   <div class="side-tabs">
                       <ul class="nav nav-tabs" role="tablist">

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

@@ -865,9 +865,9 @@ let baseFigureTemplate = {
         if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
         return cbTools.isDef(bill.feesIndex.estimate) && cbTools.isDef(bill.feesIndex.estimate[totalFeeType]) ? bill.feesIndex.estimate[totalFeeType] : 0;
     },
-    'ZGCLFFGLJ': function () {//暂估材料费(从工料机汇总表汇总)
+   /* 'ZGCLFFGLJ': function () {//暂估材料费(从工料机汇总表汇总)
         return 0;
-    },
+    },*/
     'FBF': function (tender) {//分包费
         const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
         let rst = 0;
@@ -1032,7 +1032,7 @@ let baseFigureMap = {
     '甲定主材费': {base: 'JDZCF', class: 'RCJ'},
     '甲定设备费': {base: 'JDSBF', class: 'RCJ'},
     '暂估材料费(从子目汇总)': {base: 'ZGCLFFZM', class: 'RCJ'},
-    '暂估材料费(从工料机汇总表汇总)': {base: 'ZGCLFFGLJ', class: 'RCJ'},
+    /*'暂估材料费(从工料机汇总表汇总)': {base: 'ZGCLFFGLJ', class: 'RCJ'},*/
     '分包费': {base: 'FBF', class: 'FBF'},
     '分包定额基价人工费': {base: 'FBDEJJRGF', class: 'FBF'},
     '分包定额基价材料费': {base: 'FBDEJJCLF', class: 'FBF'},

+ 2 - 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 && !projectReadOnly){
+            if(calcBaseView.editingCell && !projectReadOnly && calcBaseView.ifEdit()){
                 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,7 @@ let calcBaseView = {
                 var imageHeight = hitinfo.cellRect.height-2*imageMagin;
                 var imageWidth = hitinfo.cellRect.width*2/7;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly){
+                    if(!projectReadOnly && me.ifEdit()){
                         calcBaseView.initCalctor(type);
                     }
                 }

+ 96 - 19
web/building_saas/main/js/views/main_tree_col.js

@@ -424,27 +424,96 @@ let colSettingObj = {
         }
         return false;
     },
-    updateColSetting: function () {
-        let sheet = this.settingSpread.getActiveSheet();
-         let mainSheet = projectObj.mainSpread.getActiveSheet();
-         for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
-         projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
-         projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
-         }
-         SheetDataHelper.massOperationSheet(mainSheet, function () {
-         SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, mainSheet);
-         //左右滚动条到最左边
-         mainSheet.showColumn(projectObj.project.projSetting.mainGridSetting.frozenCols, GC.Spread.Sheets.HorizontalPosition.left);
-         });
-         //refresh nodes to autoFitRow
-         projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
-         projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
-         projectID: projectObj.project.ID(),
-         main_tree_col: projectObj.project.projSetting.main_tree_col
-         });
+    updateColSetting: function (skipSetValue = false) {
+        let mainSheet = projectObj.mainSpread.getActiveSheet();
+        if(!skipSetValue){
+            let sheet = this.settingSpread.getActiveSheet();
+            for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
+                projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
+                projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
+            }
+        }
+        SheetDataHelper.massOperationSheet(mainSheet, function () {
+            SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, mainSheet);
+            //左右滚动条到最左边
+            mainSheet.showColumn(projectObj.project.projSetting.mainGridSetting.frozenCols, GC.Spread.Sheets.HorizontalPosition.left);
+        });
+        //refresh nodes to autoFitRow
+        projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
+        if(!skipSetValue){
+            //列设置将项目特征和工作内容都取消打钩后,更新快速列设置
+            if(!this.getVisible('itemCharacterText') && !this.getVisible('jobContentText')){
+                switchTznrHtml(true);
+            }
+            if(this.getVisible('itemCharacterText') && this.getVisible('jobContentText')){
+                switchTznrHtml(false);
+            }
+        }
+        projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
+            projectID: projectObj.project.ID(),
+            main_tree_col: projectObj.project.projSetting.main_tree_col
+        });
+    },
+    setVisible: function (field, visible) {
+        let mainTreeCols = projectObj.project.projSetting.main_tree_col.cols;
+        for(let colSetting of mainTreeCols){
+            if(colSetting.data.field === field){
+                colSetting.visible = visible;
+                break;
+            }
+        }
+        let mainGridCols = projectObj.project.projSetting.mainGridSetting.cols;
+        for(let colSetting of mainGridCols){
+            if(colSetting.data.field === field){
+                colSetting.visible = visible;
+                break;
+            }
+        }
+    },
+    getVisible: function(field){
+        let cols = projectObj.project.projSetting.main_tree_col.cols;
+        for(let colSetting of cols){
+            if(colSetting.data.field === field){
+                return colSetting.visible;
+            }
+        }
+        return false;
     }
+
 };
 
+function switchTznrHtml(show) {
+    if(show){
+        let newHmtl = $('#switchTznr').html().replace('隐藏', '显示');
+        $('#switchTznr').html(newHmtl);
+        $('#switchTznr').find('i').removeClass('fa-eye-slash');
+        $('#switchTznr').find('i').addClass('fa-eye');
+    }
+    else {
+        let newHmtl = $('#switchTznr').html().replace('显示', '隐藏');
+        $('#switchTznr').html(newHmtl);
+        $('#switchTznr').find('i').removeClass('fa-eye');
+        $('#switchTznr').find('i').addClass('fa-eye-slash');
+    }
+}
+
+$('#switchTznr').click(function () {
+    let me = colSettingObj;
+    let cur = $(this).text();
+    if(cur.includes('显示特征内容')){
+        switchTznrHtml(false);
+        me.setVisible('itemCharacterText', true);
+        me.setVisible('jobContentText', true);
+        me.updateColSetting(true);
+    }
+    else {
+        switchTznrHtml(true);
+        me.setVisible('itemCharacterText', false);
+        me.setVisible('jobContentText', false);
+        me.updateColSetting(true);
+    }
+});
+
 $('#poj-set').on('shown.bs.modal', function (e) {
     if (!colSettingObj.settingSpread) {
         colSettingObj.initSettingSpread();
@@ -452,6 +521,15 @@ $('#poj-set').on('shown.bs.modal', function (e) {
             disableSpread(colSettingObj.settingSpread);
         }
     }
+    if($('#tab_display_setting').hasClass('active')){
+        let sheet = colSettingObj.settingSpread.getActiveSheet();
+        SheetDataHelper.massOperationSheet(sheet, function () {
+            for(let row = 0; row < sheet.getRowCount(); row++){
+                let orgData = projectObj.project.projSetting.main_tree_col.cols[row].visible;
+                sheet.setValue(row, 0, orgData);
+            }
+        });
+    }  
 });
 
 $('#poj-set').on('hidden.bs.modal', function (e) {
@@ -467,7 +545,6 @@ $('#poj-set').on('hidden.bs.modal', function (e) {
     }
 });
 
-
 $('#tab_display_setting').on('shown.bs.tab', function () {
     if(colSettingObj.settingSpread){
         colSettingObj.settingSpread.refresh();

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

@@ -41,7 +41,6 @@ var projectInfoObj = {
                 basicInfoView.orgDatas = data.property.basicInformation ? basicInfoView.toViewDatas(data.property.basicInformation) : [];
                 projFeatureView.orgDatas = data.property.projectFeature ? projFeatureView.toViewDatas(data.property.projectFeature) : [];
                 $('#fullpath').html(that.getFullPathHtml(that.projectInfo));
-
             }
         });
     }

+ 7 - 0
web/building_saas/main/js/views/project_view.js

@@ -601,6 +601,13 @@ var projectObj = {
         this.project.loadDatas(function (err) {
             let mTime = +new Date();
             console.log(`get data时间——${mTime - startTime}`);
+            //快速列设置
+            if(!colSettingObj.getVisible('itemCharacterText') && !colSettingObj.getVisible('jobContentText')){
+                switchTznrHtml(true);
+            }
+            if(colSettingObj.getVisible('itemCharacterText') && colSettingObj.getVisible('jobContentText')){
+                switchTznrHtml(false);
+            }
             if (!err) {
                 that.project.projectGLJ.calcQuantity(true);//计算分部分项和技术措施项目消耗量;
                 gljCol.initGljCol(that.project.projSetting.glj_col?that.project.projSetting.glj_col.showAdjustPrice:false);