Browse Source

feat: 清单精灵库,单位区间列挪位置,指引列文本超出单元格,悬浮提示

vian 3 years atrás
parent
commit
c24712ace5

+ 42 - 3
public/web/tree_sheet/tree_sheet_helper.js

@@ -168,6 +168,8 @@ var TREE_SHEET_HELPER = {
         var indent = 20;
         var halfBoxLength = 5;
         var halfExpandLength = 3;
+        let defaultHeight = 17; // 单元格默认高度,getAutoFitHeight返回17时,单元格高度才是20...不清楚原因
+        let levelIndent = -5;
 
         var TreeNodeCellType = function () {
         };
@@ -311,9 +313,44 @@ var TREE_SHEET_HELPER = {
                 hitinfo.sheet.repaint();
             }
         };
+       /*  TreeNodeCellType.prototype.getAutoFitHeight = function(value, text, cellStyle, zoomFactor, context){
+            debugger;
+            // if (!defaultHeight) {
+                defaultHeight = context.sheet.getCell(context.row, -1).height();
+            // }
+            const node = tree.items[context.row];
+            const nodeIndent = node ? (node.depth() + 1) * indent +  node.depth() * levelIndent + 5 : 0;
+            const cellWidth = context.sheet.getCell(-1, context.col).width();
+            const textLength = this.getAutoFitWidth(...arguments);
+            const tempNum = textLength / (cellWidth - nodeIndent);
+            const lineNum = tempNum % 1 > 0.92 ? Math.ceil(tempNum + 1) : Math.ceil(tempNum); // 不这么处理的话有些行高算出来不对
+            //const lineNum = Math.ceil(textLength / (cellWidth - nodeIndent));
+            return lineNum * defaultHeight;
+        }; */
         TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
             if(hitinfo.sheet.name() === 'stdBillsGuidance_bills'){
                 TREE_SHEET_HELPER.delayShowTips(hitinfo,setting);
+            } else if (hitinfo.sheet.name() === 'stdBillsGuidance_guidance') {
+                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 node = tree.items[hitinfo.row];
+                let nodeIndent = node ? (node.depth() + 1) * indent +  node.depth() - 3 : 0;
+                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 - nodeIndent && node.data.name){
+                    // hitinfo.x += 100;
+                    const leftWidth = $('#billsSpread').width();
+                    hitinfo.x += leftWidth + 10;
+                    hitinfo.y += 10;
+                    TREE_SHEET_HELPER.delayShowTips(hitinfo,setting, node.data.name);
+                }
+                // const node = tree.items[hitinfo.row];
+                console.log(node);
+                console.log(hitinfo);
+                /* let textWidth = ctx.measureText(value).width;
+                console.log(textWidth); */
             }
         };
         TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
@@ -343,8 +380,9 @@ var TREE_SHEET_HELPER = {
                         .css("border", "1px #C0C0C0 solid")
                         .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
                         .css("font", "9pt Arial")
-                        .css("background", "white")
-                        .css("padding", 5);
+                        .css("padding", 5)
+                        .css("background", '#303133')
+                        .css("color", '#fff');
 
                     this._toolTipElement = div;
                 }
@@ -404,8 +442,9 @@ var TREE_SHEET_HELPER = {
                         .css("border", "1px #C0C0C0 solid")
                         .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
                         .css("font", "0.9rem Calibri")
-                        .css("background", "white")
                         .css("padding", 5)
+                        .css("background", '#303133')
+                        .css("color", '#fff')
                     $(div).attr("id", 'autoTip');
                     $(div).hide();
                     document.body.insertBefore(div, null);

+ 34 - 29
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -169,9 +169,9 @@ const billsGuidance = (function () {
             },
             {
                 width: 40,
-                readOnly: locked,
+                readOnly: true,
                 head: {
-                    titleNames: ["单位"],
+                    titleNames: ["输出特征"],
                     spanCols: [1],
                     spanRows: [1],
                     vAlign: [1],
@@ -179,18 +179,17 @@ const billsGuidance = (function () {
                     font: ["Arial"]
                 },
                 data: {
-                    field: "unit",
+                    field: "outputItemCharacter",
                     vAlign: 1,
                     hAlign: 1,
-                    font: "Arial",
-                    formatter: "@"
+                    font: "Arial"
                 }
             },
             {
-                width: 80,
-                readOnly: locked,
+                width: 30,
+                readOnly: true,
                 head: {
-                    titleNames: ["区间"],
+                    titleNames: ["必填"],
                     spanCols: [1],
                     spanRows: [1],
                     vAlign: [1],
@@ -198,18 +197,17 @@ const billsGuidance = (function () {
                     font: ["Arial"]
                 },
                 data: {
-                    field: "interval",
+                    field: "required",
                     vAlign: 1,
                     hAlign: 1,
-                    font: "Arial",
-                    formatter: "@"
+                    font: "Arial"
                 }
             },
             {
-                width: 40,
+                width: 30,
                 readOnly: true,
                 head: {
-                    titleNames: ["输出特征"],
+                    titleNames: ["材料"],
                     spanCols: [1],
                     spanRows: [1],
                     vAlign: [1],
@@ -217,7 +215,7 @@ const billsGuidance = (function () {
                     font: ["Arial"]
                 },
                 data: {
-                    field: "outputItemCharacter",
+                    field: "isMaterial",
                     vAlign: 1,
                     hAlign: 1,
                     font: "Arial"
@@ -227,7 +225,7 @@ const billsGuidance = (function () {
                 width: 30,
                 readOnly: true,
                 head: {
-                    titleNames: ["必填"],
+                    titleNames: ["默认"],
                     spanCols: [1],
                     spanRows: [1],
                     vAlign: [1],
@@ -235,17 +233,17 @@ const billsGuidance = (function () {
                     font: ["Arial"]
                 },
                 data: {
-                    field: "required",
+                    field: "isDefaultOption",
                     vAlign: 1,
                     hAlign: 1,
                     font: "Arial"
                 }
             },
             {
-                width: 30,
-                readOnly: true,
+                width: 40,
+                readOnly: locked,
                 head: {
-                    titleNames: ["材料"],
+                    titleNames: ["单位"],
                     spanCols: [1],
                     spanRows: [1],
                     vAlign: [1],
@@ -253,17 +251,18 @@ const billsGuidance = (function () {
                     font: ["Arial"]
                 },
                 data: {
-                    field: "isMaterial",
+                    field: "unit",
                     vAlign: 1,
                     hAlign: 1,
-                    font: "Arial"
+                    font: "Arial",
+                    formatter: "@"
                 }
             },
             {
-                width: 30,
-                readOnly: true,
+                width: 80,
+                readOnly: locked,
                 head: {
-                    titleNames: ["默认"],
+                    titleNames: ["区间"],
                     spanCols: [1],
                     spanRows: [1],
                     vAlign: [1],
@@ -271,22 +270,23 @@ const billsGuidance = (function () {
                     font: ["Arial"]
                 },
                 data: {
-                    field: "isDefaultOption",
+                    field: "interval",
                     vAlign: 1,
                     hAlign: 1,
-                    font: "Arial"
+                    font: "Arial",
+                    formatter: "@"
                 }
             },
         ]
         },
         headers: [
             {name: '项目指引', dataCode: 'name', width: 400, vAlign: 'center', hAlign: 'left', formatter: '@'},
-            {name: '单位', dataCode: 'unit', width: 40, vAlign: 'center', hAlign: 'center', formatter: '@'},
-            {name: '区间', dataCode: 'interval', width: 80, vAlign: 'center', hAlign: 'center', formatter: '@'},
             {name: '输出特征', dataCode: 'outputItemCharacter', width: 40, vAlign: 'center', hAlign: 'center'},
             {name: '必填', dataCode: 'required', width: 30, vAlign: 'center', hAlign: 'center'},
             {name: '材料', dataCode: 'isMaterial', width: 30, vAlign: 'center', hAlign: 'center'},
             {name: '默认', dataCode: 'isDefaultOption', width: 30, vAlign: 'center', hAlign: 'center'},
+            {name: '单位', dataCode: 'unit', width: 40, vAlign: 'center', hAlign: 'center', formatter: '@'},
+            {name: '区间', dataCode: 'interval', width: 80, vAlign: 'center', hAlign: 'center', formatter: '@'},
         ],
         events: {
             SelectionChanged: function (sender, info) {
@@ -303,6 +303,9 @@ const billsGuidance = (function () {
             },
             CellDoubleClick: function(sender, args) {
                 locateAtRation(args.row);
+            },
+            EnterCell: function(sender, args) {
+                console.log(args.row);
             }
         }
     };
@@ -568,6 +571,7 @@ const billsGuidance = (function () {
                 sheet.getRange(-1, 1, -1, -1).locked(true);
             }
             else if(module === guideItem){
+                sheet.name('stdBillsGuidance_guidance');
                 sheetCommonObj.bindEscKey(module.workBook, [{sheet: sheet, editStarting: null, editEnded: module.events.EditEnded}]);
             }
             else if (module === billMaterial) {
@@ -949,8 +953,9 @@ const billsGuidance = (function () {
                                     .css("border", "1px #C0C0C0 solid")
                                     .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
                                     .css("font", "0.9rem Calibri")
-                                    .css("background", "white")
                                     .css("padding", 5)
+                                    .css("background", '#303133')
+                                    .css("color", '#fff')
                                     .attr("id", 'autoTip1');
                                 $(div).hide();
                                 document.body.insertBefore(div, null);