From 6a1dd6c9193efa942a4312785b4457397c23b61e Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 23 Mar 2018 16:38:05 +0800
Subject: [PATCH] 编译不通过 bug 修复

---
 src/app/routes/analysis/query/query.component.ts |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/app/routes/analysis/query/query.component.ts b/src/app/routes/analysis/query/query.component.ts
index 3f41f21..403f705 100644
--- a/src/app/routes/analysis/query/query.component.ts
+++ b/src/app/routes/analysis/query/query.component.ts
@@ -79,6 +79,7 @@
      public toggleChartCollapse() {
           // ���������������
          if (this.isChartCollapse && !!this.echartsIntance) {
+            this.reloadChart();
             this.switchSensor(this.chartSelectedIndex);
             // this.chartLoading = false;
          }        
@@ -320,8 +321,7 @@
             }
         );
     }
-    public setTimeUnit(val: {label: string, value: TimeUnits} ) {
-        this.tableWidth = this.tableWidthOption[val.value];
+    public setTimeUnit(val: {label: string, value: TimeUnits} ) {       
         switch (val.value) {
             // YYYY-MM-DD HH:mm:ss
             case TimeUnits.MONTH:
@@ -387,6 +387,8 @@
        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;
@@ -548,6 +550,8 @@
     public get sensorUnit() {
         return this.grid.data[this.chartSelectedIndex].sensor.unit;
     }
+    // ������������������ ������������
+    public _chartTitleTemp: string;
     public get chartTitle(): string {
         const names = ['������', '������', '������', '������'];
         switch ( this.dataCondition.areaRange ) {
@@ -563,12 +567,15 @@
             break;
         }
         names[2] = moment(this.actualTime).format(this._timeType.dateFormat);
-        names[3] = this.grid.data[this.chartSelectedIndex].sensor.name;
+        if ( this.grid.data.length > this.chartSelectedIndex) {
+            names[3] = this.grid.data[this.chartSelectedIndex].sensor.name;
+        }        
         return names.join('  ') + '  ������';
     }
     public switchSensor(index: number): void {
         this.chartSelectedIndex = index;
         this.chartLoading = true; 
+        this._chartTitleTemp = this.chartTitle;
         setTimeout(() => {
             const series = [{type: 'line', data: this.grid.data[index].data}];
             this.echartsIntance.setOption({

--
Gitblit v1.8.0