From ba6f868ccc79328594f42d85ea34ca254e5d51d8 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Sat, 24 Mar 2018 23:05:43 +0800
Subject: [PATCH] grid 冻结 功能 延迟bug修复

---
 src/app/routes/analysis/query/query.component.ts |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/app/routes/analysis/query/query.component.ts b/src/app/routes/analysis/query/query.component.ts
index 403f705..ec9e65e 100644
--- a/src/app/routes/analysis/query/query.component.ts
+++ b/src/app/routes/analysis/query/query.component.ts
@@ -33,12 +33,12 @@
         e16: 6
     };
     public tableWidth = 2800;
-    private tableWidthOption = {
-        'MONTH': 1400,
-        'DAY': 2800,
-        'HOUR': 2100,
-        'MINUTE': 5000
-    };
+    // private tableWidthOption = {
+    //     'MONTH': 1400,
+    //     'DAY': 2800,
+    //     'HOUR': 2100,
+    //     'MINUTE': 5000
+    // };
     public expandForm: boolean; // ��������� ������������
     // public sensors: any[] = [];
     public sensorOptions: any[] = [];    
@@ -64,7 +64,7 @@
     public  grid: Grid<{sensor: Sensor, data: string [], weight?: number}> = new Grid();
     // public grid.data: {sensor: Sensor, data: string [], weight?: number} [] = [];
     //  ������������������������������������������
-    public sensorNameScrollLeft = '0px';
+    public sensorNameScrollLeft = 0;
      @ViewChild(NzTreeComponent)  private tree: NzTreeComponent;
      private _timeType: {showTime: boolean|{[key: string]: Function|boolean}, mode:  'month' | 'day', dateFormat: string  } = {showTime: false, mode: 'day', dateFormat: 'YYYY���MM���DD���'};
      // ���key-value������,������������������
@@ -381,14 +381,12 @@
             return ;
         }
        this.grid.loading = true;
-       this.sensorNameScrollLeft = '0px';
+       this.sensorNameScrollLeft = 0;
        this.grid.data = [];
        const start: Date = this.getPeriodDate(this.actualTime , 'start');
        const end: Date = this.getPeriodDate(this.actualTime , 'end');
        this.dataCondition['actualTime'] = null;
        this.dataCondition['timeUnits'] = this.timeUnit.value;
-       // ���������������������������������
-       this.tableWidth = this.tableWidthOption[this.timeUnit.value];
        // ���������������
        const mptValue: number = !!this._monitorPoint ? this._monitorPoint.id : null;
        const devValue: number = !!this._device ? this._device.id : null;
@@ -445,8 +443,12 @@
                 return {text: item};
             }
           ); break;
-      }      
+      }   
+        // ���������������������������������
+        this.tableWidth =  this.grid.columns.length * 80 + 160;   
       this.reloadChart();
+      // ������������
+      this.grid.data = [];
       this.http.post(environment.SERVER_BASH_URL + '/report/line-chart', lineChartCriteria).subscribe(
         (res: ResultBean<{[key: string]: Array<Array<PairData>>}>) => {
            if (res.code === 1) {
@@ -469,7 +471,8 @@
                                     // pair.value ���null,������������
                                     weight = !!pair.value ? weight : weight + 1;
                                 }
-                                return !!pair.value ? String(Math.round(pair.value)) : '-';
+                                // ���������������������2���
+                                return !!pair.value ? String(Math.round(pair.value * 100) / 100) : '-';
                            }
                        );
                        this.grid.data.push({sensor: sensor, data: sensorData, weight: weight});
@@ -484,7 +487,7 @@
       );
         $('.ant-table-body').scroll(
             () => {
-                this.sensorNameScrollLeft =  $('.ant-table-body').scrollLeft() + 'px';
+                this.sensorNameScrollLeft =  $('.ant-table-body').scrollLeft();
             }
         );
     }
@@ -622,7 +625,13 @@
         }
         return mo.toDate();
     }
-
+    public sensorTableFocusIndex = -1;
+    public sensorTableFocus(index) {
+        this.sensorTableFocusIndex = index;
+    }
+    public sensorTableBlur(index) {
+        this.sensorTableFocusIndex = -1;
+    }
 }
 
 

--
Gitblit v1.8.0