From c69ddde7828d777f04c6468c269aaa0aa03d72c9 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 02 Aug 2018 09:50:58 +0800 Subject: [PATCH] 文件修改 --- src/app/routes/environment/management/management.component.ts | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/app/routes/environment/management/management.component.ts b/src/app/routes/environment/management/management.component.ts index ab2ee99..eb73346 100644 --- a/src/app/routes/environment/management/management.component.ts +++ b/src/app/routes/environment/management/management.component.ts @@ -1,4 +1,4 @@ -import { environment } from '../../../../environments/environment'; +import { environment } from '@env/environment'; import { Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core'; import { NzMessageService } from 'ng-zorro-antd'; import { _HttpClient } from '@delon/theme'; @@ -6,6 +6,7 @@ import * as moment from 'moment'; import { DeviceService } from '@business/services/http/device.service'; import * as echarts from 'echarts'; +import * as $ from 'jquery'; @Component({ selector: 'environment-management', @@ -14,8 +15,6 @@ providers: [DeviceService] }) export class EnvironmentManagementComponent implements OnInit, OnDestroy { - - offlineChartData: any[] = []; constructor( private deviceService: DeviceService, @@ -37,8 +36,7 @@ data: ['������������', '������������'] }, xAxis: { - type: 'category', - data: [] + type: 'category' }, yAxis: { type: 'value', @@ -46,12 +44,10 @@ }, series: [ { - data: [], type: 'line', smooth: true, name: '������������' }, { - data: [], type: 'line', smooth: true, name: '������������' @@ -62,19 +58,25 @@ ngAfterViewInit() { const PM25 = echarts.init(document.getElementById('PM25')); PM25.showLoading(); - const params = { + const params = { type: 'month', sensors: JSON.stringify(['e1']), items: JSON.stringify([ {areaCode: 320583, formatTime: moment().format('YYYY-MM')}, {areaCode: 320583, formatTime: moment().subtract(1, 'M').format('YYYY-MM')} - ]) + ]) }; this.http2.get(environment.SERVER_BASH_URL + 'report/compare', {params: params}).subscribe((res: any) => { - this.option.xAxis.data = res.data.times; - this.option.series[0].data = res.data.datas[0]['e1']; - this.option.series[1].data = res.data.datas[1]['e1']; - PM25.setOption(this.option, false); + const PM25Option = $.extend(true, + { + xAxis: {data: res.data.times}, + series: [ + {data: res.data.datas[0]['e1']}, + {data: res.data.datas[1]['e1']} + ] + }, + this.option); + PM25.setOption(PM25Option, false); window.onresize = PM25.resize; PM25.hideLoading(); }); -- Gitblit v1.8.0