xufenglei
2018-08-03 a3913c2a56783ca3b179f82c37b7048e80d55ca2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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);
    }
}