From 309d1f9d649daa08bb9b068af014749f6d4a5bce Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 06 Jul 2018 14:00:45 +0800
Subject: [PATCH] 设备和监控点父页面 筛选条件不予 编辑页面联动
---
src/app/routes/dashboard/workplace/workplace.component.ts | 61 +++++++++++++++---------------
1 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/src/app/routes/dashboard/workplace/workplace.component.ts b/src/app/routes/dashboard/workplace/workplace.component.ts
index a208c4e..a3ede59 100644
--- a/src/app/routes/dashboard/workplace/workplace.component.ts
+++ b/src/app/routes/dashboard/workplace/workplace.component.ts
@@ -20,14 +20,14 @@
})
export class DashboardWorkplaceComponent implements OnInit, OnDestroy {
- totalDeviceCountList: any[] = [];
+ totalDeviceCountList = null;
totalDeviceCount = '';
avgDeviceCount = '';
deviceCountLoading = true;
// ������������
- alarmCountList:{x: string,y: number}[] = null;
+ alarmCountList: {x: string, y: number}[] = null;
alarmCountCurrMonth = '';
- alarmCountCurrDay = '';// ������������������
+ alarmCountCurrDay = ''; // ������������������
alarmCountLoading = true;
operationLoading = true;
operNormalPercent = 0;
@@ -35,6 +35,12 @@
radarData: any[] = [];
loading = true;
public alarmData: any = {};
+ public alarmDatas = [
+ { title: '������', color: 'purple', data: [] },
+ { title: '������', color: 'yellow', data: [] },
+ { title: '������', color: 'orange', data: [] },
+ { title: '������', color: 'red', data: [] }
+ ];
public alertData = [[], [], [], []];
salesType = '0';
salesTotal = 0;
@@ -84,13 +90,13 @@
selectedIndexChange(index) {
this.rankingListData = [];
- if (!this.alarmData['_' + index]) {
+ if (this.alarmDatas[index].data.length < 1) {
this.http2.get(environment.SERVER_BASH_URL + 'report/alarm-year', { params: { state: index > 0 ? index : null } }).subscribe((res: any) => {
const data = [];
for (let i = 0; i < res.data.length; i += 1) {
data.push({ x: `${i + 1}���`, y: !!res.data[i] ? res.data[i] : 0 });
}
- this.alarmData['_' + index] = data;
+ this.alarmDatas[index].data = data;
});
}
if (this.alertData[index].length > 0) {
@@ -154,50 +160,45 @@
// });
// this.totalDeviceCount += fakeDC[i];
// }
- let example1 = new ExampleService();
- let mo = moment();
- example1.or().andGreaterThanOrEqualTo({ name: "createTime", value: mo.format('YYYY-MM-01 00:00:00') });
- let example2 = new ExampleService();
- let example3 = new ExampleService();
- example3.or().andNotEqualTo({name:'state',value:4});
+ const example1 = new ExampleService();
+ const mo = moment();
+ example1.or().andGreaterThanOrEqualTo({ name: 'createTime', value: mo.format('YYYY-MM-01 00:00:00') });
+ const example2 = new ExampleService();
+ const example3 = new ExampleService();
+ example3.or().andNotEqualTo({name: 'state', value: 4});
zip(this.deviceService.countByExample(example1),
this.deviceService.countByExample(example2),
- this.http.get<ResultBean<{time: string,count: number}[]>>('device/count-by-times',{start:mo.format('YYYY-01-01 00:00:00'),end:mo.format('YYYY-12-31 23:59:59')}),
+ this.http.get<ResultBean<{time: string, count: number}[]>>('device/count-by-times', {start: mo.format('YYYY-01-01 00:00:00'), end: mo.format('YYYY-12-31 23:59:59')}),
this.deviceService.countByExample(example3)).subscribe(
- ([rWtihAvg, rWithToltal,rWithList,rWithNormal]) => {
- if (!!rWtihAvg.code && !!rWithToltal&&!!rWithList.code) {
+ ([rWtihAvg, rWithToltal, rWithList, rWithNormal]) => {
+ if (!!rWtihAvg.code && !!rWithToltal && !!rWithList.code) {
this.avgDeviceCount = ToolsService.toThousands(rWtihAvg.data.toString());
this.totalDeviceCount = ToolsService.toThousands(rWithToltal.data.toString());
- rWithList.data.forEach( item =>{
- this.totalDeviceCountList.push(
- {
- x:item.time,
- y:item.count
- }
- );
+ this.totalDeviceCountList = rWithList.data.map(item => {
+ return {x: item.time, y: item.count};
});
- this.operNormalPercent = Math.round(rWithNormal.data/rWithToltal.data*100);
+ this.operNormalPercent = Math.round(rWithNormal.data / rWithToltal.data * 100);
this.deviceCountLoading = false;
this.operationLoading = false;
}
}
);
zip(
- this.http.get<ResultBean<{time: string,count: number}[]>>("alarm/count-by-times",{start: mo.format('YYYY-MM-01 00:00:00'),end: null,timeUnits: TimeUnits.DAY}),
- this.http.get<ResultBean<{time: string,count: number}[]>>("alarm/count-by-times",{start: mo.format('YYYY-MM-01 00:00:00'),end: null}),
- this.http.get<ResultBean<{time: string,count: number}[]>>("alarm/count-by-times",{start: mo.format('YYYY-MM-DD 00:00:00'),end: null})
+ this.http.get<ResultBean<{time: string, count: number}[]>>('alarm/count-by-times', {start: mo.format('YYYY-MM-01 00:00:00'), end: null, timeUnits: TimeUnits.DAY}),
+ this.http.get<ResultBean<{time: string, count: number}[]>>('alarm/count-by-times', {start: mo.format('YYYY-MM-01 00:00:00'), end: null}),
+ this.http.get<ResultBean<{time: string, count: number}[]>>('alarm/count-by-times', {start: mo.format('YYYY-MM-DD 00:00:00'), end: null})
).subscribe(
- ([rWithList,rWithMonth,rWithDay]) => {
- if(!!rWithList.code&&!!rWithMonth.code&&!!rWithDay.code){
+ ([rWithList, rWithMonth, rWithDay]) => {
+ if (!!rWithList.code && !!rWithMonth.code && !!rWithDay.code) {
this.alarmCountList = rWithList.data.map(
item => {
- return {x:item.time,y:item.count};
+ return {x: item.time, y: item.count};
}
);
- if(!!rWithMonth.data&&rWithMonth.data.length>0){
+ if (!!rWithMonth.data && rWithMonth.data.length > 0) {
this.alarmCountCurrMonth = ToolsService.toThousands(rWithMonth.data[0].count.toString());
}
- if(!!rWithDay.data&&rWithDay.data.length>0) {
+ if (!!rWithDay.data && rWithDay.data.length > 0) {
this.alarmCountCurrDay = ToolsService.toThousands(rWithDay.data[0].count.toString());
}
this.alarmCountLoading = false;
--
Gitblit v1.8.0