Ver código fonte

feat: 费率页面,鼠标悬停在费率冬季施工、雨季施工时,应有弹窗显示地区划分表。

zhangweicheng 5 anos atrás
pai
commit
be8ab46fb8

+ 1 - 0
config/gulpConfig.js

@@ -83,6 +83,7 @@ module.exports = {
         'lib/pinyinjs/pinyin_dict_firstletter.js',
         'lib/pinyinjs/pinyinUtil.js',
         'web/building_saas/main/js/models/main_consts.js',
+        'web/building_saas/main/js/models/feeRateConsts.js',
         'public/web/common_util.js',
         'web/building_saas/glj/js/project_glj.js',
         'web/building_saas/glj/js/composition.js',

+ 36 - 11
public/web/sheet/sheet_common.js

@@ -211,7 +211,7 @@ var sheetCommonObj = {
             }
 
             if (setting.header[col].cellType === "tipsCell") {
-                this.setTipsCell(row, col, sheet, setting.header[col]);
+                this.setTipsCell(row, col, sheet);
             }
             if (setting.owner === 'gljTree') {
                 if (setting.header[col].cellType === "checkBox") {
@@ -223,6 +223,7 @@ var sheetCommonObj = {
                     val = distTypeVal;
                 }
             }
+            if(setting.setCellType) setting.setCellType(sheet,data[row],row,col)
             if (setting.header[col].getText) {
                 val = setting.getText[setting.header[col].getText](data[row], val)
             }
@@ -682,7 +683,7 @@ var sheetCommonObj = {
         sheet.setCellType(row, col, cellType, GC.Spread.Sheets.SheetArea.viewport);
     },
 
-    setTipsCell(row, col, sheet, header) {
+    setTipsCell(row, col, sheet,tips) {
         let TipCellType = function () { };
         TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
         TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
@@ -699,16 +700,20 @@ var sheetCommonObj = {
         };
         TipCellType.prototype.processMouseEnter = function (hitinfo) {
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
-            let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
-            let tag = hitinfo.sheet.getTag(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 });
-            let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
+            console.log(tips);
             let setting = {};
-            if (textLength <= cellWidth) {
-                return;
+            if(!tips){
+                let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
+                let tag = hitinfo.sheet.getTag(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 });
+                let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
+                if (textLength <= cellWidth) {
+                    return;
+                }
             }
+            text = tips;
             if (sheet && sheet.getParent().qo) {
                 setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
             }
@@ -856,7 +861,7 @@ var sheetCommonObj = {
         }
         return new getTipsCombo();
     }, */
-    getTreeNodeCellType: function (datas, row, parentMap,treeCol, paintFunc) {// 2018-09-26  不用spreadjs默认的树结构,自定义控件
+    getTreeNodeCellType: function (datas, row, parentMap,treeCol, paintFunc,tips) {// 2018-09-26  不用spreadjs默认的树结构,自定义控件
         var ns = GC.Spread.Sheets;
         let rectW = 10;
         let rectH = 10;
@@ -921,6 +926,26 @@ var sheetCommonObj = {
                 sheetArea: context.sheetArea
             };
         }
+        if(tips){
+            TreeNodeCellType.prototype.processMouseEnter = function (hitinfo) {
+                let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+                let setting = {};
+                text = tips;
+                if (hitinfo.sheet && hitinfo.sheet.getParent().qo) {
+                    setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
+                }
+    
+                TREE_SHEET_HELPER.showTipsDiv(text, setting, hitinfo);
+            };
+            TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
+                TREE_SHEET_HELPER.tipDiv = 'hide';
+                if (TREE_SHEET_HELPER._toolTipElement) {
+                    $(TREE_SHEET_HELPER._toolTipElement).hide();
+                    TREE_SHEET_HELPER._toolTipElement = null;
+                };
+                TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
+            };
+        }
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             ////方框外1像素内都有效
             if (!_.isEmpty(this.rectInfo) && Math.floor(hitinfo.x) <= this.rectInfo.x + this.rectInfo.rectW + 2 && Math.floor(hitinfo.x) >= this.rectInfo.x - 2) {

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

@@ -2043,6 +2043,7 @@
     <script src="/lib/pinyinjs/pinyin_dict_firstletter.js"></script>
     <script src="/lib/pinyinjs/pinyinUtil.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/models/main_consts.js"></script>
+    <script type="text/javascript" src="/web/building_saas/main/js/models/feeRateConsts.js"></script>
     <script type="text/javascript" src="/public/web/common_util.js"></script>
     <script type="text/javascript" src="/web/building_saas/glj/js/project_glj.js"></script>
     <script type="text/javascript" src="/web/building_saas/glj/js/composition.js"></script>

Diferenças do arquivo suprimidas por serem muito extensas
+ 97 - 0
web/building_saas/main/js/models/feeRateConsts.js


+ 0 - 1
web/building_saas/main/js/models/ration.js

@@ -797,7 +797,6 @@ var Ration = {
             node.updateData.quantityEXP="QDL*"+contain;
             node.updateData.quantity=scMathUtil.roundForObj(billQuantity*contain,getDecimal("quantity",node));
             if(!gljUtil.isKGtoT(billNode.data.unit,node.data.unit)){
-              console.log('hehe')
               let times = parseInt(node.data.unit);
               if (!isNaN(times)) {
                   node.updateData.quantityEXP+='*'+times;

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

@@ -762,15 +762,18 @@ var feeRateObject={
     },
     setLocAndFeeRateSTD:function(){
         if(feeRateObject.feeRateSTDLoaded)  return;
-        let location = projectObj.project.projectInfo.location;
-        if(!location) location = defaultLocation;
+        let location = this.getLocation();
         $('#location').val(location);
         //养护的工程所在地下拉框不可选
         if(!commonUtil.isGLYun()) $('#location').attr("disabled","disabled");
         feeRateObject.setFeeRateSTD(location);
         feeRateObject.feeRateSTDLoaded = true;
     },
-
+    getLocation:function(){
+        let location = projectObj.project.projectInfo.location;
+        if(!location) location = defaultLocation;
+        return location;
+    },
     setFeeRateSTD(location){
         let feeRateFile = projectObj.project.FeeRate.getActivateFeeRate();
         $('#feeRateStandard').empty();

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

@@ -59,7 +59,7 @@ let locateObject={
         settingList :[
             {background:"E2F2C5",describe:""},
             {background:"F9E2CF",describe:""},
-            {background:"F2EFD9",describe:"hehe"},
+            {background:"F2EFD9",describe:""},
             {background:"F5D1DA",describe:""},
             {background:"E3E3E3",describe:""},
             {background:"B6F3F2",describe:""},

+ 22 - 4
web/building_saas/main/js/views/sub_fee_rate_views.js

@@ -75,7 +75,7 @@ var subRateObject={
         this.subRateSheet.suspendPaint();
         this.subRateSheet.suspendEvent();
         for(let row =0; row < this.datas.length;row++){
-            this.setComboOptionCell(row,1,this.datas[row],this.subRateSheet);
+            this.setComboOptionCell(row,1,this.datas[row],this.subRateSheet,this.datas[row].name);
             this.setTreeNodeCellType(this.datas,row,parentMap,visibleMap,this.subRateSheet);
         }
         this.subRateSheet.resumeEvent();
@@ -87,9 +87,20 @@ var subRateObject={
     onSubRateSelectChanged:function (e,info) {
         info.sheet.repaint();
     },
+    getAreaTips:function(name){
+        let field = name === "冬季施工"?"temperatureArea":"rainfallArea";
+        let location = feeRateObject.getLocation();
+        let area = feeRateAreaMap[location];
+        return area[field]||null;
+    },
     setTreeNodeCellType:function (datas,row,parentMap,visibleMap,sheet) {
         delete parentMap.undefined;//去掉无用节点
-        let treeNode = sheetCommonObj.getTreeNodeCellType(datas,row,parentMap);
+        let treeNode = null;
+        if(datas[row].name == "冬季施工" || datas[row].name == "雨季施工"){
+            treeNode = sheetCommonObj.getTreeNodeCellType(datas,row,parentMap,null,null,this.getAreaTips(datas[row].name));
+        }else{
+            treeNode = sheetCommonObj.getTreeNodeCellType(datas,row,parentMap);
+        }
         treeNode.treeNodeType = false;
         if((datas[row].subList && datas[row].subList.length >0)||datas[row].isSub == true ){
             treeNode.treeNodeType = true;
@@ -98,13 +109,20 @@ var subRateObject={
         sheet.setCellType(row, 0, treeNode, GC.Spread.Sheets.SheetArea.viewport);
         if(visibleMap[datas[row].ParentID]) sheet.getRange(row , -1, 1, -1).visible(!visibleMap[datas[row].ParentID]);//显示或隐藏
     },
-    setComboOptionCell:function(row,col,subRate,sheet){
+    setComboOptionCell:function(row,col,subRate,sheet,name){
         let options=[];
         if(subRate.isSub == true) return;//是树节点的子节点;
         for(let op of subRate.optionList){
            options.push(op.name);
         }
-        let dynamicCombo = sheetCommonObj.getDynamicCombo();//new GC.Spread.Sheets.CellTypes.ComboBox();
+        let dynamicCombo =null;
+        if(name == "冬季施工" || name == "雨季施工"){
+            let tips = this.getAreaTips(name)
+            dynamicCombo = sheetCommonObj.getTipsCombo(true, tips, {})
+        }else{
+            dynamicCombo = sheetCommonObj.getDynamicCombo();//new GC.Spread.Sheets.CellTypes.ComboBox();
+        }
+         
         dynamicCombo.items(options);
         if(subRate.editable == true) dynamicCombo.editable(true);
         sheet.setCellType(row, col, dynamicCombo, GC.Spread.Sheets.SheetArea.viewport);