| | |
| | | <div class="clear_fix"></div>
|
| | | </div>
|
| | | </div>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <div class="content">
|
| | | <div *ngFor="let item of items;let i = index">
|
| | | <div class="{{i % 2 == 0 ? 'left' : 'right'}}">
|
| | |
| | | <div *ngFor="let i of sensorArr">
|
| | | <div id="mydiv{{i}}" style="height: 485.35px; width: 1000px"></div>
|
| | | </div>
|
| | | <!-- <div id="pieChar" style="height: 485.35px; width: 1000px"></div> -->
|
| | | <div id="pieChar" style="height: 485.35px; width: 1000px"></div>
|
| | | </div>
|
| | |
|
| | | <div class="bg" *ngIf="!spinning">
|
| | |
| | | |
| | | }) |
| | | export class ReportComponent implements OnInit { |
| | | constructor( |
| | | public injector: Injector, |
| | | public http: HttpClient, |
| | | public msgSrv: NzMessageService |
| | | ) { |
| | | for (let index = 0; index < 30; index++) { |
| | | this.sensorArr.push(index); |
| | | } |
| | | } |
| | | |
| | | [x: string]: any; |
| | | |
| | | public spinning = true; |
| | |
| | | bottom: 20, |
| | | type: 'scroll' |
| | | }, |
| | | toolbox: { |
| | | show: false, |
| | | feature: { |
| | | dataZoom: { |
| | | yAxisIndex: 'none' |
| | | }, |
| | | dataView: {readOnly: false}, |
| | | magicType: {type: ['line', 'bar']}, |
| | | restore: {}, |
| | | saveAsImage: {} |
| | | } |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | // boundaryGap: false, |
| | |
| | | public title: string; |
| | | private timeArr = ['年', '月', '日', '时', '分']; |
| | | public typeArr = ['year', 'month', 'day', 'hour']; |
| | | constructor( |
| | | public injector: Injector, |
| | | public http: HttpClient, |
| | | public msgSrv: NzMessageService |
| | | ) { |
| | | for (let index = 0; index < 30; index++) { |
| | | this.sensorArr.push(index); |
| | | } |
| | | } |
| | | public sensorKeys: any = [ |
| | | {key: 'e1', name: 'PM 2.5'}, |
| | | {key: 'e2', name: 'PM 10'}, |
| | | {key: 'e10', name: '一氧化碳(CO)'}, |
| | | {key: 'e11', name: '二氧化硫(SO₂)'}, |
| | | {key: 'e15', name: '臭氧(O₃)'}, |
| | | {key: 'e16', name: '二氧化氮(NO₂)'} |
| | | ]; |
| | | |
| | | private pieCharOption: any = { |
| | | title: { |
| | |
| | | legend: { |
| | | // x : 'center', |
| | | top: '10%', |
| | | data: ['PM 2.5', 'PM 10', '一氧化碳(CO)', '二氧化硫(SO₂)', '臭氧(O₃)', '二氧化氮(NO₂)'] |
| | | data: [] |
| | | }, |
| | | graphic: [{ |
| | | type: 'text', |
| | | left: '24%', |
| | | top: '49%', |
| | | style: { |
| | | text: '大华涂料' |
| | | } |
| | | }, { |
| | | type: 'text', |
| | | left: '74%', |
| | | top: '49%', |
| | | style: { |
| | | text: '{b}' |
| | | } |
| | | } |
| | | ], |
| | | series: [ |
| | | { |
| | | name: '访问来源', |
| | | type: 'pie', |
| | | radius: ['30%', '50%'], |
| | | center: ['25%', '50%'], |
| | | label: { |
| | | normal: { |
| | | formatter: '{b}:{d}%' |
| | | } |
| | | }, |
| | | labelLine: { |
| | | normal: { |
| | | show: true |
| | | } |
| | | }, |
| | | data: [ |
| | | {value: 100, name: 'PM 2.5'}, |
| | | {value: 100, name: 'PM 10'}, |
| | | {value: 200, name: '一氧化碳(CO)'}, |
| | | {value: 200, name: '二氧化硫(SO₂)'}, |
| | | {value: 100, name: '臭氧(O₃)'}, |
| | | {value: 100, name: '二氧化氮(NO₂)'} |
| | | ] |
| | | }, |
| | | { |
| | | name: '访问来源', |
| | | type: 'pie', |
| | | radius: ['30%', '50%'], |
| | | center: ['75%', '50%'], |
| | | label: { |
| | | normal: { |
| | | formatter: '{b}:{d}%', |
| | | } |
| | | }, |
| | | labelLine: { |
| | | normal: { |
| | | show: true, |
| | | } |
| | | }, |
| | | data: [ |
| | | {value: 0, name: 'PM 2.5'}, |
| | | {value: 0, name: 'PM 10'}, |
| | | {value: 100, name: '一氧化碳(CO)'}, |
| | | {value: 100, name: '二氧化硫(SO₂)'}, |
| | | {value: 100, name: '臭氧(O₃)'}, |
| | | {value: 100, name: '二氧化氮(NO₂)'} |
| | | |
| | | ] |
| | | } |
| | | ] |
| | | graphic: [], |
| | | series: [] |
| | | }; |
| | | |
| | | ngOnInit() { |
| | |
| | | for (let i = 0; i < items.length; i++) { |
| | | this.title = items[i].formatTime; |
| | | items[i].deviceCount = deviceCounts[i]; |
| | | if (!items[i].monitorPointid) { |
| | | if (!(items[i].monitorPointId)) { |
| | | items[i].monitorPointName = items[i].areaName; |
| | | } |
| | | const legendName = items[i].formatTime + label + (items[i].mac ? '设备:' + items[i].deviceName : (items[i].monitorPointid ? '监测点:' + items[i].monitorPointName : items[i].areaName)); |
| | | option.legend.data[i] = legendName; |
| | | const legendName = items[i].formatTime + label + |
| | | (items[i].mac ? '设备:' + items[i].deviceName : (items[i].monitorPointId ? '监测点:' + items[i].monitorPointName : items[i].areaName)); |
| | | items[i].legendName = option.legend.data[i] = legendName; |
| | | option.series.push({ |
| | | name: legendName, |
| | | data: res.data.datas[i][sensorKey], |
| | |
| | | for (let i = 0; i < title.length; i++) { |
| | | this.title += title[i] + timeArr[i]; |
| | | } |
| | | if (sensors.length % 2 == 0) { |
| | | this.pieCharOption.backgroundColor = 'rgba(0,0,0,0)'; |
| | | |
| | | if ((params.type == 'month' || params.type == 'year') && res.data.sortList.length > 0) { |
| | | let center = ['50%', '50%']; |
| | | let left = '40%'; |
| | | const length = items.length; |
| | | const alarmDatas = res.data.alarmDatas; |
| | | for (let i = 0; i < length; i++) { |
| | | this.pieCharOption.legend.data = []; |
| | | let data = []; |
| | | this.sensorKeys.forEach(sensorKey => { |
| | | this.pieCharOption.legend.data.push(sensorKey.name); |
| | | if (alarmDatas[i]) { |
| | | data.push({ |
| | | name: sensorKey.name, |
| | | value: alarmDatas[i][sensorKey.key] |
| | | }); |
| | | } |
| | | }); |
| | | if (length == 2) { |
| | | if (i == 0) { |
| | | center = ['25%', '50%']; |
| | | left = '15%'; |
| | | } else { |
| | | center = ['75%', '50%']; |
| | | left = '65%'; |
| | | } |
| | | } |
| | | this.pieCharOption.series.push({ |
| | | name: items[i].monitorPointName, |
| | | type: 'pie', |
| | | radius: ['20%', '40%'], |
| | | center: center, |
| | | label: { |
| | | normal: { |
| | | formatter: "{b}:{d}%" |
| | | } |
| | | }, |
| | | labelLine: { |
| | | normal: { |
| | | show: true |
| | | } |
| | | }, |
| | | data: data |
| | | }); |
| | | this.pieCharOption.graphic.push({ |
| | | type: 'text', |
| | | left: left, |
| | | top: '20%', |
| | | style: { |
| | | text: items[i].legendName |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (sensors.length % 2 == 0) { |
| | | this.pieCharOption.backgroundColor = 'rgba(0,0,0,0)'; |
| | | } else { |
| | | this.pieCharOption.backgroundColor = 'rgba(23,133,23,0.06)'; |
| | | } |
| | | const myChart = echarts.init(document.getElementById('pieChar')); |
| | | myChart.setOption(this.pieCharOption, true); |
| | | window.onresize = myChart.resize; |
| | | } else { |
| | | this.pieCharOption.backgroundColor = 'rgba(23,133,23,0.06)'; |
| | | $('#pieChar').remove(); |
| | | } |
| | | // const myChart = echarts.init(document.getElementById('pieChar')); |
| | | // myChart.setOption(this.pieCharOption, true); |
| | | // window.onresize = myChart.resize; |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | <!-- <nz-select [nzMode]="'multiple'" [(ngModel)]="query.sensorKeys" name="sensorKeys" [nzSize]="'large'" [nzPlaceHolder]="'请选择'"> |
| | | <nz-option *ngFor="let option of sensorOptions" [nzLabel]="option.name" [nzValue]="option.sensorKey + '-' + option.name + '-' + option.unit"></nz-option> |
| | | </nz-select> --> |
| | | <nz-popover [nzPlacement]="'bottomLeft'" [nzTrigger]="'hover'"> |
| | | <nz-popover [nzPlacement]="'bottomLeft'" [nzTrigger]="'click'"> |
| | | <nz-input [nzType]="'input'" nz-popover [ngModel]="sensorNames" name="sensorKeys" [nzReadonly]="true" [nzPlaceHolder]="'请选择 项目'"> |
| | | <ng-template #suffix> |
| | | <i class="anticon anticon-down ant-cascader-picker-arrow "></i> |
| | | <i class="anticon anticon-down ant-cascader-picker-arrow" style="right: 1px;"></i> |
| | | </ng-template> |
| | | </nz-input> |
| | | <ng-template #nzTemplate> |
| | |
| | | } |
| | | } |
| | | if (validate && this.timeType && query.reportType) { |
| | | delete query.sensors; |
| | | if (this._sensors) { |
| | | const sensors = []; |
| | | for (const key in this._sensors) { |
| | |
| | | <label>项目</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-popover [nzPlacement]="'bottomLeft'" [nzTrigger]="'hover'"> |
| | | <nz-popover [nzPlacement]="'bottomLeft'" [nzTrigger]="'click'"> |
| | | <nz-input [nzType]="'input'" nz-popover [ngModel]="sensorNames" name="sensorKeys" [nzReadonly]="true" [nzPlaceHolder]="'请选择 项目'"> |
| | | <ng-template #suffix> |
| | | <i class="anticon anticon-down ant-cascader-picker-arrow "></i> |
| | | <i class="anticon anticon-down ant-cascader-picker-arrow" style="right: 1px;"></i> |
| | | </ng-template> |
| | | </nz-input> |
| | | <ng-template #nzTemplate> |
| | |
| | | query.timeb = this.dateSrv.date_format(query.timeb, this.timeType.format); |
| | | } |
| | | query.type = this.timeType.value; |
| | | delete query.sensors; |
| | | if (this._sensors) { |
| | | const sensors = []; |
| | | for (const key in this._sensors) { |