From 008baf1470f2aaf6fe388a20b9a61069270a1471 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Tue, 15 May 2018 17:19:11 +0800
Subject: [PATCH] 监控坐标编辑功能完善
---
src/app/routes/reports/demo/demo.component.ts | 68 ++++++++++++++++++++++++++++++++--
1 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts
index 42e6d90..ee873aa 100644
--- a/src/app/routes/reports/demo/demo.component.ts
+++ b/src/app/routes/reports/demo/demo.component.ts
@@ -28,12 +28,19 @@
{value: 'bar', label: '���������'},
{value: 'line', label: '���������'}
];
-
+ public professionOptions = [];
+ public dimensionOptions = [
+ {value: 'monitorPoint', label: '������������'},
+ {value: 'profession', label: '������'}
+ ];
+ monitorPointShow = true;
+ professionShow = false;
public items: any[] = [{
id: 0,
+ profession: null,
monitorPoint: null,
device: null,
- time: null,
+ time: new Date(),
monitorPointOptions: [],
deviceOptions: []
}];
@@ -53,6 +60,7 @@
) {
this.timeType = this.typeOptions[1];
this.query.reportType = this.reportOptions[1].value;
+ this.query.dimension = this.dimensionOptions[0].value;
}
ngOnInit() {
@@ -64,6 +72,28 @@
}
});
+ this.http.get(environment.SERVER_BASH_URL + 'mobile/profession').subscribe((res: any) => {
+ if (res.errno !== 0) {
+ this.msgSrv.error(res.message);
+ } else {
+ this.professionOptions = res.data;
+ }
+ });
+ }
+
+ dimensionChange(value) {
+ this.items.forEach((item,index) => {
+ item.profession = null;
+ item.monitorPoint = null;
+ item.device = null;
+ });
+ if (value === 'monitorPoint') {
+ this.professionShow = false;
+ this.monitorPointShow = true;
+ } else {
+ this.professionShow = true;
+ this.monitorPointShow = false;
+ }
}
public onTreeClickSelect(event): void {
@@ -112,9 +142,10 @@
const id = (this.items.length > 0) ? this.items[this.items.length - 1].id + 1 : 0;
const index = this.items.push({
id: id,
+ profession: null,
monitorPoint: null,
device: null,
- time: null,
+ time: new Date(),
monitorPointOptions: [],
deviceOptions: []
});
@@ -150,6 +181,7 @@
let areaName = '';
const option = event.option;
this.items[i].monitorPoint = null;
+ this.items[i].profession = null;
this.items[i].areaCode = null;
this.items[i].device = null;
@@ -195,6 +227,26 @@
}
}
+ 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;
+ }
+ });
+ } else {
+ this.msgSrv.error('������������ ������������');
+ }
+ }
+
+ }
+
_disabledDate(current: Date): boolean {
return current && current.getTime() > Date.now();
}
@@ -207,17 +259,24 @@
const areaName = '';
const item = this.items[i];
const queryItem: any = {};
- if ((!!item.time) && (item.monitorPointOptions.length > 0)) {
+ if (item.monitorPointOptions.length > 0) {
for (const key in item) {
if (item[key]) {
queryItem[key] = item[key];
}
+ }
+ if (queryItem.profession) {
+ queryItem.professionId = queryItem.profession.id;
+ queryItem.professionName = queryItem.profession.name;
+ delete queryItem.profession;
}
if (queryItem.monitorPoint) {
queryItem.monitorPointId = queryItem.monitorPoint.id;
queryItem.monitorPointName = queryItem.monitorPoint.name;
queryItem.monitorPointAddress = queryItem.monitorPoint.address;
delete queryItem.monitorPoint;
+ } else {
+ queryItem.monitorPointName = queryItem.areaName;
}
delete queryItem.monitorPointOptions;
if (queryItem.device) {
@@ -238,6 +297,7 @@
}
}
if (validate && this.timeType && query.reportType) {
+ delete query.sensors;
if (this._sensors) {
const sensors = [];
for (const key in this._sensors) {
--
Gitblit v1.8.0