Commit 2ea83299 authored by yating.lin's avatar yating.lin

修改告警页 告警详情页

parent 6c74cf51
......@@ -7,9 +7,7 @@
<ion-title class="appTitle">{{fieldRegionName}}告警详情</ion-title>
</ion-toolbar>
</ion-header>
<ion-content color="light" style="background-color: #F3F4F4;">
<div>
<ion-segment scrollable style="position: sticky; margin-top:10px;" color="secondary" (click)="segmentChanged($event)">
<ion-segment-button value="trouble" [checked]="isTroubleDis">
<ion-label>故障</ion-label>
......@@ -58,6 +56,11 @@
</div>
</div>
</ion-item>
</div>
</ion-header>
<ion-content color="light" style="background-color: #F3F4F4;" scroll="false">
<div style="padding:5px;">
<div class="detailContent">
......@@ -95,7 +98,7 @@
</div>
<!--<ion-list id="troubleList"></ion-list>-->
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)">
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)" id="infiniteScroll">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="加载中...">
......
......@@ -21,7 +21,7 @@ export class EnvAlarmDetailPage implements OnInit {
detailInfo: any = {};
troubleList = [];
// detailInfoLength = 0;
detailInfoLength = 0;
disposeState = '';
fieldDeviceType = '';
startTime = null;
......@@ -127,8 +127,8 @@ export class EnvAlarmDetailPage implements OnInit {
if (isInit) {
this.detailInfo = data;
}
this.detailInfoLength = data.devErrTotal;
this.appendItems(data.trouble, data.devErrTotal);
// this.detailInfoLength = data.trouble.length;
}]);
}
}
......@@ -159,8 +159,8 @@ export class EnvAlarmDetailPage implements OnInit {
if (isInit) {
this.detailInfo = data;
}
this.detailInfoLength = data.alarmTotal;
this.appendItems(data.trouble, data.alarmTotal);
// this.detailInfoLength = data.trouble.length;
}]);
}
}
......@@ -176,33 +176,39 @@ export class EnvAlarmDetailPage implements OnInit {
}
// this.infiniteScroll.disabled = false;
this.page = this.page + 1;
console.log(this.infiniteScroll.disabled);
} else {
document.getElementById('infiniteScroll').setAttribute('disabled', 'disabled');
// this.infiniteScroll.disabled = true;
}
}
loadData(event) {
setTimeout(() => {
async loadData(event) {
setTimeout(async () => {
console.log('loadData Done');
this.getTroubleList(false);
this.getAlarmList(false);
event.target.complete();
// App logic to determine if all data is loaded
// and disable the infinite scroll
// if (data.length == 1000) {
// event.target.disabled = true;
// }
}, 500);
await this.wait(1000);
if (this.troubleList.length === this.detailInfoLength) {
event.target.disabled = true;
}
}, 1000);
}
segmentChanged(ev: any) {
console.log('segment changed');
console.log(this.infiniteScroll.disabled);
this.page = 1;
this.disposeState = '';
this.fieldDeviceType = '';
this.detailInfo = {};
this.troubleList = [];
this.infiniteScroll.disabled = false;
console.log(this.infiniteScroll.disabled);
document.getElementById('infiniteScroll').removeAttribute('disabled');
if (ev.target.value === 'alarm') {
this.displayArea = 'alarm';
this.getAlarmList(true);
......
......@@ -5,7 +5,9 @@
</ion-header>
<ion-content color="light">
<ion-refresher slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content></ion-refresher-content>
</ion-refresher>
<ion-card *ngFor="let item of alarmItems" style="margin-top:10px; margin-bottom:0px;">
<ion-card-header style="padding-top: 3px; padding-bottom: 3px;">
<ion-card-title style="display: inline-block" style="width:100%">
......@@ -16,7 +18,7 @@
<span class="alarmNum">{{item.total}}</span>
</div>
<div style="width: 30%; padding-right: 5px; display: inline-block; font-size: 13px; color:#61C7CC">
<ion-select interface="popover" placeholder="" [(ngModel)]="curInterval" (ionChange)="dismissPopover(curInterval, item)">
<ion-select interface="popover" placeholder="" style="padding: 0px;" [(ngModel)]="item.interval" (ionChange)="dismissPopover(item)">
<ion-select-option value="12" class="popLabel">近一年</ion-select-option>
<ion-select-option value="6" class="popLabel">近六个月</ion-select-option>
<ion-select-option value="3" class="popLabel">近三个月</ion-select-option>
......
......@@ -69,6 +69,7 @@ export class EnvAlarmPage implements OnInit {
if (data.total > 0) {
if (data.rows && data.rows.constructor === Array) {
this.alarmItems = data.rows;
this.alarmItems.forEach(item => (item.interval = this.curInterval));
}
}
}]);
......@@ -113,12 +114,12 @@ export class EnvAlarmPage implements OnInit {
// });
// }
dismissPopover(interval, fieldRegionInfo) {
this.curFieldRegion = fieldRegionInfo;
dismissPopover(one) { // interval, fieldRegionInfo
this.curFieldRegion = one;
this.load.toLoad('加载中...', false);
const condition = {
fieldRegionNo: this.curFieldRegion.fieldRegionNo,
startTime: this.getStartTime(interval).valueOf(),
startTime: this.getStartTime(one.interval).valueOf(),
stopTime: new Date().valueOf()
};
......@@ -159,4 +160,11 @@ export class EnvAlarmPage implements OnInit {
}
document.getElementById(this.curFieldRegion.fieldRegionNo).innerText = displayValue;
}
doRefresh(event) {
setTimeout(() => {
this.init();
event.target.complete();
}, 3000);
}
}
......@@ -144,7 +144,7 @@ export class EnvDetailPage implements OnInit {
}
getInHouseState(state) {
let stateName = '';
let stateName = '离舍';
switch (state) {
case 0:
stateName = '离舍';
......
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