Ver código fonte

定额工料机底色

zhongzewei 6 anos atrás
pai
commit
85626667c3

+ 25 - 5
web/building_saas/main/js/views/glj_view.js

@@ -108,9 +108,21 @@ var gljOprObj = {
             gljContextMenu.loadGLJSpreadContextMenu();
         }
         sheet.bind(GC.Spread.Sheets.Events.SelectionChanged,function (sender,args) {
-            args.sheet.repaint();
+            let selected = args.newSelections[0] ? args.newSelections[0] : {row: 0, col: 0};
+            me.sheetInitSelection(selected);
         });
     },
+    sheetInitSelection: function (selected) {
+        let me = gljOprObj;
+        if(selected.row < me.sheetData.length){
+            me.sheet.setStyle(selected.row, -1, me.getSelStyle(true));
+        }
+        me.sheet.repaint();
+        if(me.preGljSelection && me.preGljSelection.row !== selected.row){
+            me.sheet.setStyle(me.preGljSelection.row, -1, me.getSelStyle(false));
+        }
+        me.preGljSelection = selected;
+    },
     initDetailSheet: function (sheet) {
         var me = this;
         me.detailSheet = sheet;
@@ -254,10 +266,10 @@ var gljOprObj = {
         if(sel){
             me.gljLibSheet.setStyle(sel.row, -1, me.getSelStyle(true));
         }
-        if(me.preSelection){
-            me.gljLibSheet.setStyle(me.preSelection.row, -1, me.getSelStyle(false));
+        if(me.preGljLibSelection && me.preGljLibSelection.row !== sel.row){
+            me.gljLibSheet.setStyle(me.preGljLibSelection.row, -1, me.getSelStyle(false));
         }
-        me.preSelection = sel;
+        me.preGljLibSelection = sel;
     },
     onButtonClick: function (sender, args) {
         if(args.sheet.isEditing()){
@@ -423,6 +435,8 @@ var gljOprObj = {
     },
     showDataIfRationSelect: function (node,selectedNodeId) {
         var isShow = false;
+        //恢复底色
+        this.sheet.setStyle(this.sheet.getActiveRowIndex(), -1, this.getSelStyle(false));
         if(projectReadOnly && this.setting.view.lockColumns){
             this.setting.view.lockColumns = null;
         }
@@ -491,7 +505,9 @@ var gljOprObj = {
         this.sheetData = sortRationGLJ(this.sheetData);
         this.sheet.getRange(-1, 0, -1, 1).cellType(this.getTreeNodeCellType([]));
         sheetCommonObj.showData(this.sheet, this.setting, this.sheetData);
-
+        //初始选择
+        this.preGljSelection = null;
+        this.sheetInitSelection({row: this.sheet.getActiveRowIndex(), col: 0});
         this.sheet.getRange(-1, 0, -1, this.setting.header.length).locked(true);//锁住定额工料机的所有列
         this.detailSheet.getRange(-1, 0, -1, this.detailSetting.header.length).locked(true);//锁住工程量明细的所有列
     },
@@ -526,6 +542,10 @@ var gljOprObj = {
         }else if(selected){//定位光标到之前的位置
             this.sheet.setSelection(selected[0].row,selected[0].col,selected[0].rowCount,selected[0].colCount);
         }
+        //初始选择
+        this.preGljSelection = null;
+        this.sheetInitSelection({row: this.sheet.getActiveRowIndex(), col: this.sheet.getActiveColumnIndex()});
+
     },
     getUnitPriceCodeMap : function () {//取单价文件中,编码前缀一样的映射表
         let codeMap = {};

+ 1 - 0
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -365,6 +365,7 @@ var gljContextMenu = {
         var target = SheetDataHelper.safeRightClickSelection($trigger, e, subSpread);
         gljContextMenu.selectedRow = target.row;
         gljContextMenu.selectedCol = target.col;
+
         //controller.setTreeSelected(controller.tree.items[target.row]);
         return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
     }