From 0e722c9f6127ea7a41ca08fd36547e421b79edeb Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Wed, 25 Apr 2018 10:26:37 +0800
Subject: [PATCH] 饼图 结论

---
 src/app/routes/reports/alarm/alarm.component.ts |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/app/routes/reports/alarm/alarm.component.ts b/src/app/routes/reports/alarm/alarm.component.ts
index 52bf05e..0a7a2b1 100644
--- a/src/app/routes/reports/alarm/alarm.component.ts
+++ b/src/app/routes/reports/alarm/alarm.component.ts
@@ -1,12 +1,13 @@
-import {DateService} from "../../../business/services/util/date.service";
-import {HttpClient} from "@angular/common/http";
+import {DateService} from '../../../business/services/util/date.service';
+import {HttpClient} from '@angular/common/http';
 import {Component, OnInit} from '@angular/core';
 import {_HttpClient} from '@delon/theme';
-import {Subject} from "rxjs";
+// tslint:disable-next-line:import-blacklist
+import {Subject} from 'rxjs';
 import {CascaderOption} from 'ng-zorro-antd/src/cascader/nz-cascader.component';
 import {AreacodeService} from '@business/services/http/areacode.service';
 import {NzTreeComponent} from 'ng-tree-antd';
-import {NzMessageService} from "ng-zorro-antd";
+import {NzMessageService} from 'ng-zorro-antd';
 import {environment} from '../../../../environments/environment';
 import * as echarts from 'echarts';
 import * as $ from 'jquery';
@@ -44,7 +45,7 @@
     {value: 'sensor', label: '������'},
     {value: 'monitorPoint', label: '���������'}
   ];
-  isDisable: boolean = false;
+  isDisable = false;
   private treeClickStream: Subject<any> = new Subject<any>();
   private _sensors: {[key: string]: string} = {};
   private _sensorNames: string;
@@ -59,7 +60,7 @@
     },
     tooltip: {
       trigger: 'item',
-      formatter: "{a} <br/>{b}: {c} ({d}%)"
+      formatter: '{a} <br/>{b}: {c} ({d}%)'
     },
     //    legend: {
     //      //x : 'center',
@@ -74,7 +75,7 @@
     radius: ['20%', '40%'],
     label: {
       normal: {
-        formatter: "{b}:{d}%"
+        formatter: '{b}:{d}%'
       }
     },
     labelLine: {
@@ -83,7 +84,7 @@
       }
     },
     data: []
-  }
+  };
 
   ngOnInit() {
     this.http.get(environment.SERVER_BASH_URL + 'sensor/all').subscribe((res: any) => {
@@ -96,9 +97,9 @@
   }
 
   dimensionChange(value) {
-    if (value == 'sensor') {
-      this.isDisable = false;
-    } else {
+    if (value === 'sensor') {
+      this.isDisable = false;
+    } else {
       this.isDisable = true;
       this.query.monitorPointId = null;
       this.query.mac = null;
@@ -226,7 +227,7 @@
       $('#mydiv').empty();
       for (let index = 0; index < 30; index++) {
         this.sensorArr.push(index);
-        $('#mydiv').append("<div id='mydiv" + index + "' style='height: 485.35px; width: 1000px'></div>");
+        $('#mydiv').append('<div id=\'mydiv' + index + '\' style=\'height: 485.35px; width: 1000px\'></div>');
       }
       this.loading = true;
       this.isShow = false;
@@ -245,17 +246,17 @@
       this.http.get(environment.SERVER_BASH_URL + 'report/pie', {params: query}).subscribe((res: any) => {
         const option = this.pieCharOption;
         let index = 0;
-        if (query.dimension == 'monitorPoint') {
+        if (query.dimension === 'monitorPoint') {
           for (const key in res.data) {
             let name: string;
             this.sensorOptions[0].children.forEach(sensor => {
-              if (key == sensor.sensorKey) {
+              if (key === sensor.sensorKey) {
                 name = sensor.name;
               }
             });
             option.title.text = name + '������������������������';
 
-            if (index % 2 == 0) {
+            if (index % 2 === 0) {
               option.backgroundColor = 'rgba(0,0,0,0)';
             } else {
               option.backgroundColor = 'rgba(23,133,23,0.06)';
@@ -270,8 +271,8 @@
             myChart.setOption(option, true);
             window.onresize = myChart.resize;
             index = index + 1;
-          }
-        } else {
+          }
+        } else {
           option.title.text = '������������������������';
           option.series = [];
           this.serie.data = res.data.list;
@@ -281,7 +282,7 @@
           window.onresize = myChart.resize;
           index = index + 1;
 
-          //this.setOption(option,index);
+          // this.setOption(option,index);
         }
 
         this.sensorArr.forEach(i => {
@@ -298,7 +299,7 @@
     }
   }
 
-  setOption(option,index) {
+  setOption(option, index) {
     const myChart = echarts.init(document.getElementById('mydiv' + index));
     myChart.setOption(this.pieCharOption, true);
     window.onresize = myChart.resize;

--
Gitblit v1.8.0