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

修改告警页 告警详情页

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