Browse Source

standard bills lib, highlight search result

MaiXinRong 7 năm trước cách đây
mục cha
commit
0da4c8173b

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

@@ -164,6 +164,15 @@ var TREE_SHEET_HELPER = {
         };
         TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
         TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
+            console.log(style);
+            if (style.backColor) {
+                ctx.save();
+                ctx.fillStyle = style.backColor;
+                ctx.fillRect(x, y, w, h);
+                ctx.restore();
+            } else {
+                ctx.clearRect(x, y, w, h);
+            }
             // ������(x1, y1)���(��, ��), (x2, y2)�յ�(��, ��), ��ɫ
             var drawLine = function (canvas, x1, y1, x2, y2, color) {
                 ctx.save();

+ 20 - 1
web/building_saas/main/js/views/std_bills_lib.js

@@ -38,6 +38,14 @@ var billsLibObj = {
             this.stdBillsFeatureSpread.refresh();
         }
     },
+    clearHighLight: function (spread) {
+        if (spread) {
+            let sheet = spread.getActiveSheet();
+            sheet.suspendPaint();
+            sheet.getRange(0, -1, sheet.getRowCount(), -1, GC.Spread.Sheets.SheetArea.viewport).backColor(undefined);
+            sheet.resumePaint();
+        }
+    },
     loadStdBillsLib: function () {
         let i, select = $('#stdBillsLibSelect');
         select.empty();
@@ -163,6 +171,10 @@ var billsLibObj = {
                 stdBillsTreeController.setTreeSelected(result[0]);
                 billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
 
+                for (let node of result) {
+                    billsLibObj.stdBillsSpread.getActiveSheet().getRange(node.serialNo(), -1, 1, -1).backColor('lemonChiffon');
+                }
+
                 $('#nextStdBills').show();
                 $('#nextStdBills').click(function () {
                     var cur = stdBillsTree.selected, resultIndex = result.indexOf(cur), sel = billsLibObj.stdBillsSpread.getActiveSheet().getSelections();
@@ -175,6 +187,7 @@ var billsLibObj = {
                     }
                 });
             } else {
+                billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
                 $('#nextStdBills').hide();
             }
             $('#stdBillsSearchResultCount').text('搜索结果:' + result.length);
@@ -332,13 +345,19 @@ $('#stdBillsTab').bind('click', function () {
     };
 });
 $('#stdBillsLibSelect').change(function () {
+    $('#stdBillsSearchResult').hide();
+    $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
+    billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
+
     var select = $(this);
     if (this.children.length !== 0) {
-        LoadStdBills(select.val());
+        billsLibObj.loadStdBills(select.val());
     }
 });
 
+// 关闭搜索结果
 $('#closeSearchStdBills').click(function () {
     $('#stdBillsSearchResult').hide();
     $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
+    billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
 });

+ 6 - 6
web/building_saas/main/js/views/sub_view.js

@@ -33,7 +33,7 @@ SheetDataHelper.protectdSheet(subSpread.getSheet(3));
 
 
 $("#linkGLJ").click(function(){
-    $("#tzjnrCon").hide();//控制显示subSpread,隐藏特征及内容spread
+    $("#subItems").children().hide();//控制显示subSpread,隐藏特征及内容spread
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -45,7 +45,7 @@ $("#linkGLJ").click(function(){
 });
 
 $("#linkFZDE").click(function(){
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -55,7 +55,7 @@ $("#linkFZDE").click(function(){
   //  subSpread.getActiveSheet().setValue(0, 0, "辅助定额");
 });
 $("#linkFZTJ").click(function(){
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -66,7 +66,7 @@ $("#linkFZTJ").click(function(){
 });
 
 $("#linkGCLMX").click(function(){
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -78,7 +78,7 @@ $("#linkGCLMX").click(function(){
 });
 
 $("#linkJSCX").click(function(){        // 计算程序
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -95,7 +95,7 @@ $("#linkJSCX").click(function(){        // 计算程序
 
 //特征及内容
 $("#linkTZJNR").click(function () {
-    $("#subSpread").hide();
+    $("#subItems").children().hide();
     $("#tzjnrCon").show();
     pageCCOprObj.active = true;
     refreshSubSpread();