From 5ad15d5e999b91da4afcc358063f80f95eb66ed9 Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Tue, 13 Mar 2018 16:03:09 +0800
Subject: [PATCH] 工作台数据统计页面

---
 src/app/routes/dashboard/workplace/workplace.component.ts |  166 ++++++++++++-------------------------------------------
 1 files changed, 37 insertions(+), 129 deletions(-)

diff --git a/src/app/routes/dashboard/workplace/workplace.component.ts b/src/app/routes/dashboard/workplace/workplace.component.ts
index d7e7561..6c5442a 100644
--- a/src/app/routes/dashboard/workplace/workplace.component.ts
+++ b/src/app/routes/dashboard/workplace/workplace.component.ts
@@ -86,15 +86,26 @@
         this.avgDeviceCount = (this.totalDeviceCount/12).toFixed(0);
 
         const alarmData = [];
+        const alarmData_1 = [];
+        const alarmData_2 = [];
+        const alarmData_3 = [];
         for (let i = 0; i < 12; i += 1) {
-            alarmData.push({
-                x: `${i + 1}���`,
-                y: Math.floor(Math.random() * 1000) + 200
-            });
+            alarmData.push({ x: `${i + 1}���`, y: Math.floor(Math.random() * 1000) + 500 });
+            alarmData_1.push({ x: `${i + 1}���`, y: Math.floor(Math.random() * 1000) + 100 });
+            alarmData_2.push({ x: `${i + 1}���`, y: Math.floor(Math.random() * 1000) + 200 });
+            alarmData_3.push({ x: `${i + 1}���`, y: Math.floor(Math.random() * 1000) + 300 });
         }
 
-
-
+        const alertData = [];
+        const alertData_1 = [];
+        const alertData_2 = [];
+        const alertData_3 = [];
+        for (let i = 0; i < 7; i += 1) {
+            alertData.push({ x: this.rankingListData[i].title, y: Math.floor(Math.random() * 1000) + 500 });
+            alertData_1.push({ x: this.rankingListData[i].title, y: Math.floor(Math.random() * 1000) + 100 });
+            alertData_2.push({ x: this.rankingListData[i].title, y: Math.floor(Math.random() * 1000) + 200 });
+            alertData_3.push({ x: this.rankingListData[i].title, y: Math.floor(Math.random() * 1000) + 300 });
+        }
 
         const visitData = [];
         const beginDay = new Date().getTime();
@@ -116,100 +127,6 @@
                     "YYYY-MM-DD"
                 ),
                 y: fakeY2[i]
-            });
-        }
-
-
-        const salesTypeData = [
-            {
-                x: "������������",
-                y: 4544
-            },
-            {
-                x: "������������",
-                y: 3321
-            },
-            {
-                x: "������������",
-                y: 3113
-            },
-            {
-                x: "������������",
-                y: 2341
-            },
-            {
-                x: "������������",
-                y: 1231
-            },
-            {
-                x: "������",
-                y: 1231
-            }
-        ];
-
-        const salesTypeDataOnline = [
-            {
-                x: "������������",
-                y: 244
-            },
-            {
-                x: "������������",
-                y: 321
-            },
-            {
-                x: "������������",
-                y: 311
-            },
-            {
-                x: "������������",
-                y: 41
-            },
-            {
-                x: "������������",
-                y: 121
-            },
-            {
-                x: '������',
-                y: 111
-            }
-        ];
-
-        const salesTypeDataOffline = [
-            {
-                x: '������������',
-                y: 99
-            },
-            {
-                x: '������������',
-                y: 188
-            },
-            {
-                x: '������������',
-                y: 344
-            },
-            {
-                x: '������������',
-                y: 255
-            },
-            {
-                x: '������',
-                y: 65
-            }
-        ];
-
-        const offlineData = [];
-        for (let i = 0; i < 10; i += 1) {
-            offlineData.push({
-                name: `������${i}`,
-                cvr: Math.ceil(Math.random() * 9) / 10
-            });
-        }
-        const offlineChartData = [];
-        for (let i = 0; i < 20; i += 1) {
-            offlineChartData.push({
-                x: new Date().getTime() + 1000 * 60 * 30 * i,
-                y1: Math.floor(Math.random() * 100) + 10,
-                y2: Math.floor(Math.random() * 100) + 10
             });
         }
 
@@ -271,38 +188,28 @@
         }
         var res = {
             alarmData: alarmData,
+            alarmData_1: alarmData_1,
+            alarmData_2: alarmData_2,
+            alarmData_3: alarmData_3,
+
+            alertData: alertData,
+            alertData_1: alertData_1,
+            alertData_2: alertData_2,
+            alertData_3: alertData_3,
 
             visitData: visitData,
             visitData2: visitData2,
-            salesTypeData: salesTypeData,
-            salesTypeDataOnline: salesTypeDataOnline,
-            salesTypeDataOffline: salesTypeDataOffline,
-            offlineData: offlineData,
-            offlineChartData: offlineChartData,
+
             radarOriginData: radarOriginData,
             radarData: radarData,
             searchData: searchData
         };
 
-        res.offlineData.forEach((item: any) => {
-            item.chart = Object.assign([], res.offlineChartData);
-        });
         this.data = res;
         this.loading = false;
         this.changeSaleType();
 
         this.radarData = res.radarData;
-
-        const titles = [
-            'Alipay',
-            'Angular',
-            'Ant Design',
-            'Ant Design Pro',
-            'Bootstrap',
-            'React',
-            'Vue',
-            'Webpack'
-        ];
 
         const avatars = [
             'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png', // Alipay
@@ -454,22 +361,23 @@
         ];
     }
 
-    salesType = 'all';
+    salesType = '0';
     salesPieData: any;
     salesTotal = 0;
     changeSaleType() {
-        this.salesPieData = this.salesType === 'all' ? this.data.salesTypeData : (
-            this.salesType === 'online' ? this.data.salesTypeDataOnline : this.data.salesTypeDataOffline
-        );
+        if(this.salesType == '0') {
+            this.salesPieData = this.data.alertData;
+        } else if(this.salesType == '1') {
+            this.salesPieData = this.data.alertData_1;
+        } else if(this.salesType == '2') {
+            this.salesPieData = this.data.alertData_2;
+        } else if(this.salesType == '3') {
+            this.salesPieData = this.data.alertData_3;
+        }
         if (this.salesPieData) this.salesTotal = this.salesPieData.reduce((pre, now) => now.y + pre, 0);
     }
 
     handlePieValueFormat(value: any) {
-        return yuan(value);
-    }
-
-    _activeTab = 0;
-    _tabChange(value: any) {
-        console.log('tab', this._activeTab, value);
+        return value + "���";
     }
 }

--
Gitblit v1.8.0