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',
|
templateUrl: './real-time.component.html',
|
})
|
export class RealTimeComponent implements OnInit {
|
|
[x: string]: any;
|
public monitorPointOptions = [];
|
public monitorPoint = 0;
|
|
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'];
|
}
|
});
|
}
|
}
|