From e97df5aa8edc8e2737d5cb0dab4314871cd3bf71 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Thu, 02 Aug 2018 08:55:06 +0800
Subject: [PATCH] 扬尘监控-实时监控和警告
---
src/app/routes/raise-dust/real-time/real-time.component.ts | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/src/app/routes/raise-dust/real-time/real-time.component.ts b/src/app/routes/raise-dust/real-time/real-time.component.ts
index bf43ace..6d48880 100644
--- a/src/app/routes/raise-dust/real-time/real-time.component.ts
+++ b/src/app/routes/raise-dust/real-time/real-time.component.ts
@@ -1,5 +1,7 @@
-import { Component, OnInit } from '@angular/core';
-import { _HttpClient } from '@delon/theme';
+import {environment} from '../../../../environments/environment';
+import {Component, OnInit} from '@angular/core';
+import {HttpClient} from '@angular/common/http';
+import {zip} from 'rxjs/observable/zip';
@Component({
selector: 'app-real-time',
@@ -7,11 +9,34 @@
})
export class RealTimeComponent implements OnInit {
- constructor(
- private http: _HttpClient
- ) { }
+ public monitorPointOptions = [];
+ public avgs = {};
+ public levels = [35, 115, 200];
+ public devices = [];
+ constructor(
+ private http: HttpClient
+ ) {}
- ngOnInit() {
- }
+ ngOnInit() {
+ this.http.get(environment.SERVER_BASH_URL + 'monitor-point/list/region', {params: {name: 'areaCode', value: '320583'}}).subscribe((res: any) => {
+ this.monitorPointOptions = res.data;
+ });
+ }
+ monitorPointChange(id) {
+ this.avgs = {};
+ this.devices = [];
+ zip(
+ this.http.get(environment.SERVER_BASH_URL + 'demo/avg', {params: {monitorPointId: id}}),
+ this.http.get(environment.SERVER_BASH_URL + 'device/professionId', {params: {monitorPointId: id}})
+ ).subscribe(
+ ([avgs, devices]) => {
+ if (!!avgs) {
+ this.avgs = avgs;
+ }
+ if (!!devices['data']) {
+ this.devices = devices['data'];
+ }
+ });
+ }
}
--
Gitblit v1.8.0