| | |
| | | import { environment } from '../../../../environments/environment'; |
| | | import { HttpClient } from '@angular/common/http'; |
| | | import { Component, OnInit, ViewChild } from '@angular/core'; |
| | | import { _HttpClient } from '@delon/theme'; |
| | | import { Sensor, Device, DataCondition, MonitorPoint, Organization, LineChartCriteria } from '@business/entity/data'; |
| | |
| | | private monitorPointService: MonitorPointService, |
| | | private msg: NzMessageService, |
| | | private dateService: DateService, |
| | | private http2: HttpClient |
| | | ) { } |
| | | ngOnInit() { |
| | | const searchData = []; |
| | | for (let i = 0; i < 50; i += 1) { |
| | | searchData.push({ |
| | | index: i + 1, |
| | | point: `监测站点-${i}`, |
| | | value: Math.floor(Math.random() * 100) |
| | | |
| | | _dataSet = []; |
| | | |
| | | 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; |
| | | }); |
| | | } |
| | | 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; |
| | | } |
| | | }) |
| | | ]; |
| | | } |
| | | |
| | | this.data = { |
| | | searchData: searchData |
| | | }; |
| | | ngOnInit() { |
| | | this.changeSensorKey('e1'); |
| | | // const searchData = []; |
| | | // for (let i = 0; i < 50; i += 1) { |
| | | // searchData.push({ |
| | | // index: i + 1, |
| | | // point: `监测站点-${i}`, |
| | | // value: Math.floor(Math.random() * 100) |
| | | // }); |
| | | // } |
| | | // |
| | | // this.data = { |
| | | // searchData: searchData |
| | | // }; |
| | | |
| | | this.initPage(); |
| | | // 监测项目 tree click 事件 |
| | |
| | | public loadGrid(): void { |
| | | // 数据检查 |
| | | const sensors = Object.values(this._sensors); |
| | | debugger; |
| | | if ( sensors.length === 0 ) { |
| | | this.msg.error(' 监测项目 不能为空'); |
| | | return ; |
| | |
| | | } |
| | | |
| | | |
| | | sort(sortName, sortValue) { |
| | | this.data.searchData = [ |
| | | ...(<any[]>this.data.searchData).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; |
| | | } |
| | | }) |
| | | ]; |
| | | } |
| | | } |
| | | |
| | | |