Commit 6b5a25a0 authored by van.chen's avatar van.chen

首页报警数据

parent 6995bbe6
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
<Icon [type]="'voice'" class="alarmLeftIcon"></Icon> <Icon [type]="'voice'" class="alarmLeftIcon"></Icon>
<div class="alarmShows"> <div class="alarmShows">
<div class="alarmItem" *ngFor="let one of options;let i = index" <div class="alarmItem" *ngFor="let one of options;let i = index"
[ngClass]="{'active' : active === i, 'unActive': active !== i}">{{one.a}} [ngClass]="{'active' : active === i, 'unActive': active !== i}">
<div class="alarmTime">{{one.time | date: 'yyyy-MM-dd HH:mm:ss'}}</div> {{one.fieldRegionName}}{{one.parameter}} : {{one.description}}
<div class="alarmTime">{{one.alarmTime | date: 'yyyy-MM-dd HH:mm:ss'}}</div>
</div> </div>
</div> </div>
</div> </div>
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Api} from '../../service/api';
@Component({ @Component({
selector: 'v-alarm-bar', selector: 'v-alarm-bar',
...@@ -7,14 +8,10 @@ import {Component, OnInit} from '@angular/core'; ...@@ -7,14 +8,10 @@ import {Component, OnInit} from '@angular/core';
}) })
export class AlarmBarComponent implements OnInit { export class AlarmBarComponent implements OnInit {
options = [ options = [];
{a: '西中转池搅拌开关 01数据异常', time: 1559809667000},
{a: '西中转池搅拌开关 01数据异常', time: 1559809667000},
{a: '西中转池搅拌开关 01数据异常', time: 1559809667000}
];
active = 0; active = 0;
constructor() { constructor(private api: Api) {
this.changeAlarm(); this.changeAlarm();
} }
...@@ -30,6 +27,15 @@ export class AlarmBarComponent implements OnInit { ...@@ -30,6 +27,15 @@ export class AlarmBarComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.getData();
}
getData() {
this.api.alarm.getLatestAlarm(['', (data) => {
if (data.constructor === Array) {
this.options = data;
}
}]);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment