From a439eed077c3a157ed3b9096cf8e793671fe8cdf Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Thu, 22 Mar 2018 11:40:03 +0800
Subject: [PATCH] 报表 优化

---
 src/app/routes/reports/demo/demo.component.ts |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts
index 54f635f..6d17800 100644
--- a/src/app/routes/reports/demo/demo.component.ts
+++ b/src/app/routes/reports/demo/demo.component.ts
@@ -37,7 +37,6 @@
     {value: 'line', label: '���������'}
   ];
   public monitorPointOptions = [];
-  public deviceOptions = [];
   public time: any = {};
   public timeType: any = {};
   public items = [{
@@ -49,7 +48,8 @@
     monitorPointName: '',
     deviceName: '',
     monitorPointAddress: '',
-    deviceCount: ''
+    deviceCount: '',
+    deviceOptions: []
   }];
 
   ngOnInit() {
@@ -82,7 +82,8 @@
       monitorPointName: '',
       deviceName: '',
       monitorPointAddress: '',
-      deviceCount: ''
+      deviceCount: '',
+      deviceOptions: []
     });
   }
 
@@ -102,7 +103,7 @@
   }
 
   monitorPointChange(value, i) {
-    this.deviceOptions = [];
+    this.items[i].deviceOptions = [];
     if (value) {
       this.monitorPointOptions.forEach(monitorPoint => {
         if (monitorPoint.id === value) {
@@ -114,20 +115,21 @@
         if (res.code === 0) {
           this.msgSrv.error(res.message);
         } else {
-          this.deviceOptions = res.data;
+          this.items[i].deviceOptions = res.data;
           this.items[i].deviceCount = res.data.length;
+          this.items[i].mac = null;
         }
       });
     } else {
       this.items[i].monitorPoint = null;
-      this.items[i].mac = '';
+      this.items[i].mac = null;
       this.items[i].monitorPointName = '';
     }
   }
 
   deviceChange(value, i) {
     if (value) {
-      this.deviceOptions.forEach(device => {
+      this.items[i].deviceOptions.forEach(device => {
         if (device.mac === value) {
           this.items[i].deviceName = device.name;
         }

--
Gitblit v1.8.0