zhangweicheng 6 роки тому
батько
коміт
41b74542e4

+ 26 - 1
public/web/sheet/sheet_common.js

@@ -502,11 +502,36 @@ var sheetCommonObj = {
             if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex() && (!forLocked || forLocked && !sheet.getCell(options.row, options.col).locked())) {
                 return GC.Spread.Sheets.CellTypes.ComboBox.prototype.getHitInfo.apply(this, arguments);
             } else {
-                return GC.Spread.Sheets.CellTypes.Base.prototype.getHitInfo.apply(this, arguments);
+                return  {
+                    x: x,
+                    y: y,
+                    row: options.row,
+                    col: options.col,
+                    cellStyle: cellStyle,
+                    cellRect: cellRect,
+                    sheetArea: options.sheetArea
+                };//GC.Spread.Sheets.CellTypes.Text.prototype.getHitInfo.apply(this, arguments);
             }
         };
         return new ComboCellForActiveCell();
     },
+    getTipsCombo:function (forLocked,tips,setting) {
+        let getTipsCombo = function () {
+
+        };
+        getTipsCombo.prototype = sheetCommonObj.getDynamicCombo(forLocked);
+        if(tips && tips !=""){
+            getTipsCombo.prototype.processMouseEnter = function(hitinfo){
+                console.log(hitinfo);
+                TREE_SHEET_HELPER.delayShowTips(hitinfo,setting,tips);
+            };
+            getTipsCombo.prototype.processMouseLeave = function (hitinfo) {
+                TREE_SHEET_HELPER.hideTipsDiv();
+            };
+        }
+        return new getTipsCombo();
+    },
+
     setDynamicCombo: function (sheet, beginRow, col, rowCount, items, itemsHeight, itemsType) {
         let me = this;
         sheet.suspendPaint();

+ 14 - 6
public/web/tree_sheet/tree_sheet_helper.js

@@ -167,9 +167,9 @@ var TREE_SHEET_HELPER = {
                         let tag ="";
                         if(node.sourceType == ModuleNames.ration){//定额的时候换算子目
                             tag = node.data.adjustState?node.data.adjustState:'';
-                        }else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
+                        }/*else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示  这里改成在 计量单位那里提示
                             tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
-                        }
+                        }*/
                         sheet.setTag(iRow, iCol,tag);
                     }
                     /*if(colSetting.data.field=="name"){ 2018-08-06 改成在编号列悬浮提示
@@ -187,7 +187,7 @@ var TREE_SHEET_HELPER = {
                     cell.value(getFieldText2());
                 }
                 if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
-                    cell.cellType(colSetting.data.cellType(node));
+                    cell.cellType(colSetting.data.cellType(node,setting));
                 }
                 if(colSetting.data.autoHeight == true){
                     colSetting.setAutoHeight(cell,node);
@@ -486,7 +486,7 @@ var TREE_SHEET_HELPER = {
                     setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
                 }
                 if(text) text = replaceAll(/[\n]/,'<br>',text);
-                $(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border"></div><div class="triangle-border tb-background"></div>`);
+                $(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border_up"></div><div class="triangle-border tb-background_up"></div>`);
                 //清单指引、清单库做特殊处理
                 if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
                     $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
@@ -497,9 +497,15 @@ var TREE_SHEET_HELPER = {
                     $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y  -$(this._toolTipElement).height() -20).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
                 } else {
                     //计算显示的初始位置
+               /*   显示在单元格上方,三角形指向下的版本
                     let top = setting.pos.y + hitinfo.cellRect.y -$(this._toolTipElement).height() -26;
                     let left =  setting.pos.x + hitinfo.cellRect.x;
+                    $(this._toolTipElement).css("top", top).css("left", left);*/
+                    //显示在下方,三角形指
+                    let top = setting.pos.y  + hitinfo.cellRect.y+26;
+                    let left =  setting.pos.x + hitinfo.cellRect.x;
                     $(this._toolTipElement).css("top", top).css("left", left);
+
                 }
                 $(this._toolTipElement).show("fast");
                 TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
@@ -527,14 +533,16 @@ var TREE_SHEET_HELPER = {
             }
         },600)
     },
-    delayShowTips:function(hitinfo,setting){//延时显示
+    delayShowTips:function(hitinfo,setting,tips){//延时显示
         let delayTimes = 500; //延时时间
         let now_timeStamp = +new Date();
         TREE_SHEET_HELPER.tipTimeStamp = now_timeStamp;
         setTimeout(function () {
             if(now_timeStamp - TREE_SHEET_HELPER.tipTimeStamp == 0){//鼠标停下的时候才显示
-                let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
                 let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+                if(tips && tips !=""){ //有tips的话优先显示tips
+                    tag = tips;
+                }
                 if(tag&&tag!=''){
                     TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
                 }

+ 4 - 1
web/building_saas/css/custom.css

@@ -96,7 +96,10 @@ legend.legend{
 }
 .tb-background_up {
     top:-11px;
-    border-color:transparent transparent #000 transparent;}
+    border-color:transparent transparent #000 transparent;
+}
+
+
 .elf-options:hover{
     background-color: #CCCCCC;
 }

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

@@ -249,13 +249,18 @@ let MainTreeCol = {
         }
     },
     cellType: {
-        unit: function () {
-            let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
+        unit: function (node,setting) {
+            let tips = "";
+            //在这里做要不要显示的判断
+             if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
+                tips = node.data.itemCharacterText?node.data.itemCharacterText:'';
+             }
+             console.log(setting);
+            let dynamicCombo = sheetCommonObj.getTipsCombo(true,tips,setting);//sheetCommonObj.getDynamicCombo(true);
             dynamicCombo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
                 '根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']).editable(true);
             return dynamicCombo;
         },
-
         units: function () {
             this.unit;
         },

+ 8 - 5
web/building_saas/main/js/views/project_glj_view.js

@@ -1202,8 +1202,8 @@ $(function () {
             changeUnitPriceId = $("#self-file").val();
             if(!changeUnitPriceId){
                 alert('单价文件不可为空');
-                return;
             }
+            submitFileChange(changeUnitPriceId,type);
         } else {
             // 从其他项目中复制
             changeUnitPriceId = $("#other-file").val();
@@ -1214,14 +1214,17 @@ $(function () {
                     $("#newUnitFileID").val(changeUnitPriceId);
                     $("#newUnitFileName").val(newName);
                 }else {
-                    let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
-                    projectObj.project.projectGLJ.changeFile(data,function () {
-                        projectGljObject.changeFileCallback();
-                    })
+                    submitFileChange(changeUnitPriceId,type);
                 }
             });
         }
 
+        function submitFileChange(changeUnitPriceId,type)  {
+            let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
+            projectObj.project.projectGLJ.changeFile(data,function () {
+                projectGljObject.changeFileCallback();
+            })
+        }
     });
     // 单价文件选项切换
     $("input[name='change-type']").change(function () {