소스 검색

在费率页面、费率弹窗页面,当备注列文字较多时,应悬停显示完整

vian 5 년 전
부모
커밋
4f508f4d1e
2개의 변경된 파일14개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 6
      public/web/tree_sheet/tree_sheet_helper.js
  2. 5 2
      web/building_saas/main/js/views/fee_rate_view.js

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

@@ -222,7 +222,7 @@ var TREE_SHEET_HELPER = {
         }
        sheet.invalidateLayout();
     },
-    showTreeData: function (setting, sheet, tree) {
+    getTipCellType: function (setting) {
         let TipCellType = function () {};
         TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
         TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
@@ -245,7 +245,7 @@ var TREE_SHEET_HELPER = {
                 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();
-            let dataField = setting.cols[hitinfo.col].data.field;
+            let dataField = setting.cols && setting.cols[hitinfo.col].data.field || setting.header[hitinfo.col].dataCode;
 
             if((tag==undefined||tag=='')&&hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){//显示其它列的标记为空并且设置了自动换行
                 return;
@@ -279,7 +279,9 @@ var TREE_SHEET_HELPER = {
         TipCellType.prototype.processMouseLeave = function (hitinfo) {
             TREE_SHEET_HELPER.hideTipsDiv();
         }
-
+        return new TipCellType();
+    },
+    showTreeData: function (setting, sheet, tree) {
         TREE_SHEET_HELPER.protectdSheet(sheet);
         TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
             sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);
@@ -292,7 +294,7 @@ var TREE_SHEET_HELPER = {
             setting.cols.forEach(function (colSetting, iCol) {
                 sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
                 if (colSetting.showHint) {
-                    sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
+                    sheet.getRange(-1, iCol, -1, 1).cellType(TREE_SHEET_HELPER.getTipCellType(setting));
                 }
                 if(colSetting.formatter){
                     sheet.setFormatter(-1, iCol, colSetting.formatter, GC.Spread.Sheets.SheetArea.viewport);
@@ -608,7 +610,7 @@ var TREE_SHEET_HELPER = {
 
     },
     showTipsDiv:function (text,setting,hitinfo) {
-        if (setting.pos && text && text !== '') {
+        if (text && text !== '') {
             if(text) text = replaceAll(/[\n]/,'<br>',text);
             if(!this._fixedTipElement){
                 let div = $('#fixedTip')[0];
@@ -649,7 +651,7 @@ var TREE_SHEET_HELPER = {
                         $(this._toolTipElement).width(divWidth);
                     }
                     let top = setting.pos.y  + hitinfo.y - divHeight / 2 < 0 ? 0 : setting.pos.y  + hitinfo.y - divHeight / 2;
-                    $(this._toolTipElement).css("top", top).css("left", setting.pos.x - divWidth);
+                    $(this._toolTipElement).css("top", top).css("left", setting.pos.x - divWidth).css;
                 } else {
                     //计算显示的初始位置
                /*   显示在单元格上方,三角形指向下的版本
@@ -661,6 +663,7 @@ var TREE_SHEET_HELPER = {
                     let left =  setting.pos.x + hitinfo.cellRect.x;
                     $(this._toolTipElement).css("top", top).css("left", left).css("max-width","500px");
                 }
+                $(this._toolTipElement).css('z-index', 9999);
                 $(this._toolTipElement).show("fast");
                 TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
             }

+ 5 - 2
web/building_saas/main/js/views/fee_rate_view.js

@@ -12,7 +12,7 @@ var feeRateObject={
         header: [
             {headerName: "专业名称", headerWidth: 250, dataCode: "name", dataType: "String"},
             {headerName: "值%", headerWidth: 80, dataCode: "rate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
-            {headerName: "备注", headerWidth: 150, dataCode: "memo", dataType: "String"}
+            {headerName: "备注", headerWidth: 150, dataCode: "memo", dataType: "String", showHint: true}
         ],
         view: {
             lockColumns: [0]
@@ -33,7 +33,7 @@ var feeRateObject={
         header: [
             {headerName: "专业名称", headerWidth: 200, dataCode: "name", dataType: "String"},
             {headerName: "值%", headerWidth: 120, dataCode: "rate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
-            {headerName: "备注", dataCode: "memo", dataType: "String"}
+            {headerName: "备注", dataCode: "memo", dataType: "String", showHint: true}
         ],
         view: {
             comboBox: [],
@@ -158,6 +158,9 @@ var feeRateObject={
             if (setting.header[col].formatter) {
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
             }
+            if (setting.header[col].showHint) {
+                sheet.getRange(-1, col, -1, 1).cellType(TREE_SHEET_HELPER.getTipCellType(setting));
+            }
             for (let row = 0; row < data.length; row++) {
                 let val = data[row][setting.header[col].dataCode];
                 if(val&&setting.header[col].dataType === "Number"){