From 309d1f9d649daa08bb9b068af014749f6d4a5bce Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Fri, 06 Jul 2018 14:00:45 +0800 Subject: [PATCH] 设备和监控点父页面 筛选条件不予 编辑页面联动 --- src/app/routes/reports/alarm/alarm.component.ts | 59 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/app/routes/reports/alarm/alarm.component.ts b/src/app/routes/reports/alarm/alarm.component.ts index 52bf05e..d337dd7 100644 --- a/src/app/routes/reports/alarm/alarm.component.ts +++ b/src/app/routes/reports/alarm/alarm.component.ts @@ -1,12 +1,13 @@ -import {DateService} from "../../../business/services/util/date.service"; -import {HttpClient} from "@angular/common/http"; +import {DateService} from '../../../business/services/util/date.service'; +import {HttpClient} from '@angular/common/http'; import {Component, OnInit} from '@angular/core'; import {_HttpClient} from '@delon/theme'; -import {Subject} from "rxjs"; +// tslint:disable-next-line:import-blacklist +import {Subject} from 'rxjs'; import {CascaderOption} from 'ng-zorro-antd/src/cascader/nz-cascader.component'; import {AreacodeService} from '@business/services/http/areacode.service'; import {NzTreeComponent} from 'ng-tree-antd'; -import {NzMessageService} from "ng-zorro-antd"; +import {NzMessageService} from 'ng-zorro-antd'; import {environment} from '../../../../environments/environment'; import * as echarts from 'echarts'; import * as $ from 'jquery'; @@ -42,9 +43,9 @@ ]; public dimensionOptions = [ {value: 'sensor', label: '������'}, - {value: 'monitorPoint', label: '���������'} + {value: 'monitorPoint', label: '������������'} ]; - isDisable: boolean = false; + isDisable = false; private treeClickStream: Subject<any> = new Subject<any>(); private _sensors: {[key: string]: string} = {}; private _sensorNames: string; @@ -59,7 +60,7 @@ }, tooltip: { trigger: 'item', - formatter: "{a} <br/>{b}: {c} ({d}%)" + formatter: '{a} <br/>{b}: {c} ({d}%)' }, // legend: { // //x : 'center', @@ -74,7 +75,7 @@ radius: ['20%', '40%'], label: { normal: { - formatter: "{b}:{d}%" + formatter: '{b}:{d}%' } }, labelLine: { @@ -83,7 +84,7 @@ } }, data: [] - } + }; ngOnInit() { this.http.get(environment.SERVER_BASH_URL + 'sensor/all').subscribe((res: any) => { @@ -96,9 +97,9 @@ } dimensionChange(value) { - if (value == 'sensor') { - this.isDisable = false; - } else { + if (value === 'sensor') { + this.isDisable = false; + } else { this.isDisable = true; this.query.monitorPointId = null; this.query.mac = null; @@ -226,7 +227,7 @@ $('#mydiv').empty(); for (let index = 0; index < 30; index++) { this.sensorArr.push(index); - $('#mydiv').append("<div id='mydiv" + index + "' style='height: 485.35px; width: 1000px'></div>"); + $('#mydiv').append('<div id=\'mydiv' + index + '\' style=\'height: 485.35px; width: 1000px\'></div>'); } this.loading = true; this.isShow = false; @@ -245,17 +246,17 @@ this.http.get(environment.SERVER_BASH_URL + 'report/pie', {params: query}).subscribe((res: any) => { const option = this.pieCharOption; let index = 0; - if (query.dimension == 'monitorPoint') { + if (query.dimension === 'monitorPoint') { for (const key in res.data) { let name: string; this.sensorOptions[0].children.forEach(sensor => { - if (key == sensor.sensorKey) { + if (key === sensor.sensorKey) { name = sensor.name; } }); option.title.text = name + '������������������������'; - if (index % 2 == 0) { + if (index % 2 === 0) { option.backgroundColor = 'rgba(0,0,0,0)'; } else { option.backgroundColor = 'rgba(23,133,23,0.06)'; @@ -270,18 +271,20 @@ myChart.setOption(option, true); window.onresize = myChart.resize; index = index + 1; - } - } else { - option.title.text = '������������������������'; + } + } else { option.series = []; - this.serie.data = res.data.list; - option.series.push(this.serie); - const myChart = echarts.init(document.getElementById('mydiv' + index)); - myChart.setOption(option, true); - window.onresize = myChart.resize; - index = index + 1; + if (!!res.data.list && res.data.list.length > 0) { + option.title.text = '������������������������'; + this.serie.data = res.data.list; + option.series.push(this.serie); + const myChart = echarts.init(document.getElementById('mydiv' + index)); + myChart.setOption(option, true); + window.onresize = myChart.resize; + index = index + 1; + } - //this.setOption(option,index); + // this.setOption(option,index); } this.sensorArr.forEach(i => { @@ -294,11 +297,11 @@ }); } else { - this.msgSrv.error('������������������������'); + this.msgSrv.error('���������������������������'); } } - setOption(option,index) { + setOption(option, index) { const myChart = echarts.init(document.getElementById('mydiv' + index)); myChart.setOption(this.pieCharOption, true); window.onresize = myChart.resize; -- Gitblit v1.8.0