Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  | <!-- <input type='button' value='打印' class='notprint' onclick='javascript:window.print();' /> -->
 | 
 |  |  | 
 | 
 |  |  | <div id ="mydiv" style="height: 300px; width: 100%"></div>
 | 
 |  |  | <div *ngFor="let i of sensorArr">
 | 
 |  |  |     <div id ="mydiv{{i}}" style="height: 486px; width: 1000px"></div>
 | 
 |  |  | </div>
 | 
 |  |  | 
 | 
 
 |  |  | 
 |  |  | import {HttpClient} from '@angular/common/http'; | 
 |  |  | import {ActivatedRoute} from '@angular/router'; | 
 |  |  | import * as echarts from 'echarts'; | 
 |  |  | import * as $ from 'jquery'; | 
 |  |  |  | 
 |  |  | @Component({ | 
 |  |  |   selector: 'app-report', | 
 |  |  | 
 |  |  |   styles: [] | 
 |  |  | }) | 
 |  |  | export class ReportComponent implements OnInit { | 
 |  |  |  | 
 |  |  |   public data: any; | 
 |  |  |  | 
 |  |  |   public isShow = true; | 
 |  |  |   [x: string]: any; | 
 |  |  |  | 
 |  |  |   constructor( | 
 |  |  |     injector: Injector, | 
 |  |  |     public injector: Injector, | 
 |  |  |     public http: HttpClient, | 
 |  |  |     public activeRoute: ActivatedRoute, | 
 |  |  |     public msgSrv: NzMessageService | 
 |  |  |   ) { } | 
 |  |  |   ) { | 
 |  |  |     for (let index = 0; index < 30; index++) { | 
 |  |  |       this.sensorArr.push(index); | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   public echartOption = { | 
 |  |  |     title: { | 
 |  |  |       text: '', | 
 |  |  |       subtext: '12月份', | 
 |  |  |       // subtext: '12月份', | 
 |  |  |       left: 'center' | 
 |  |  |     }, | 
 |  |  |     tooltip: { | 
 |  |  | 
 |  |  |     }, | 
 |  |  |     legend: { | 
 |  |  |       data: [], | 
 |  |  |       left: 'left' | 
 |  |  |       orient: 'vertical', | 
 |  |  |       right: 40, | 
 |  |  |       top: 5, | 
 |  |  |       bottom: 20 | 
 |  |  |     }, | 
 |  |  |     toolbox: { | 
 |  |  |       show: true, | 
 |  |  |       show: false, | 
 |  |  |       feature: { | 
 |  |  |         dataZoom: { | 
 |  |  |           yAxisIndex: 'none' | 
 |  |  | 
 |  |  |  | 
 |  |  |     }, | 
 |  |  |     series: [ | 
 |  |  |       { | 
 |  |  |         smooth: false, | 
 |  |  |         type: 'line', | 
 |  |  |         data: [], | 
 |  |  |         name: '' | 
 |  |  |       }, | 
 |  |  |       { | 
 |  |  |         smooth: true, | 
 |  |  |         type: 'line', | 
 |  |  |         data: [], | 
 |  |  |         name: '', | 
 |  |  |         itemStyle: { | 
 |  |  |           normal: { | 
 |  |  |             barBorderRadius: [10, 10, 10, 10] | 
 |  |  |           } | 
 |  |  |         } | 
 |  |  |       } | 
 |  |  |       //      { | 
 |  |  |       //        smooth: true, | 
 |  |  |       //        type: 'line', | 
 |  |  |       //        data: [], | 
 |  |  |       //        name: '', | 
 |  |  |       //        itemStyle: { | 
 |  |  |       //          normal: { | 
 |  |  |       //            barBorderRadius: [10, 10, 10, 10] | 
 |  |  |       //          } | 
 |  |  |       //        } | 
 |  |  |       //      } | 
 |  |  |     ] | 
 |  |  |   }; | 
 |  |  |  | 
 |  |  |   sensorArr: any = []; | 
 |  |  |    | 
 |  |  |   ngOnInit() { | 
 |  |  |     this.activeRoute.queryParams.subscribe(params => { | 
 |  |  |       const items = JSON.parse(params.items); | 
 |  |  |       const query = params; | 
 |  |  |       this.http.get(environment.SERVER_BASH_URL + 'report/compare', {params: query}).subscribe((res: any) => { | 
 |  |  |         if (res.code === 0) { | 
 |  |  |           this.msgSrv.error(res.message); | 
 |  |  |         } else { | 
 |  |  |           const option = this.echartOption; | 
 |  |  |           const data = res.data; | 
 |  |  |           if (data['time']) { | 
 |  |  |             option.xAxis.data = data['time']; | 
 |  |  |             option.title.text = query.sensorName + query.label + '历走势图'; | 
 |  |  |             option.series[0].data = []; | 
 |  |  |             option.legend.data[0] = ''; | 
 |  |  |             option.series[0].name = ''; | 
 |  |  |             option.series[1].data = []; | 
 |  |  |             option.legend.data[1] = ''; | 
 |  |  |             option.series[1].name = ''; | 
 |  |  |             if (data.dataA) { | 
 |  |  |               const legendNamea = (query.deviceaName ? query.deviceaName : query.monitorPointaName) + query.time + query.label; | 
 |  |  |               option.series[0].data = data.dataA; | 
 |  |  |               option.legend.data[0] = legendNamea; | 
 |  |  |               option.series[0].name = legendNamea; | 
 |  |  |             } | 
 |  |  |             if (data.dataB) { | 
 |  |  |               const legendNameb = (query.devicebName ? query.devicebName : params.monitorPointbName) + query.timeb + query.label; | 
 |  |  |               option.series[1].data = data['dataB']; | 
 |  |  |               option.legend.data[1] = legendNameb; | 
 |  |  |               option.series[1].name = legendNameb; | 
 |  |  |             } | 
 |  |  |             option.yAxis.name = query.sensorUnit; | 
 |  |  |           const datas = res.data.datas; | 
 |  |  |           const times = res.data.times | 
 |  |  |           const sensors = res.data.sensors | 
 |  |  |           option.xAxis.data = times; | 
 |  |  |             option.xAxis.name = query.xAxisName; | 
 |  |  |             const myChart = echarts.init(document.getElementById('mydiv')); | 
 |  |  |           for (let index = 0; index < sensors.length; index++) { | 
 |  |  |             let sensorKey = sensors[index]; | 
 |  |  |             let split = sensorKey.split('-'); | 
 |  |  |             option.title.text = split[1] + query.label + '历走势图'; | 
 |  |  |             option.yAxis.name = split[2] && split[2] != 'null' ? split[2] : ''; | 
 |  |  |             option.series = []; | 
 |  |  |             option.legend.data = []; | 
 |  |  |  | 
 |  |  |             for (let i = 0; i < items.length; i++) { | 
 |  |  |               const legendName = items[i].formatTime + query.label + (items[i].mac ? items[i].deviceName : items[i].monitorPointName); | 
 |  |  |               option.legend.data[i] = legendName; | 
 |  |  |               const seriesData = datas[i]['data' + i][0][sensorKey]; | 
 |  |  |               option.series.push({ | 
 |  |  |                 data: seriesData, | 
 |  |  |                 smooth: true, | 
 |  |  |                 type: 'line', | 
 |  |  |                 name: legendName | 
 |  |  |               }); | 
 |  |  |             } | 
 |  |  |             const myChart = echarts.init(document.getElementById('mydiv' + index)); | 
 |  |  |             myChart.setOption(option, true); | 
 |  |  |             window.onresize = myChart.resize; | 
 |  |  |           } | 
 |  |  |           this.isShow = true; | 
 |  |  |           this.sensorArr.forEach(i => { | 
 |  |  |             if (i >= sensors.length) { | 
 |  |  |               $('#mydiv' + i).remove(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |           }); | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   doPrint() { | 
 |  |  |     this.isShow = false; | 
 |  |  |     window.print(); | 
 |  |  |   } | 
 |  |  |   printBtnBoolean = true; | 
 |  |  |   printComplete() { | 
 |  |  |     this.printBtnBoolean = true; | 
 |  |  |   } | 
 |  |  |   beforePrint() { | 
 |  |  |     this.printBtnBoolean = false; | 
 |  |  |   } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <div nz-form-item class="d-flex"> | 
 |  |  |                     <div nz-form-label> | 
 |  |  |                         <label nz-form-item-required>项 目</label> | 
 |  |  |                         <label>   项    目</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-select [(ngModel)]="query.sensorKey" name="sensorKey" [nzSize]="'large'" [nzPlaceHolder]="'请选择'" (ngModelChange)="sensorChange($event)" nzAllowClear> | 
 |  |  |                         <nz-select [(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> | 
 |  |  |                     </div> | 
 |  |  | 
 |  |  |                         <label nz-form-item-required>类型</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-select [(ngModel)]="query.type" name="isDelete" [nzSize]="'large'" [nzPlaceHolder]="'请选择'" (ngModelChange)="typeChange($event)"> | 
 |  |  |                         <nz-select [(ngModel)]="query.type" name="type" [nzSize]="'large'" [nzPlaceHolder]="'请选择'" (ngModelChange)="typeChange($event)"> | 
 |  |  |                             <nz-option *ngFor="let option of typeOptions" [nzLabel]="option.label" [nzValue]="option.value" ></nz-option> | 
 |  |  |                         </nz-select> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md" *ngIf="items.length!=5"> | 
 |  |  |                 <button nz-button type="button" [nzType]="'primary'" [nzSize]="'large'" (click)="addItem()"> | 
 |  |  |                     <!-- <i class="anticon anticon-plus"></i> --> | 
 |  |  |                     <i class="anticon anticon-plus-circle-o"></i> | 
 |  |  |                     <span>增加查询条目</span> | 
 |  |  |                 </button> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |         <div nz-row [nzGutter]="24"> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |         <div nz-row [nzGutter]="24" *ngFor="let item of items;let i = index"> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <div nz-form-item class="d-flex"> | 
 |  |  |                     <div nz-form-label> | 
 |  |  |                         <label >监测点</label> | 
 |  |  |                         <label nz-form-item-required>监测点</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-select [(ngModel)]="query.monitorPoint" name="monitorPoint" nzAllowClear [nzPlaceHolder]="'请输入'" [nzFilter]="false" [nzSize]="'large'"   | 
 |  |  |                             (nzSearchChange)="searchChange($event)" [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointChange($event)" nzShowSearch>  | 
 |  |  |                         <nz-select [(ngModel)]="item.monitorPoint" name="monitorPoint{{item.id}}" nzAllowClear [nzPlaceHolder]="'请输入'" [nzFilter]="false" [nzSize]="'large'"   | 
 |  |  |                             (nzSearchChange)="searchChange($event,i)" [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointChange($event,i)" nzShowSearch>  | 
 |  |  |                             <nz-option *ngFor="let option of monitorPointOptions"  [nzLabel]="option['name']" [nzValue]="option['id']"> </nz-option>  | 
 |  |  |                         </nz-select> | 
 |  |  |                     </div> | 
 |  |  | 
 |  |  |                         <label>  设备</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-select [(ngModel)]="query.mac" name="mac" [nzSize]="'large'" nzAllowClear [nzPlaceHolder]="'请选择'" (ngModelChange)="deviceChange($event)"> | 
 |  |  |                         <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-select> | 
 |  |  |                     </div> | 
 |  |  | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <div nz-form-item class="d-flex"> | 
 |  |  |                     <div nz-form-label> | 
 |  |  |                         <label >时间</label> | 
 |  |  |                         <label nz-form-item-required>时间</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-datepicker style="width: 100%;" [(ngModel)]="query.time" name="time" [nzPlaceHolder]="'请选择'" [nzFormat]="time.format" [nzMode]="time.mode" [nzSize]="'large'" nzShowTime></nz-datepicker> | 
 |  |  |                         <nz-datepicker style="width: 100%;" value="" [(ngModel)]="item.time" name="time{{item.id}}" id="{{item.time}}" [nzPlaceHolder]="'请选择'" [nzFormat]="time.format" [nzMode]="time.mode" [nzSize]="'large'" nzShowTime></nz-datepicker> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md" *ngIf="items.length!=1"> | 
 |  |  |                 <button nz-button type="button" [nzType]="'danger'" [nzSize]="'large'" (click)="items.splice(i, 1)" nzGhost> | 
 |  |  |                     <i class="anticon anticon-minus-circle-o dynamic-delete-button"></i> | 
 |  |  |                     <span>删除查询条目</span> | 
 |  |  |                 </button> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |  | 
 |  |  |         <div nz-row [nzGutter]="24"> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <div nz-form-item class="d-flex"> | 
 |  |  |                     <div nz-form-label> | 
 |  |  |                         <label >监测点</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-select [(ngModel)]="query.monitorPointb" name="monitorPointb" nzAllowClear [nzPlaceHolder]="'请输入'" [nzFilter]="false" [nzSize]="'large'"   | 
 |  |  |                             (nzSearchChange)="searchChangeb($event)" [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointbChange($event)" nzShowSearch>  | 
 |  |  |                             <nz-option *ngFor="let option of monitorPointbOptions"  [nzLabel]="option['name']" [nzValue]="option['id']"> </nz-option>  | 
 |  |  |                         </nz-select> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <div nz-form-item class="d-flex"> | 
 |  |  |                     <div nz-form-label> | 
 |  |  |                         <label>  设备</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-select [(ngModel)]="query.macb" name="macb" [nzSize]="'large'" nzAllowClear [nzPlaceHolder]="'请选择'" (ngModelChange)="devicebChange($event)"> | 
 |  |  |                             <nz-option *ngFor="let option of devicebOptions" [nzLabel]="option.name" [nzValue]="option.mac" ></nz-option> | 
 |  |  | 							 | 
 |  |  |                         </nz-select> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <div nz-form-item class="d-flex"> | 
 |  |  |                     <div nz-form-label> | 
 |  |  |                         <label >时间</label> | 
 |  |  |                     </div> | 
 |  |  |                     <div nz-form-control class="flex-1"> | 
 |  |  |                         <nz-datepicker style="width: 100%;" [(ngModel)]="query.timeb" name="timeb" [nzPlaceHolder]="'请选择'" [nzFormat]="time.format" [nzMode]="time.mode" [nzSize]="'large'" nzShowTime></nz-datepicker> | 
 |  |  |                     </div> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |         <div nz-row [nzGutter]="24"> | 
 |  |  |             <div nz-col [nzSpan]="6" class="mb-md"> | 
 |  |  |                 <button nz-button type="submit" [nzType]="'primary'" [nzSize]="'large'">查询</button> | 
 
 |  |  | 
 |  |  | import {HttpClient} from '@angular/common/http'; | 
 |  |  | import {Router} from '@angular/router'; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | @Component({ | 
 |  |  |   selector: 'app-demo', | 
 |  |  |   templateUrl: './demo.component.html', | 
 |  |  | 
 |  |  |     format: 'YYYY', | 
 |  |  |     mode: 'month' | 
 |  |  |   }; | 
 |  |  |   items = [{ | 
 |  |  |     id: 0, | 
 |  |  |     monitorPoint: null, | 
 |  |  |     mac: '', | 
 |  |  |     time: null, | 
 |  |  |     formatTime: null, | 
 |  |  |     monitorPointName: '', | 
 |  |  |     deviceName: '' | 
 |  |  |   }]; | 
 |  |  |  | 
 |  |  |   public sensorOptions = []; | 
 |  |  |  | 
 |  |  |   public monitorPointOptions = []; | 
 |  |  |   public deviceOptions = []; | 
 |  |  |   public monitorPointbOptions = []; | 
 |  |  |   public devicebOptions = []; | 
 |  |  |  | 
 |  |  |   constructor( | 
 |  |  |     public http: HttpClient, | 
 |  |  |     public dateSrv: DateService, | 
 |  |  |     public router: Router, | 
 |  |  |     public msgSrv: NzMessageService | 
 |  |  |   ) {} | 
 |  |  |  | 
 |  |  |  | 
 |  |  |   ) { | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   ngOnInit() { | 
 |  |  |     this.query.time = null; | 
 |  |  |     this.query.timeb = null; | 
 |  |  |     this.http.get(environment.SERVER_BASH_URL + 'sensor/all').subscribe((res: any) => { | 
 |  |  |       if (res.code === 0) { | 
 |  |  |         this.msgSrv.error(res.message); | 
 |  |  | 
 |  |  |     }); | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   searchChange(searchText) { | 
 |  |  |   addItem() { | 
 |  |  |     const id = (this.items.length > 0) ? this.items[this.items.length - 1].id + 1 : 0; | 
 |  |  |     const index = this.items.push({ | 
 |  |  |       id, | 
 |  |  |       monitorPoint: null, | 
 |  |  |       mac: '', | 
 |  |  |       time: null, | 
 |  |  |       formatTime: null, | 
 |  |  |       monitorPointName: '', | 
 |  |  |       deviceName: '' | 
 |  |  |     }); | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |   searchChange(searchText, i) { | 
 |  |  |     if (searchText) { | 
 |  |  |       const query = encodeURI(searchText); | 
 |  |  |       if (query) { | 
 |  |  | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   monitorPointChange(value) { | 
 |  |  |     this.query.mac = null; | 
 |  |  |   monitorPointChange(value, i) { | 
 |  |  |     this.deviceOptions = []; | 
 |  |  |     if (value) { | 
 |  |  |       this.monitorPointOptions.forEach(monitorPoint => { | 
 |  |  |         if (monitorPoint.id === value) { | 
 |  |  |           this.monitorPointa = monitorPoint; | 
 |  |  |           this.items[i].monitorPointName = monitorPoint.name; | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |       this.http.get(environment.SERVER_BASH_URL + 'device/monitorPointId', {params: {monitorPointId: value}}).subscribe((res: any) => { | 
 |  |  | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |     } else { | 
 |  |  |       this.monitorPointa = null; | 
 |  |  |       this.items[i].monitorPoint = null; | 
 |  |  |       this.items[i].mac = ''; | 
 |  |  |       this.items[i].monitorPointName = ''; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   searchChangeb(searchText) { | 
 |  |  |     if (searchText) { | 
 |  |  |       const query = encodeURI(searchText); | 
 |  |  |       if (query) { | 
 |  |  |         this.http.get(environment.SERVER_BASH_URL + '/monitor-point/list/' + query).subscribe((res: any) => { | 
 |  |  |           if (res.code === 0) { | 
 |  |  |             this.msgSrv.error(res.message); | 
 |  |  |           } else { | 
 |  |  |             this.monitorPointbOptions = res.data; | 
 |  |  |           } | 
 |  |  |         }); | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   devicebChange(value) { | 
 |  |  |     if (value) { | 
 |  |  |       this.devicebOptions.forEach(device => { | 
 |  |  |         if (device.mac === value) { | 
 |  |  |           this.deviceb = device; | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |     } else { | 
 |  |  |       this.deviceb = null; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   deviceChange(value) { | 
 |  |  |     this.devicea = null; | 
 |  |  |   deviceChange(value, i) { | 
 |  |  |     if (value) { | 
 |  |  |       this.deviceOptions.forEach(device => { | 
 |  |  |         if (device.mac === value) { | 
 |  |  |           this.devicea = device; | 
 |  |  |           this.items[i].deviceName = device.name; | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |     } else { | 
 |  |  |       this.devicea = null; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   monitorPointbChange(searchText) { | 
 |  |  |     this.query.macb = null; | 
 |  |  |     this.devicebOptions = []; | 
 |  |  |     if (searchText) { | 
 |  |  |       this.monitorPointbOptions.forEach(monitorPoint => { | 
 |  |  |         if (monitorPoint.id === searchText) { | 
 |  |  |           this.monitorPointb = monitorPoint; | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |       this.http.get(environment.SERVER_BASH_URL + 'device/monitorPointId', {params: {monitorPointId: searchText}}).subscribe((res: any) => { | 
 |  |  |         if (res.code === 0) { | 
 |  |  |           this.msgSrv.error(res.message); | 
 |  |  |         } else { | 
 |  |  |           this.devicebOptions = res.data; | 
 |  |  |         } | 
 |  |  |       }); | 
 |  |  |       this.items[i].deviceName = ''; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   public typeOptions = [ | 
 |  |  |     {value: 'year', label: '年', mode: 'month', xAxisName: '月', format: 'yyyy', typeFormat: '%Y-%m'}, | 
 |  |  |     {value: 'month', label: '月', mode: 'month', xAxisName: '日', format: 'yyyy-MM', typeFormat: '%Y-%m-%d'}, | 
 |  |  |     {value: 'day', label: '日', mode: 'day', xAxisName: '时', format: 'yyyy-MM-dd', typeFormat: '%Y-%m-%d %H'}, | 
 |  |  |     {value: 'hour', label: '时', mode: 'day', xAxisName: '分', format: 'yyyy-MM-dd HH', typeFormat: '%Y-%m-%d %H:%i'} | 
 |  |  |     {value: 'year', label: '年', mode: 'month', xAxisName: '月', format: 'yyyy', typeFormat: '%Y-%m', timeLength: 12}, | 
 |  |  |     {value: 'month', label: '月', mode: 'month', xAxisName: '日', format: 'yyyy-MM', typeFormat: '%Y-%m-%d', timeLength: 28}, | 
 |  |  |     {value: 'day', label: '日', mode: 'day', xAxisName: '时', format: 'yyyy-MM-dd', typeFormat: '%Y-%m-%d %H', timeLength: 24}, | 
 |  |  |     {value: 'hour', label: '时', mode: 'day', xAxisName: '分', format: 'yyyy-MM-dd HH', typeFormat: '%Y-%m-%d %H:%i', timeLength: 60} | 
 |  |  |   ]; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |   reportQuery() { | 
 |  |  |     const query = this.query; | 
 |  |  |     if (query.sensorKey && query.type && ((query.monitorPoint && query.time) || (query.monitorPointb && query.timeb))) { | 
 |  |  |       if (query.time) { | 
 |  |  |         query.time = this.dateSrv.date_format(query.time, this.time.format); | 
 |  |  |     let validate = true; | 
 |  |  |     for (let i = 0; i < this.items.length; i++) { | 
 |  |  |       let item = this.items[i]; | 
 |  |  |       if (item.monitorPoint && item.time) { | 
 |  |  |         item.formatTime = this.dateSrv.date_format(item.time, this.time.format); | 
 |  |  |       } else { | 
 |  |  |         validate = false; | 
 |  |  |         break; | 
 |  |  |       } | 
 |  |  |       if (query.timeb) { | 
 |  |  |         query.timeb = this.dateSrv.date_format(query.timeb, this.time.format); | 
 |  |  |       } | 
 |  |  |     if (validate && query.type) { | 
 |  |  |       query.format = this.timeType.format; | 
 |  |  |       query.typeFormat = this.timeType.typeFormat; | 
 |  |  |       query.xAxisName = this.timeType.xAxisName; | 
 |  |  |       query.label = this.timeType.label; | 
 |  |  |       query.sensorName = this.sensor.name; | 
 |  |  |       query.sensorUnit = this.sensor.unit; | 
 |  |  |       if (this.devicea) { | 
 |  |  |         query.deviceaName = this.devicea.name; | 
 |  |  |       } | 
 |  |  |       if (this.deviceb) { | 
 |  |  |         query.devicebName = this.deviceb.name; | 
 |  |  |       } | 
 |  |  |       if (this.monitorPointa) { | 
 |  |  |         query.monitorPointaName = this.monitorPointa.name; | 
 |  |  |       } | 
 |  |  |       if (this.monitorPointb) { | 
 |  |  |         query.monitorPointbName = this.monitorPointb.name; | 
 |  |  |       } | 
 |  |  |       query.timeLength = this.timeType.timeLength; | 
 |  |  |       query.items = JSON.stringify(this.items); | 
 |  |  |       this.router.navigate(['report'], {queryParams: query}); | 
 |  |  |  | 
 |  |  |     } else { | 
 |  |  |       this.msgSrv.error('请完善搜索项'); | 
 |  |  |       this.msgSrv.error('请完善搜索项或删除查询条目'); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   sensorChange(value) { | 
 |  |  |     this.sensorOptions.forEach(sensor => { | 
 |  |  |       if (sensor.sensorKey === value) { | 
 |  |  |         this.sensor = sensor; | 
 |  |  |       } | 
 |  |  |     }); | 
 |  |  |   } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     },    // passport | 
 |  |  |     { | 
 |  |  |       path: 'report', | 
 |  |  |       component: ReportComponent | 
 |  |  |       component: ReportComponent, | 
 |  |  |       data:{title:'对比报表'} | 
 |  |  |     }, | 
 |  |  |     { path: '**', redirectTo: 'passport/login' } | 
 |  |  | ]; | 
 
 |  |  | 
 |  |  |             "translate": "main_navigation", | 
 |  |  |             "group": true, | 
 |  |  |             "children": [{ | 
 |  |  |                 "text": "仪表盘", | 
 |  |  |                 "link": "/dashboard", | 
 |  |  |                 "icon": "icon-speedometer", | 
 |  |  |                 "children": [{ | 
 |  |  |                     "text": "仪表盘V1", | 
 |  |  |                     "link": "/dashboard/v1", | 
 |  |  |                     "translate": "dashboard_v1" | 
 |  |  |                 }, { | 
 |  |  |                     "text": "分析页", | 
 |  |  |                     "link": "/dashboard/analysis" | 
 |  |  |                 }, { | 
 |  |  |                     "text": "Monitor", | 
 |  |  |                     "link": "/dashboard/monitor", | 
 |  |  |                     "translate": "dashboard_monitor" | 
 |  |  |                 }, { | 
 |  |  |                     "text": "Workplace", | 
 |  |  |                 "text": "工作台", | 
 |  |  |                     "link": "/dashboard/workplace", | 
 |  |  |                 "icon": "icon-speedometer", | 
 |  |  |                     "translate": "dashboard_workplace" | 
 |  |  |                 }] | 
 |  |  |             }, { | 
 |  |  |                 "text": "快捷菜单", | 
 |  |  |                 "translate": "shortcut", | 
 |  |  |                 "icon": "icon-rocket", | 
 |  |  |                 "shortcut_root": true, | 
 |  |  |                 "children": [] | 
 |  |  |             }] | 
 |  |  |         }, { | 
 |  |  |             "text": "系统模块", |