From 4056d69076e49d28ee54b169b42c6430c1c2e261 Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Thu, 12 Jul 2018 16:50:31 +0800
Subject: [PATCH] updates

---
 src/app/routes/reports/query/query.component.ts   |   98 ++++++++++++------------
 src/app/routes/reports/query/query.component.html |   96 ++++++------------------
 2 files changed, 74 insertions(+), 120 deletions(-)

diff --git a/src/app/routes/reports/query/query.component.html b/src/app/routes/reports/query/query.component.html
index cae4d8e..ea66909 100644
--- a/src/app/routes/reports/query/query.component.html
+++ b/src/app/routes/reports/query/query.component.html
@@ -4,12 +4,10 @@
 <nz-card [nzBordered]="false">
     <form nz-form  [nzLayout]="'inline'">
         <div nz-row [nzGutter]="24">
-            <div nz-col [nzSpan]="8" class="mb-md">
+            <div nz-col [nzSpan]="6" class="mb-md">
                 <div nz-form-item class="d-flex">
                     <div  [ngStyle]="{'width': '100px'}" nz-form-label>
-                        <label>
-                            ������({{ sensorsSelect+'/'+sensorsLength }})
-                        </label>
+                        <label>������������</label>
                     </div>
                     <div nz-form-control class="flex-1">
                         <nz-popover   [nzPlacement]="'bottomLeft'" [(nzVisible)]="sensorSelectVisible" [nzTrigger]="'click'">
@@ -29,20 +27,13 @@
                                 </div>
                             </ng-template>
                         </nz-popover>
-                        <!-- <div style="top:0; right: -62px; position:absolute; font-size: 16px; color: #696969;">
-                            <span>(</span>
-                            <span style="display: inline-block; width: 50px; text-align: center;">
-                                {{ sensorsSelect+'/'+sensorsLength }}
-                            </span>
-                            <span>)</span>
-                        </div> -->
                     </div>
                 </div>
             </div>
-            <div nz-col [nzSpan]="9" class="mb-md">
+            <div nz-col [nzSpan]="4" class="mb-md">
                 <div nz-form-item class="d-flex">
                     <div [ngStyle]="{'width': '128px'}" nz-form-label>
-                        <label>������������</label>
+                        <label>������</label>
                     </div>
                     <div nz-form-control class="flex-1">
                         <nz-select name="timeUnit" [(ngModel)]="timeUnit" [nzPlaceHolder]="'������ ������������'" (ngModelChange)="setTimeUnit($event)" [nzNotFoundContent]="'������������'">
@@ -54,8 +45,22 @@
             </div>
             <div nz-col [nzSpan]="7" class="mb-md">
                 <div nz-form-item class="d-flex">
+                    <div [ngStyle]="{'width': '128px'}" nz-form-label>
+                        <label>������������</label>
+                    </div>
+                    <div nz-form-control class="flex-1">
+                        <nz-select name="deviceDimension" style="width: 100%;" [(ngModel)]="deviceDimension" nzAllowClear [nzPlaceHolder]="'������ '+ dimensionItem.label +'(������������������)'"
+                                   nzShowSearch (nzSearchChange)="dimensionsChange($event)" [nzNotFoundContent]="'������������'">
+                            <nz-option *ngFor="let option of dimensionOptions" [nzLabel]="option.name" [nzValue]="option">
+                            </nz-option>
+                        </nz-select>
+                    </div>
+                </div>
+            </div>
+            <div nz-col [nzSpan]="5" class="mb-md">
+                <div nz-form-item class="d-flex">
                     <div  nz-form-label>
-                        <label>������������</label>
+                        <label>������:</label>
                     </div>
                     <div *ngIf="timeUnit.value!='MONTH'; else elseBlock" nz-form-control class="flex-1">
                         <nz-datepicker [ngStyle]="{'width': '100%'}" name="actualTime" [(ngModel)]="actualTime" [nzAllowClear]="false" [nzShowTime]="_timeType.showTime"
@@ -72,68 +77,11 @@
                     </ng-template>
                 </div>
             </div>
-        </div>
-        <div [ngStyle]="{'display':isCollapse ? 'none' : 'block' }" nz-row [nzGutter]="24">
-            <div nz-col [nzSpan]="8" class="mb-md">
-                <div nz-form-item class="d-flex">
-                    <div [ngStyle]="{'width': '100px'}" nz-form-label>
-                        <label>���������</label>
-                    </div>
-                    <div nz-form-control class="flex-1">
-                        <nz-cascader [class.class123]="true" (nzLoad)="areaLazyLoad($event)" [nzPlaceHolder]="'������ ���/���/���'" (nzSelectionChange)="setAreasData($event)"
-                            [nzAllowClear]="false" [nzChangeOnSelect]="true" [ngModel]="_areas" name="areasData">
-                        </nz-cascader>
-                    </div>
-                </div>
-            </div>
-            <div nz-col [nzSpan]="9" class="mb-md">
-                <div nz-form-item class="d-flex">
-                    <div [ngStyle]="{'width': '128px'}" nz-form-label>
-                            <label>
-                                    <nz-dropdown>
-                                        <button nz-button nz-dropdown ><span>{{dimensionItem.label}}</span> <i class="anticon anticon-down"></i></button>
-                                            <ul nz-menu>
-                                              <li *ngFor="let option of otherDimensions;let i = index;"  nz-menu-item>
-                                                <a (click)="selectDimension(option)">{{option.label}}</a>
-                                              </li>
-                                            </ul>
-                                    </nz-dropdown>
-                            </label>
-                    </div>
-                    <div nz-form-control class="flex-1">
-                        <nz-select name="deviceDimension" style="width: 100%;" [(ngModel)]="deviceDimension" nzAllowClear [nzPlaceHolder]="'������ '+ dimensionItem.label +'(������������������)'"
-                            nzShowSearch (nzSearchChange)="dimensionsChange($event)" [nzNotFoundContent]="'������������'">
-                            <nz-option *ngFor="let option of dimensionOptions" [nzLabel]="option.name" [nzValue]="option">
-                            </nz-option>
-                        </nz-select>
-                    </div>
-                </div>
-            </div>
-            <div nz-col [nzSpan]="7" class="mb-md">
-                <div nz-form-item class="d-flex">
-                    <div [ngStyle]="{'width': '70px'}" nz-form-label>
-                        <label>��� ���</label>
-                    </div>
-                    <div nz-form-control class="flex-1">
-                        <nz-select name="device" style="width: 100%;" [(ngModel)]="device" nzAllowClear [nzPlaceHolder]="'��������� '+ dimensionItem.label +'(������������������������)'" nzShowSearch
-                            (nzSearchChange)="devicesChange($event)" [nzNotFoundContent]="'������������'">
-                            <nz-option *ngFor="let option of deviceOptions" [nzLabel]="option.name" [nzValue]="option">
-                            </nz-option>
-                        </nz-select>
-                    </div>
-                </div>
-            </div>
-        </div>
-        <div nz-row>
-            <div nz-col [nzSpan]="24" class="text-right">
+            <div nz-col [nzSpan]="2" class="mb-md">
                 <button nz-button [nzType]="'primary'" (click)="loadGrid()">
                     <i class="anticon anticon-search"></i>
                     <span>������</span>
                 </button>
-                <a class="pl-sm" (click)="toggleCollapse()">
-                    ������
-                    <i class="anticon" [class.anticon-down]="isCollapse" [class.anticon-up]="!isCollapse"></i>
-                </a>
             </div>
         </div>
     </form>
@@ -211,6 +159,8 @@
                     </tr>
                 </tbody>
             </nz-table>
+
+            <!--
             <div *ngIf="grid.data.length>0" [ngClass]="{'table-scroll':true,'table-scroll-box-shadow': sensorNameScrollLeft>2 }" style="position: absolute; top:0;">
                 <nz-table #nzTable [nzDataSource]="grid.data" [nzIsPagination]="false">
                     <thead nz-thead>
@@ -234,6 +184,8 @@
                     </tbody>
                 </nz-table>
             </div>
+            -->
+
         </div>
     </div>
 </nz-card>
diff --git a/src/app/routes/reports/query/query.component.ts b/src/app/routes/reports/query/query.component.ts
index 6a3e980..5576114 100644
--- a/src/app/routes/reports/query/query.component.ts
+++ b/src/app/routes/reports/query/query.component.ts
@@ -23,7 +23,7 @@
   styleUrls: ['./query.component.less']
 })
 export class QueryComponent implements OnInit {
-    
+
     // aqi������������
     private aqiSort = {
         e1: 1,
@@ -43,7 +43,7 @@
     // };
     public expandForm: boolean; // ��������� ������������
     // public sensors: any[] = [];
-    public sensorOptions: any[] = [];    
+    public sensorOptions: any[] = [];
     /**
      * ���������������������������������
      * ���������������������������������������������������������������������
@@ -72,7 +72,7 @@
      private _timeType: {showTime: boolean|{[key: string]: Function|boolean}, mode:  'month' | 'day', dateFormat: string  } = {showTime: false, mode: 'day', dateFormat: 'YYYY���MM���DD���'};
      // ���key-value������,������������������
      private _sensors: {[key: string]: string} = {};
-     private _sensorNames: string;     
+     private _sensorNames: string;
      get sensorNames(): string {
          return this._sensorNames;
      }
@@ -85,27 +85,29 @@
             this.reloadChart();
             this.switchSensor(this.chartSelectedIndex);
             // this.chartLoading = false;
-         }        
+         }
          this.isChartCollapse = !this.isChartCollapse;
      }
      public deviceOptions: Device[] = [];
      public dataCondition: DataCondition = {areaRangeId: 320583, areaRange: AreaRange.AREA, deviceDimension: DeviceDimension.NONE};
 
      public dimensionOptions: MonitorPoint[] = [];
-    
+
      get actualYear(): number {
          return this.actualTime.getFullYear();
      }
-     set actualYear(year) { 
+     set actualYear(year) {
          this.actualTime.setFullYear(Number(year));
      }
      dimensionsChange(text?: string) {
-        switch (this.dimensionItem.value) {
-            case DeviceDimension.MONITORPOINT:
-            this.monitorPointsChange(text); break;
-            case DeviceDimension.PROFESSION:
-            this.professionsChange(text); break;
-        }
+        // switch (this.dimensionItem.value) {
+        //     case DeviceDimension.MONITORPOINT:
+        //     this.monitorPointsChange(text); break;
+        //     case DeviceDimension.PROFESSION:
+        //     this.professionsChange(text); break;
+        // }
+
+         this.monitorPointsChange(text);
      }
      professionsChange(text?: string) {
         this.http.get<ResultBean<any[]>>('profession/getall').subscribe(
@@ -146,7 +148,7 @@
      devicesChange(text?: string) {
         if (!!this.deviceDimension) {
             const example = new ExampleService();
-            const deviceDimensionProperty = 
+            const deviceDimensionProperty =
             this.dimensionItem.value === DeviceDimension.MONITORPOINT ? 'monitorPointId' : 'professionId';
             if (!!text) {
             example.or().andEqualTo({ name: deviceDimensionProperty, value: this.deviceDimension.id })
@@ -175,7 +177,7 @@
     public onChartInit(e): void {
         this.echartsIntance = e;
     }
-    constructor(        
+    constructor(
     private http: _HttpClient,
     private sensorsService: SensorsService,
     private deviceService: DeviceService,
@@ -183,13 +185,13 @@
     private monitorPointService: MonitorPointService,
     private msg: NzMessageService,
     private dateService: DateService,
-    ) { }    
-    ngOnInit() { 
+    ) { }
+    ngOnInit() {
         this.initPage();
         // ������������ tree click ������
         this.treeClickStream.debounceTime(1).subscribe( event => {
-            const data = event.node.data;  
-            // console.log(data);    
+            const data = event.node.data;
+            // console.log(data);
             if (data.id === -1) {
                 const children = data.children;
                 // ������������
@@ -220,7 +222,7 @@
                     delete this._sensors [data.id];
                 }
                 const length = Object.keys(this._sensors).length;
-                parentData['halfChecked'] = length > 0 
+                parentData['halfChecked'] = length > 0
                 && this.sensorOptions[0].children.length > length;
                 parentData['checked'] = !parentData['halfChecked'] && length !== 0;
             }
@@ -241,7 +243,7 @@
                         if (res.code === ResultCode.SUCCESS) {
                             const org = res.data;
                             const areas = new Array(3);
-                            if (!!org.areaNames) {                              
+                            if (!!org.areaNames) {
                                 const areaNames = org.areaNames;
                                 Object.keys(areaNames).forEach(
                                     key => {
@@ -257,7 +259,7 @@
                                             }
                                         }
                                     }
-                                );                               
+                                );
                             } else {
                                 for (let i = 0; i < areas.length; i++) {
                                     switch (i) {
@@ -312,8 +314,8 @@
         let isChanged = false;
         isChanged = areas.some( (item , index: number) => {
             // this._areas[index] ���null ������ ������������������
-            return this._areas.length < areas.length 
-            || !this._areas[index] 
+            return this._areas.length < areas.length
+            || !this._areas[index]
             || this._areas[index].value !== item.value;
         });
         if ( isChanged ) {
@@ -350,7 +352,7 @@
      get deviceDimension(): {id: number, name: string} {
          return this._deviceDimension;
      }
-     set deviceDimension(value) {        
+     set deviceDimension(value) {
         if (!!value) {
               // ������ ������������������
              if (this._deviceDimension !== value) {
@@ -364,7 +366,7 @@
              this.device = null;
              this.deviceOptions = null;
         }
-        
+
      }
     // ��������� ������ ������������
     public _device: Device;
@@ -375,15 +377,15 @@
     get device(): Device {
         return this._device;
     }
-   
+
 
     /**
      * ������ ���������������
-     * 
+     *
      * @readonly
      * @type {string}
      * @memberof QueryComponent
-     */  
+     */
     private treeClickStream: Subject<any> = new Subject<any>();
     public onTreeClickSelect(event): void {
           this.treeClickStream.next(event);
@@ -424,13 +426,13 @@
             this._sensorNames = sensorNameList.join(', ');
         }, 1);
     }
-    public setTimeUnit(val: {label: string, value: TimeUnits} ) {       
+    public setTimeUnit(val: {label: string, value: TimeUnits} ) {
         switch (val.value) {
             // YYYY-MM-DD HH:mm:ss
             case TimeUnits.MONTH:
             this._timeType.dateFormat = 'YYYY���';
                 // this._timeType.dateFormat = 'YYYY-MM';
-                // this._timeType.mode = 'month';                
+                // this._timeType.mode = 'month';
                 // this._timeType.endShowTime = null;
                 break;
             case TimeUnits.DAY:
@@ -476,7 +478,7 @@
         }
         return result;
     }
-    public loadGrid(): void {        
+    public loadGrid(): void {
         // ������������
         const sensors = Object.values(this._sensors);
         if ( sensors.length === 0 ) {
@@ -504,18 +506,18 @@
                 this.dataCondition.areaRangeId = item;
                 switch (index) {
                     case 0: this.dataCondition.areaRange = AreaRange.DEVICE; break;
-                    case 1:                   
+                    case 1:
                     // ������������������
                     if (this.dimensionItem.value === DeviceDimension.MONITORPOINT) {
-                         this.dataCondition.areaRange = AreaRange.MONITORPOINT;                        
+                         this.dataCondition.areaRange = AreaRange.MONITORPOINT;
                     // ���������������
                     } else {
                          // ������������������������
                          this.switchAreas();
                          // ���������������������
-                         this.dataCondition.areaRangeId = areasData.slice(-1).pop();                         
+                         this.dataCondition.areaRangeId = areasData.slice(-1).pop();
                     } break;
-                    case 2: 
+                    case 2:
                         this.switchAreas();
                     break;
                 }
@@ -556,9 +558,9 @@
                 return {text: item};
             }
           ); break;
-      }   
+      }
         // ���������������������������������
-        this.tableWidth =  this.grid.columns.length * 80 + 160;   
+        this.tableWidth =  this.grid.columns.length * 80 + 160;
       this.reloadChart();
       // ������������������
       this.reloadChartTitle();
@@ -616,7 +618,7 @@
           }
     }
     private reloadChart(): void {
-        const  timeList = this.grid.columns.map(item => item.text);  
+        const  timeList = this.grid.columns.map(item => item.text);
          if (!!this.echartsIntance) {
              this.chartOption = null;
              this.echartsIntance.clear();
@@ -625,7 +627,7 @@
         //  if ( this.chartSelectedIndex < this.grid.data.length ) {
         //     series = [{type: 'line', data: this.grid.data[this.chartSelectedIndex]}];
         //  }
-         
+
          this.initOpton({ xAxis : [{data : timeList}]});
          this.chartLoading = true;
       }
@@ -685,13 +687,13 @@
         switch ( this.dataCondition.areaRange ) {
             case AreaRange.MONITORPOINT :
             names[0] = '������������';
-            names[1] = this._deviceDimension.name; break;          
+            names[1] = this._deviceDimension.name; break;
             case AreaRange.DEVICE :
             names[0] = '������';
             names[1] = this._device.name; break;
             default :
             names[0] = '';
-            names[1] = this._areas.map( item => item.label).join('/'); 
+            names[1] = this._areas.map( item => item.label).join('/');
             break;
         }
         // ������������
@@ -711,7 +713,7 @@
         names[3] = moment(this.actualTime).format(this._timeType.dateFormat);
         if ( this.grid.data.length > this.chartSelectedIndex) {
             names[4] = this.grid.data[this.chartSelectedIndex].sensor.name;
-        }        
+        }
         const title = names.join('  ') + ' ������';
         if (title.trim() !== this._chartTitleTemp.trim()) {
              this._chartTitleTemp = title;
@@ -723,8 +725,8 @@
     }
     public switchSensor(index: number): void {
         this.chartSelectedIndex = index;
-        this.chartLoading = true; 
-          this.reloadChartTitle();      
+        this.chartLoading = true;
+          this.reloadChartTitle();
         setTimeout(() => {
             const series = [{type: 'line', data: this.grid.data[index].data}];
             this.echartsIntance.setOption({
@@ -738,15 +740,15 @@
                 ],
                 series: series
             });
-           this.chartLoading = false; 
-        }, 600); 
+           this.chartLoading = false;
+        }, 600);
     }
     private getPeriodDate(value: Date , type?: 'start'|'end' ): Date {
         let month = 0;
         let day = 1;
         let hour = 0;
         let minute = 0;
-        let second = 0; 
+        let second = 0;
         let millisecond = 0;
         if ('end' === type) {
             month = 11;
@@ -775,7 +777,7 @@
     public sensorTableFocus(index) {
         this.sensorTableFocusIndex = index;
     }
-   
+
     public sensorTableBlur(index) {
         this.sensorTableFocusIndex = -1;
     }

--
Gitblit v1.8.0