xufenglei
2018-07-24 fd35962de838e033a8964e0959c99572f02b15f0
站点排行 首次加载 选中效果及加载load效果
4 files modified
60 ■■■■■ changed files
src/app/routes/pollution/management/management.component.html 2 ●●● patch | view | raw | blame | history
src/app/routes/pollution/management/management.component.ts 4 ●●● patch | view | raw | blame | history
src/app/routes/reports/query2/query2.component.html 4 ●●●● patch | view | raw | blame | history
src/app/routes/reports/query2/query2.component.ts 50 ●●●●● patch | view | raw | blame | history
src/app/routes/pollution/management/management.component.html
@@ -25,7 +25,7 @@
                        <th nz-th><span>序号</span></th>
                        <th nz-th><span>站点名称</span></th>
                        <th nz-th class="text-right">
                            <span>因子数值 mg/m3</span>
                            <span>因子数值</span>
                            <nz-table-sort (nzValueChange)="sort('sum',$event)"></nz-table-sort>
                        </th>
                    </tr>
src/app/routes/pollution/management/management.component.ts
@@ -23,8 +23,10 @@
  _dataSet = [];
  sensorKey = 'e1';
  ngOnInit() {
    this.changeSensorKey('e1');
    this.changeSensorKey(this.sensorKey);
  }
  changeSensorKey(sensorKey) {
src/app/routes/reports/query2/query2.component.html
@@ -5,7 +5,7 @@
            <ng-template #extra>
                <div class="sales-card-extra">
                    <div class="sales-type-radio">
                        <nz-radio-group [(ngModel)]="sensorKey1" (ngModelChange)="changeSensorKey($event)" [nzSize]="'large'">
                        <nz-radio-group [(ngModel)]="sensorKey" (ngModelChange)="changeSensorKey($event)" [nzSize]="'large'">
                            <label nz-radio-button [nzValue]="'e1'"><span>PM2.5</span></label>
                            <label nz-radio-button [nzValue]="'e2'"><span>PM10</span></label>
                            <label nz-radio-button [nzValue]="'e11'"><span>SO2</span></label>
@@ -19,7 +19,7 @@
            <ng-template #body>
                <h4 class="margin:8px 0 32px 0;">站点排序结果</h4>
                <nz-table #keyTable [nzDataSource]="_dataSet" [nzPageSize]="5" nzSize="small">
                <nz-table #keyTable [nzDataSource]="_dataSet" [nzPageSize]="5" nzSize="small" [nzLoading]="loading">
                    <thead nz-thead>
                    <tr>
                        <th nz-th><span>序号</span></th>
src/app/routes/reports/query2/query2.component.ts
@@ -209,30 +209,42 @@
    private http2: HttpClient
    ) { }
  
  _dataSet = [];
    _dataSet = [];
    sensorKey = 'e1';
    loading = false;
    sensorData = {};
    changeSensorKey(sensorKey) {
      const params = {sensorKey: sensorKey, dimension: 'monitorPoint', regionCode: '320583', accountId: '1', timeType: 'month'};
      this.http2.get(environment.SERVER_BASH_URL + 'screen/region_ranking_data', {params: params}).subscribe((res: any) => {
        this._dataSet = res.data;
      });
      this._dataSet = [];
      if (!!this.sensorData[sensorKey]) {
        this._dataSet = this.sensorData[sensorKey];
      } else {
        this.loading = true;
        const params = {sensorKey: sensorKey, dimension: 'monitorPoint', regionCode: '320583', accountId: '1', timeType: 'month'};
        this.http2.get(environment.SERVER_BASH_URL + 'screen/region_ranking_data', {params: params}).subscribe((res: any) => {
          this._dataSet = this.sensorData[sensorKey] = res.data;
          this.loading = false;
        });
      }
    }
      sort(sortName, sortValue) {
        this._dataSet = [
            ...(<any[]>this._dataSet).sort((a, b) => {
                if (a[sortName] > b[sortName]) {
                    return (sortValue === 'ascend') ? 1 : -1;
                } else if (a[sortName] < b[sortName]) {
                    return (sortValue === 'ascend') ? -1 : 1;
                } else {
                    return 0;
                }
            })
        ];
    sort(sortName, sortValue) {
      this._dataSet = [
        ...(<any[]>this._dataSet).sort((a, b) => {
          if (a[sortName] > b[sortName]) {
            return (sortValue === 'ascend') ? 1 : -1;
          } else if (a[sortName] < b[sortName]) {
            return (sortValue === 'ascend') ? -1 : 1;
          } else {
            return 0;
          }
        })
      ];
    }
    ngOnInit() {
      this.changeSensorKey('e1');
      this.changeSensorKey(this.sensorKey);
//        const searchData = [];
//        for (let i = 0; i < 50; i += 1) {
//            searchData.push({