From cb370be00fe6b23a8e13cbbd75c66bab9fed50c9 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 23 Mar 2018 14:58:47 +0800
Subject: [PATCH] Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop

---
 src/app/routes/report/report.component.html     |    9 ++-------
 src/app/routes/reports/demo/demo.component.ts   |   24 +++++++++++++++++-------
 src/app/routes/reports/demo/demo.component.html |    6 +++---
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/app/routes/report/report.component.html b/src/app/routes/report/report.component.html
index 224d7e4..8e61a48 100644
--- a/src/app/routes/report/report.component.html
+++ b/src/app/routes/report/report.component.html
@@ -12,13 +12,8 @@
 					<div class="title">
 						<div class="title_left"></div>
 						<div class="text">
-							<span *ngFor="let item of items;let i = index">
-								<span *ngIf="i > 0">���</span>
-								{{item.monitorPointName}}
-							</span>
-							<span >
-								������������������
-							</span>
+							<span *ngFor="let item of items;let i = index"><span *ngIf="i > 0">���</span>{{item.monitorPointName}}</span>
+							<span>������������������</span>
 						</div>
 						<div class="title_right"></div>
 						<div class="clear_fix"></div>
diff --git a/src/app/routes/reports/demo/demo.component.html b/src/app/routes/reports/demo/demo.component.html
index f988a34..77ce44b 100644
--- a/src/app/routes/reports/demo/demo.component.html
+++ b/src/app/routes/reports/demo/demo.component.html
@@ -8,8 +8,8 @@
 						<label>&nbsp;&nbsp;&nbsp;���&nbsp;&nbsp;&nbsp;&nbsp;���</label>
 					</div>
 					<div nz-form-control class="flex-1">
-						<nz-select [nzMode]="'multiple'" [(ngModel)]="query.sensorKey" name="sensorKey" [nzSize]="'large'" [nzPlaceHolder]="'���������'" nzAllowClear>
-							<nz-option *ngFor="let option of sensorOptions" [nzLabel]="option.name" [nzValue]="option.sensorKey" ></nz-option>
+						<nz-select [nzMode]="'multiple'" [(ngModel)]="query.sensorKey" name="sensorKey" [nzSize]="'large'" [nzPlaceHolder]="'���������'">
+							<nz-option *ngFor="let option of sensorOptions" [nzLabel]="option.name" [nzValue]="option"></nz-option>
             			</nz-select>
 					</div>
 				</div>
@@ -71,7 +71,7 @@
 					</div>
 					<div nz-form-control class="flex-1">
 						<nz-select [(ngModel)]="item.mac" name="mac{{item.id}}" [nzSize]="'large'" nzAllowClear [nzPlaceHolder]="'���������'" (ngModelChange)="deviceChange($event,i)">
-							<nz-option *ngFor="let option of deviceOptions" [nzLabel]="option.name" [nzValue]="option.mac" ></nz-option>
+							<nz-option *ngFor="let option of item.deviceOptions" [nzLabel]="option.name" [nzValue]="option.mac" ></nz-option>
             			</nz-select>
 					</div>
 				</div>
diff --git a/src/app/routes/reports/demo/demo.component.ts b/src/app/routes/reports/demo/demo.component.ts
index 755551b..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;
         }
@@ -154,6 +156,14 @@
       }
     }
     if (validate && query.type && query.reportType) {
+      query.sensors = null;
+      if (query.sensorKey && query.sensorKey.length > 0) {
+        const sensors = [];
+        query.sensorKey.forEach(sensor => {
+          sensors.push(sensor.sensorKey + '-' + sensor.name + '-' + sensor.unit);
+        });
+        query.sensors = JSON.stringify(sensors);
+      }
       query.timeType = JSON.stringify(this.timeType);
       query.items = JSON.stringify(this.items);
       this.router.navigate(['report'], {queryParams: query});

--
Gitblit v1.8.0