From f1f78b9bae93fe9a07cc3ebdc743eb71ac78c29e Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Mon, 28 May 2018 11:49:02 +0800
Subject: [PATCH] Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop
---
src/app/routes/reports/demo/demo.component.ts | 61 ++++++++++++------------------
1 files changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts
index ee873aa..50cbc76 100644
--- a/src/app/routes/reports/demo/demo.component.ts
+++ b/src/app/routes/reports/demo/demo.component.ts
@@ -82,10 +82,10 @@
}
dimensionChange(value) {
- this.items.forEach((item,index) => {
+ this.items.forEach((item, index) => {
item.profession = null;
item.monitorPoint = null;
- item.device = null;
+ this.getDevices(index);
});
if (value === 'monitorPoint') {
this.professionShow = false;
@@ -181,9 +181,8 @@
let areaName = '';
const option = event.option;
this.items[i].monitorPoint = null;
- this.items[i].profession = null;
+ //this.items[i].profession = null;
this.items[i].areaCode = null;
- this.items[i].device = null;
switch (event.index) {
case 0:
@@ -211,42 +210,30 @@
this.items[i].monitorPointOptions = res.data;
}
});
+ this.getDevices(i);
}
-
- monitorPointChange(value, i) {
- this.items[i].deviceOptions = [];
+
+ getDevices(i) {
this.items[i].device = null;
- if (value) {
- this.http.get(environment.SERVER_BASH_URL + 'device/monitorPointId', {params: {monitorPointId: value.id}}).subscribe((res: any) => {
- if (res.code === 0) {
- this.msgSrv.error(res.message);
- } else {
- this.items[i].deviceOptions = res.data;
- }
- });
+ if (!!this.items[i].profession) {
+ this.items[i].professionId = this.items[i].profession.id;
+ } else {
+ this.items[i].professionId = null;
}
- }
-
- professionChange(value, i) {
- this.items[i].deviceOptions = [];
- this.items[i].device = null;
- if (value) {
- if (!!this.items[i].areaName) {
- this.items[i].professionId = value.id;
- this.http.get(environment.SERVER_BASH_URL + 'device/professionId', {params: this.items[i]}).subscribe((res: any) => {
- if (res.code === 0) {
- this.msgSrv.error(res.message);
- } else {
- this.items[i].deviceOptions = res.data;
- }
- });
+ if (!!this.items[i].monitorPoint) {
+ this.items[i].monitorPointId = this.items[i].monitorPoint.id;
+ } else {
+ this.items[i].monitorPointId = null;
+ }
+ return this.http.get(environment.SERVER_BASH_URL + 'device/professionId', {params: this.items[i]}).subscribe((res: any) => {
+ if (res.code === 0) {
+ this.msgSrv.error(res.message);
} else {
- this.msgSrv.error('������������ ������������');
+ this.items[i].deviceOptions = res.data;
}
- }
-
+ });
}
-
+
_disabledDate(current: Date): boolean {
return current && current.getTime() > Date.now();
}
@@ -259,7 +246,7 @@
const areaName = '';
const item = this.items[i];
const queryItem: any = {};
- if (item.monitorPointOptions.length > 0) {
+ if (item.monitorPointOptions.length > 0 && item.deviceOptions.length > 0) {
for (const key in item) {
if (item[key]) {
queryItem[key] = item[key];
@@ -296,7 +283,7 @@
break;
}
}
- if (validate && this.timeType && query.reportType) {
+ if (validate) {
delete query.sensors;
if (this._sensors) {
const sensors = [];
@@ -311,7 +298,7 @@
query.type = this.timeType.value;
sessionStorage.setItem('queryParams', JSON.stringify(query));
} else {
- this.msgSrv.error('���������������������������������������');
+ this.msgSrv.error('���������������������������������������������������������������');
return false;
}
}
--
Gitblit v1.8.0