From e82d7ca41418b94a9e5d487ac4e3497ccf54e277 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Wed, 09 May 2018 14:05:26 +0800
Subject: [PATCH] 三级警报优化

---
 src/app/routes/dashboard/workplace/workplace.component.ts |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/app/routes/dashboard/workplace/workplace.component.ts b/src/app/routes/dashboard/workplace/workplace.component.ts
index a208c4e..d8d79af 100644
--- a/src/app/routes/dashboard/workplace/workplace.component.ts
+++ b/src/app/routes/dashboard/workplace/workplace.component.ts
@@ -35,6 +35,12 @@
     radarData: any[] = [];
     loading = true;
     public alarmData: any = {};
+    public alarmDatas = [
+        { title: '������', color: 'purple', data: [] },
+        { title: '������', color: 'yellow', data: [] },
+        { title: '������', color: 'orange', data: [] },
+        { title: '������', color: 'red', data: [] }
+    ];
     public alertData = [[], [], [], []];
     salesType = '0';
     salesTotal = 0;
@@ -84,13 +90,13 @@
 
     selectedIndexChange(index) {
         this.rankingListData = [];
-        if (!this.alarmData['_' + index]) {
+        if (this.alarmDatas[index].data.length < 1) {
             this.http2.get(environment.SERVER_BASH_URL + 'report/alarm-year', { params: { state: index > 0 ? index : null } }).subscribe((res: any) => {
                 const data = [];
                 for (let i = 0; i < res.data.length; i += 1) {
                     data.push({ x: `${i + 1}���`, y: !!res.data[i] ? res.data[i] : 0 });
                 }
-                this.alarmData['_' + index] = data;
+                this.alarmDatas[index].data = data;
             });
         }
         if (this.alertData[index].length > 0) {

--
Gitblit v1.8.0