From bc6b17d35a318b36349da43ea4edff552ec550fe Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei> Date: Fri, 03 Aug 2018 09:10:29 +0800 Subject: [PATCH] update --- src/app/routes/raise-dust/real-time/real-time.component.ts | 42 +++++++++++++++++++++++++++++++++++------- 1 files changed, 35 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..8e817a7 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,37 @@ }) export class RealTimeComponent implements OnInit { - constructor( - private http: _HttpClient - ) { } + [x: string]: any; + public monitorPointOptions = []; + public monitorPoint = 0; - ngOnInit() { - } + public avgs = {e1: '', e2: '', e3: '', e13: ''}; + public levels = [35, 115, 200]; + public devices = []; + constructor( + private http: HttpClient + ) {} + 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 = {e1: '', e2: '', e3: '', e13: ''}; + 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 = <any>avgs; + } + if (!!devices['data']) { + this.devices = devices['data']; + } + }); + } } -- Gitblit v1.8.0