From 4c99ab95e0449348d938ec0ceb949bceafb0cfda Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 03 Aug 2018 16:56:33 +0800
Subject: [PATCH] 设备数据和 地图相关

---
 src/app/routes/operation/device-data/device-data.component.ts |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/src/app/routes/operation/device-data/device-data.component.ts b/src/app/routes/operation/device-data/device-data.component.ts
index d7c588a..a0a9356 100644
--- a/src/app/routes/operation/device-data/device-data.component.ts
+++ b/src/app/routes/operation/device-data/device-data.component.ts
@@ -1,6 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { NzMessageService } from 'ng-zorro-antd';
 import { _HttpClient } from '@delon/theme';
+import * as moment from "moment";
 import { DeviceControllerService } from '../device-controller/device-controller.service';
 
 @Component({
@@ -13,6 +14,7 @@
         advancedOperation2: [],
         advancedOperation3: []
     };
+    public selectedIndex = 0;
     public get deviceData() {
         return this.deviceControllerService.data;
     }
@@ -49,7 +51,55 @@
     public toDeviceStatus() {
         this.deviceControllerService.incumbent = 'status';
     }
-    
+    /**
+     * getTableList
+     */
+    public historys = [
+        {"CO": "1.1", "O3": "10.0", "AQI": "170.0", "NO2": "76.0", "SO2": "13.0", "PM10": "187.0", "city": "���������", "PM2_5": "129.0", "level": "4", "quality": "������������", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "1.3", "O3": "3.0", "AQI": "169.0", "NO2": "77.0", "SO2": "18.0", "PM10": "185.0", "city": "���������", "PM2_5": "128.0", "level": "4", "quality": "������������", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "1.5", "O3": "3.0", "AQI": "156.0", "NO2": "79.0", "SO2": "19.0", "PM10": "178.0", "city": "���������", "PM2_5": "119.0", "level": "4", "quality": "������������", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "1.1", "O3": "6.0", "AQI": "100.0", "NO2": "64.0", "SO2": "11.0", "PM10": "112.0", "city": "���������", "PM2_5": "75.0", "level": "2", "quality": "���", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "1.2", "O3": "4.0", "AQI": "77.0", "NO2": "72.0", "SO2": "14.0", "PM10": "97.0", "city": "���������", "PM2_5": "56.0", "level": "2", "quality": "���", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "0.7", "O3": "31.0", "AQI": "70.0", "NO2": "41.0", "SO2": "10.0", "PM10": "77.0", "city": "���������", "PM2_5": "51.0", "level": "2", "quality": "���", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "0.8", "O3": "10.0", "AQI": "50.0", "NO2": "62.0", "SO2": "10.0", "PM10": "44.0", "city": "���������", "PM2_5": "35.0", "level": "1", "quality": "���", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "���"},
+        {"CO": "0.7", "O3": "31.0", "AQI": "70.0", "NO2": "41.0", "SO2": "10.0", "PM10": "77.0", "city": "���������", "PM2_5": "51.0", "level": "2", "quality": "���", "latitude": "30.2111727272727", "city_code": "330100", "longitude": "120.081909090909", "pollutions": "������������(PM2.5)"},
+        {"CO": "1.5", "O3": "70.0", "AQI": "185.0", "NO2": "46.0", "SO2": "12.0", "PM10": "167.0", "city": "���������", "PM2_5": "139.0", "level": "", "quality": "������������", "station": "������������", "latitude": "30.3119", "city_code": "330100", "longitude": "120.12", "pollutions": "������������(PM2.5)", "station_code": "1230A"},
+        {"CO": "1.6", "O3": "24.0", "AQI": "202.0", "NO2": "82.0", "SO2": "10.0", "PM10": "186.0", "city": "���������", "PM2_5": "152.0", "level": "", "quality": "������������", "station": "������������", "latitude": "30.3119", "city_code": "330100", "longitude": "120.12", "pollutions": "������������(PM2.5)", "station_code": "1230A"}
+    ];
+    public getTableList(type) {
+        let index = 1;
+        return this.historys.map(
+            item => {
+                const date = moment().subtract(index,'days').format('YYYY-MM-DD');
+                let content = '';
+                switch (type) {
+                    case 'history':
+                        content = `
+                         CO:${item.CO} ug/m3,   
+                         O3:${item.O3} mg/m3,  
+                         NO2:${item.NO2} mg/m3,  
+                         SO2:${item.SO2} mg/m3,  
+                         PM10:${item.PM10} mg/m3,  
+                         PM2_5:${item.PM2_5} mg/m3
+                        `;
+                        break;
+                    case 'alarm':
+                    content = `${item.quality}`;
+                    break;
+                    case 'violation':
+                    content = `${item.pollutions}`;
+                    break;
+                    default:
+                        break;
+                }
+                index++;
+                return {
+                    date:date,
+                    content:content
+                }
+            }
+        );
+    }
     ngOnInit() {
         this.http.get('/profile/advanced').subscribe((res: any) => this.data = res);
     }

--
Gitblit v1.8.0