import { Component, OnInit } from '@angular/core';
|
import { NzMessageService } from 'ng-zorro-antd';
|
import { _HttpClient } from '@delon/theme';
|
import { DeviceControllerService } from '../device-controller/device-controller.service';
|
|
@Component({
|
selector: 'app-device-data',
|
templateUrl: './device-data.component.html'
|
})
|
export class DeviceDataComponent implements OnInit {
|
data = {
|
advancedOperation1: [],
|
advancedOperation2: [],
|
advancedOperation3: []
|
};
|
public get deviceData() {
|
return this.deviceControllerService.data;
|
}
|
public get deviceStatusName() {
|
if(!!this.deviceControllerService
|
&&this.deviceControllerService.data
|
&&this.deviceControllerService.data.state) {
|
switch (this.deviceControllerService.data.state) {
|
case "0":
|
return '正常';
|
case "1":
|
return '轻度';
|
case "2":
|
return '中度';
|
case "3":
|
return '严重';
|
default:
|
return '离线';
|
}
|
}else {
|
return '离线';
|
}
|
}
|
constructor(
|
public msg: NzMessageService,
|
private http: _HttpClient,
|
private deviceControllerService:DeviceControllerService,
|
) {
|
}
|
/**
|
* 返回设备列表页面
|
* toDeviceStatus
|
*/
|
public toDeviceStatus() {
|
this.deviceControllerService.incumbent = 'status';
|
}
|
|
ngOnInit() {
|
this.http.get('/profile/advanced').subscribe((res: any) => this.data = res);
|
}
|
}
|