Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop
2 files added
10 files modified
| | |
| | | <div class="t_bg">
|
| | | <img src="./assets/img/logo.png">
|
| | |
|
| | | <h1>{{title}}昆山环境监测报告</h1>
|
| | | <h1>{{title}}环境监测报告</h1>
|
| | | <div class="container">
|
| | | <div class="title">
|
| | | <div class="title_left"></div>
|
| | |
| | | </div>
|
| | | </div>
|
| | |
|
| | | |
| | | |
| | | |
| | | |
| | | <div class="content">
|
| | | <div *ngFor="let item of items;let i = index">
|
| | | <div class="{{i % 2 == 0 ? 'left' : 'right'}}">
|
| | |
| | | <div class="text_t_right"></div>
|
| | | <div class="clear_fix"></div>
|
| | | </div>
|
| | | <p class="text1">公司地址:{{item.monitorPointAddress}}</p>
|
| | | <p class="text1">该公司拥有设备{{item.deviceCount}}台</p>
|
| | | <p *ngIf="item.monitorPointId" class="text1">公司地址:{{item.monitorPointAddress}}</p>
|
| | | <p class="text1">拥有监测设备{{item.deviceCount}}台</p>
|
| | | <div class="clear_fix"></div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | <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>
|
| | |
|
| | | <div class="bg" *ngIf="!spinning">
|
| | |
| | | import {NzMessageService, NzModalService} from 'ng-zorro-antd'; |
| | | import {Component, OnInit, Injector} from '@angular/core'; |
| | | import {HttpClient} from '@angular/common/http'; |
| | | import {ActivatedRoute} from '@angular/router'; |
| | | import * as echarts from 'echarts'; |
| | | import * as $ from 'jquery'; |
| | | |
| | |
| | | constructor( |
| | | public injector: Injector, |
| | | public http: HttpClient, |
| | | public activeRoute: ActivatedRoute, |
| | | public msgSrv: NzMessageService |
| | | ) { |
| | | for (let index = 0; index < 30; index++) { |
| | |
| | | } |
| | | } |
| | | |
| | | private pieCharOption: any = { |
| | | title: { |
| | | text: 'AQI指标报警占比情况', |
| | | x: 'center' |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item', |
| | | formatter: "{a} <br/>{b}: {c} ({d}%)" |
| | | }, |
| | | legend: { |
| | | //x : 'center', |
| | | top: '10%', |
| | | data: ['PM 2.5', 'PM 10', '一氧化碳(CO)', '二氧化硫(SO₂)', '臭氧(O₃)', '二氧化氮(NO₂)'] |
| | | }, |
| | | 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₂)'} |
| | | |
| | | ] |
| | | } |
| | | ] |
| | | }; |
| | | |
| | | ngOnInit() { |
| | | this.activeRoute.queryParams.subscribe(params => { |
| | | const params = JSON.parse(sessionStorage.getItem("queryParams")); |
| | | if (!!params) { |
| | | localStorage.removeItem("queryParams"); |
| | | const items = this.items = JSON.parse(params.items); |
| | | const timeType = params.type; |
| | | this.http.get(environment.SERVER_BASH_URL + 'report/compare', {params: params}).subscribe((res: any) => { |
| | |
| | | } else { |
| | | const option = this.echartOption; |
| | | const sensors = res.data.sensors; |
| | | const deviceCounts = res.data.deviceCounts; |
| | | const timeArr = this.timeArr; |
| | | const label = timeArr[this.typeArr.indexOf(timeType)]; |
| | | option.xAxis.data = res.data.times; |
| | |
| | | } |
| | | for (let i = 0; i < items.length; i++) { |
| | | this.title = items[i].formatTime; |
| | | const legendName = items[i].formatTime + label + (items[i].mac ? items[i].deviceName : items[i].monitorPointName); |
| | | items[i].deviceCount = deviceCounts[i]; |
| | | 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; |
| | | option.series.push({ |
| | | name: legendName, |
| | | data: res.data.datas[i]['data' + i][0][sensorKey], |
| | | data: res.data.datas[i][sensorKey], |
| | | type: params.reportType, |
| | | smooth: true, |
| | | itemStyle: { |
| | |
| | | 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)'; |
| | | } 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.msgSrv.error("页面错误,将关闭该页面!"); |
| | | setTimeout("window.close();", 1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | <nz-card [nzBordered]="false"> |
| | | <form nz-form (ngSubmit)="reportQuery()" [nzLayout]="'inline'"> |
| | | <div nz-row [nzGutter]="24"> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label> 项 目</label> |
| | | <label> 项 目</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [nzMode]="'multiple'" [(ngModel)]="query.sensorKey" name="sensorKey" [nzSize]="'large'" [nzPlaceHolder]="'请选择'"> |
| | | <!-- <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-select> --> |
| | | <nz-popover [nzPlacement]="'bottomLeft'" [nzTrigger]="'hover'"> |
| | | <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> |
| | | </ng-template> |
| | | </nz-input> |
| | | <ng-template #nzTemplate> |
| | | <div [ngStyle]="{'width': '240px', 'height': '240px', 'overflow-y' :'auto'}"> |
| | | <nz-tree [nzNodes]="sensorOptions" (nzActivate)="onTreeClickSelect($event)" (nzDeactivate)="onTreeClickSelect($event)" [nzCheckable]="true" (nzCheck)="onSensorSelect($event)"></nz-tree> |
| | | </div> |
| | | </ng-template> |
| | | </nz-popover> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label nz-form-item-required>类型</label> |
| | | <label nz-form-item-required>类 型</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="timeType" name="timeType" [nzSize]="'large'" [nzPlaceHolder]="'请选择'"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label nz-form-item-required>图型</label> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md" *ngIf="items.length < 2"> |
| | | <div nz-col [nzSpan]="5" class="mb-md" *ngIf="items.length < 2"> |
| | | <button nz-button type="button" [nzType]="'primary'" [nzSize]="'large'" (click)="addItem()"> |
| | | <!-- <i class="anticon anticon-plus"></i> --> |
| | | <i class="anticon anticon-plus-circle-o"></i> |
| | |
| | | </div> |
| | | |
| | | <div nz-row [nzGutter]="24" *ngFor="let item of items;let i = index"> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label nz-form-item-required>监测点</label> |
| | | <label nz-form-item-required>省市区</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="item.monitorPoint" name="monitorPoint{{item.id}}" nzAllowClear [nzPlaceHolder]="'请输入'" [nzFilter]="false" [nzSize]="'large'" |
| | | (nzSearchChange)="searchChange($event,i)" [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointChange($event,i)" nzShowSearch> |
| | | <nz-option *ngFor="let option of monitorPointOptions" [nzLabel]="option['name']" [nzValue]="option"> </nz-option> |
| | | <nz-cascader (nzLoad)="areaLazyLoad($event,i)" [nzPlaceHolder]="'请选择 省/市/区'" [nzAllowClear]="false" [nzChangeOnSelect]="true" (nzSelect)="regionChange($event,i)"> |
| | | </nz-cascader> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label>监测点</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="item.monitorPoint" name="monitorPoint{{item.id}}" [nzPlaceHolder]="'请选择 监测点'" [nzSize]="'large'" |
| | | [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointChange($event,i)" nzShowSearch nzAllowClear> |
| | | <nz-option *ngFor="let option of item.monitorPointOptions" [nzLabel]="option['name']" [nzValue]="option"> </nz-option> |
| | | </nz-select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label> 设备</label> |
| | | <label> 设 备</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="item.device" name="mac{{item.id}}" [nzSize]="'large'" nzAllowClear [nzPlaceHolder]="'请选择'"> |
| | | <nz-select [(ngModel)]="item.device" name="mac{{item.id}}" [nzSize]="'large'" [nzPlaceHolder]="'请选择 设备'" [nzNotFoundContent]="'无法找到'" nzShowSearch nzAllowClear> |
| | | <nz-option *ngFor="let option of item.deviceOptions" [nzLabel]="option.name" [nzValue]="option" ></nz-option> |
| | | </nz-select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-col [nzSpan]="5" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label nz-form-item-required>时间</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="item.time" name="time{{item.id}}" [nzPlaceHolder]="'请选择'" [nzFormat]="timeType.format" [nzDisabledDate]="_disabledDate" |
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="item.time" name="time{{item.id}}" [nzPlaceHolder]="'请选择 时间'" [nzFormat]="timeType.format" [nzDisabledDate]="_disabledDate" |
| | | [nzMode]="timeType.value=='hour'||timeType.value=='day'?'day':'month'" [nzShowTime]="timeType.value=='hour'?true:false" [nzSize]="'large'"></nz-datepicker> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md" *ngIf="items.length > 1"> |
| | | <div nz-col [nzSpan]="4" class="mb-md" *ngIf="items.length > 1"> |
| | | <button nz-button type="button" [nzType]="'danger'" [nzSize]="'large'" (click)="items.splice(i, 1)"> |
| | | <i class="anticon anticon-minus-circle-o dynamic-delete-button"></i> |
| | | <span>删除查询条目</span> |
| | |
| | | |
| | | <div nz-row [nzGutter]="24"> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <button nz-button type="submit" [nzType]="'primary'" [nzSize]="'large'">查询</button> |
| | | <button nz-button type="submit" [nzType]="'primary'" [nzSize]="'large'"> |
| | | <a target="_blank" [routerLink]="['/report']" (click)="reportQuery()">查询</a> |
| | | </button> |
| | | <!-- <button nz-button type="reset" [nzSize]="'large'" class="mx-sm" (click)="load()">重置</button> --> |
| | | </div> |
| | | </div> |
| | |
| | | import {NzMessageService} from 'ng-zorro-antd'; |
| | | import {Component, OnInit} from '@angular/core'; |
| | | import {HttpClient} from '@angular/common/http'; |
| | | import {Router} from '@angular/router'; |
| | | 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 {Subject} from 'rxjs/Subject'; |
| | | |
| | | @Component({ |
| | | selector: 'app-demo', |
| | |
| | | {value: 'bar', label: '柱状图'}, |
| | | {value: 'line', label: '折线图'} |
| | | ]; |
| | | public monitorPointOptions = []; |
| | | public items = [{ |
| | | |
| | | public items: any[] = [{ |
| | | id: 0, |
| | | monitorPoint: null, |
| | | device: null, |
| | | time: null, |
| | | monitorPointOptions: [], |
| | | deviceOptions: [] |
| | | }]; |
| | | |
| | | private treeClickStream: Subject<any> = new Subject<any>(); |
| | | private _sensors: {[key: string]: string} = {}; |
| | | private _sensorNames: string; |
| | | get sensorNames(): string { |
| | | return this._sensorNames; |
| | | } |
| | | |
| | | constructor( |
| | | public http: HttpClient, |
| | | public dateSrv: DateService, |
| | | public router: Router, |
| | | private areacodeService: AreacodeService, |
| | | public msgSrv: NzMessageService |
| | | ) { |
| | | this.timeType = this.typeOptions[1]; |
| | |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.sensorOptions = res.data; |
| | | this.sensorOptions.push({id: -1, name: '全部', isExpanded: true, children: res.data}); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | public onTreeClickSelect(event): void { |
| | | this.treeClickStream.next(event); |
| | | } |
| | | |
| | | public onSensorSelect(event): void { |
| | | const data = event.node.data; |
| | | if (data.id === -1 && data.halfChecked === false) { |
| | | if (!!data.checked) { |
| | | this.sensorOptions[0].children.forEach( |
| | | sensor => { |
| | | this._sensors[sensor.id] = sensor.sensorKey + '-' + sensor.name + '-' + sensor.unit; |
| | | } |
| | | ); |
| | | } else { |
| | | this._sensors = {}; |
| | | } |
| | | } else { |
| | | if (!!data.checked) { |
| | | this._sensors[data.id] = data.sensorKey + '-' + data.name + '-' + data.unit; |
| | | } else { |
| | | delete this._sensors[data.id]; |
| | | } |
| | | } |
| | | this.reloadSensorNames(); |
| | | |
| | | } |
| | | private reloadSensorNames(): void { |
| | | // 异步提升展现速度 |
| | | setTimeout(() => { |
| | | this._sensorNames = ''; |
| | | const sensorNameList = Object.keys(this._sensors).map( |
| | | id => { |
| | | const sensor = this.sensorOptions[0].children.find(item => { |
| | | return Number(id) === Number(item.id); |
| | | }); |
| | | return sensor.name; |
| | | } |
| | | ); |
| | | this._sensorNames = sensorNameList.join(', '); |
| | | }, 1); |
| | | } |
| | | |
| | | addItem() { |
| | |
| | | monitorPoint: null, |
| | | device: null, |
| | | time: null, |
| | | monitorPointOptions: [], |
| | | deviceOptions: [] |
| | | }); |
| | | } |
| | | |
| | | searchChange(searchText, i) { |
| | | if (searchText) { |
| | | const query = encodeURI(searchText); |
| | | if (query) { |
| | | this.http.get(environment.SERVER_BASH_URL + '/monitor-point/list/' + query).subscribe((res: any) => { |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.monitorPointOptions = res.data; |
| | | public areaLazyLoad(event: {option: CascaderOption, index: number, resolve: (children: CascaderOption[]) => void, reject: () => void}) { |
| | | const index = event['index']; |
| | | const option = event.option; |
| | | switch (index) { |
| | | case -1: |
| | | this.areacodeService.getProvinces().subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve(res); |
| | | } |
| | | }); |
| | | } |
| | | ); break; |
| | | case 0: |
| | | this.areacodeService.getCities(option.value).subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve(res); |
| | | } |
| | | ); break; |
| | | case 1: |
| | | this.areacodeService.getAreas(option.value).subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve(res); |
| | | } |
| | | ); break; |
| | | } |
| | | } |
| | | |
| | | public regionChange(event: {option: CascaderOption, index: number}, i) { |
| | | let name = ''; |
| | | let areaName = ''; |
| | | const option = event.option; |
| | | this.items[i].monitorPoint = null; |
| | | this.items[i].areaCode = null; |
| | | this.items[i].device = null; |
| | | |
| | | switch (event.index) { |
| | | case 0: |
| | | name = 'provinceCode'; |
| | | this.items[i].provinceCode = option.value; |
| | | this.items[i].cityCode = null; |
| | | areaName = option.label; |
| | | break; |
| | | case 1: |
| | | name = 'cityCode'; |
| | | this.items[i].cityCode = option.value; |
| | | areaName = option.parent.label + '/' + option.label; |
| | | break; |
| | | case 2: |
| | | name = 'areaCode'; |
| | | this.items[i].areaCode = option.value; |
| | | areaName = option.parent.parent.label + '/' + option.parent.label + '/' + option.label; |
| | | break; |
| | | } |
| | | this.items[i].areaName = areaName; |
| | | this.http.get(environment.SERVER_BASH_URL + 'monitor-point/list/region', {params: {name: name, value: option.value}}).subscribe((res: any) => { |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.items[i].monitorPointOptions = res.data; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | monitorPointChange(value, i) { |
| | |
| | | let validate = true; |
| | | const queryItems = []; |
| | | for (let i = 0; i < this.items.length; i++) { |
| | | let areaName = ''; |
| | | let item = this.items[i]; |
| | | let queryItem: any = {}; |
| | | if (item.monitorPoint && item.time) { |
| | | if ((!!item.time) && (item.monitorPointOptions.length > 0)) { |
| | | for (var key in item) { |
| | | if (item[key]) { |
| | | queryItem[key] = item[key]; |
| | | } |
| | | } |
| | | queryItem.monitorPointId = queryItem.monitorPoint.id; |
| | | queryItem.monitorPointName = queryItem.monitorPoint.name; |
| | | queryItem.monitorPointAddress = queryItem.monitorPoint.address; |
| | | delete queryItem.monitorPoint; |
| | | if (queryItem.monitorPoint) { |
| | | queryItem.monitorPointId = queryItem.monitorPoint.id; |
| | | queryItem.monitorPointName = queryItem.monitorPoint.name; |
| | | queryItem.monitorPointAddress = queryItem.monitorPoint.address; |
| | | delete queryItem.monitorPoint; |
| | | } |
| | | delete queryItem.monitorPointOptions; |
| | | if (queryItem.device) { |
| | | queryItem.mac = queryItem.device.mac; |
| | | queryItem.deviceName = queryItem.device.name; |
| | | delete queryItem.device; |
| | | } |
| | | queryItem.deviceCount = queryItem.deviceOptions.length; |
| | | if (queryItem.deviceOptions && queryItem.deviceOptions.length > 0) { |
| | | queryItem.deviceCount = queryItem.deviceOptions.length; |
| | | } |
| | | delete queryItem.deviceOptions; |
| | | queryItem.formatTime = this.dateSrv.date_format(queryItem.time, this.timeType.format); |
| | | delete queryItem.time; |
| | |
| | | } |
| | | } |
| | | if (validate && this.timeType && query.reportType) { |
| | | if (query.sensorKey && query.sensorKey.length > 0) { |
| | | query.sensors = JSON.stringify(query.sensorKey); |
| | | if (this._sensors) { |
| | | const sensors = []; |
| | | for (var key in this._sensors) { |
| | | sensors.push(this._sensors[key]); |
| | | } |
| | | if (sensors.length > 0) { |
| | | query.sensors = JSON.stringify(sensors); |
| | | } |
| | | } |
| | | query.items = JSON.stringify(queryItems); |
| | | query.type = this.timeType.value; |
| | | this.router.navigate(['report'], {queryParams: query}); |
| | | sessionStorage.setItem("queryParams", JSON.stringify(query)); |
| | | } else { |
| | | this.msgSrv.error('请完善搜索项或删除查询条目'); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label> 项目</label> |
| | | <label>项目</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="query.sensorKey" name="sensorKey" [nzSize]="'large'" [nzPlaceHolder]="'请选择'" [nzMode]="'multiple'"> |
| | | <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-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> |
| | | </ng-template> |
| | | </nz-input> |
| | | <ng-template #nzTemplate> |
| | | <div [ngStyle]="{'width': '240px', 'height': '240px', 'overflow-y' :'auto'}"> |
| | | <nz-tree [nzNodes]="sensorOptions" (nzActivate)="onTreeClickSelect($event)" (nzDeactivate)="onTreeClickSelect($event)" [nzCheckable]="true" (nzCheck)="onSensorSelect($event)"></nz-tree> |
| | | </div> |
| | | </ng-template> |
| | | </nz-popover> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label nz-form-item-required>监测点</label> |
| | | <label nz-form-item-required>省市区</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="query.monitorPointId" name="monitorPoint" nzAllowClear [nzPlaceHolder]="'请输入'" [nzFilter]="false" [nzSize]="'large'" |
| | | (nzSearchChange)="searchChange($event)" [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointChange($event)" nzShowSearch> |
| | | <nz-cascader (nzLoad)="areaLazyLoad($event)" [nzPlaceHolder]="'请选择 省/市/区'" [nzAllowClear]="false" [nzChangeOnSelect]="true" (nzSelect)="regionChange($event)"> |
| | | </nz-cascader> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label>监测点</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="query.monitorPointId" name="monitorPoint" [nzPlaceHolder]="'请选择 监测点'" [nzSize]="'large'" |
| | | [nzNotFoundContent]="'无法找到'" (ngModelChange)="monitorPointChange($event)" nzShowSearch nzAllowClear> |
| | | <nz-option *ngFor="let option of monitorPointOptions" [nzLabel]="option['name']" [nzValue]="option['id']"> </nz-option> |
| | | </nz-select> |
| | | </div> |
| | |
| | | <label>设备</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="query.mac" name="mac" [nzSize]="'large'" nzAllowClear [nzPlaceHolder]="'请选择'" > |
| | | <nz-select [(ngModel)]="query.mac" name="mac" [nzSize]="'large'" [nzPlaceHolder]="'请选择 设备'" [nzNotFoundContent]="'无法找到'" nzShowSearch nzAllowClear> |
| | | <nz-option *ngFor="let option of deviceOptions" [nzLabel]="option.name" [nzValue]="option.mac" ></nz-option> |
| | | </nz-select> |
| | | </div> |
| | |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label nz-form-item-required>类型</label> |
| | | <label>类型</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="timeType" name="timeType" [nzSize]="'large'" [nzPlaceHolder]="'请选择'"> |
| | |
| | | <label nz-form-item-required>时间从</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="query.time" name="time" [nzPlaceHolder]="'请选择'" [nzSize]="'large'" [nzFormat]="timeType.format" |
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="query.time" name="time" [nzPlaceHolder]="'请选择 时间'" [nzSize]="'large'" [nzFormat]="timeType.format" |
| | | [nzMode]="timeType.value=='hour'||timeType.value=='day'?'day':'month'" [nzShowTime]="timeType.value=='hour'?true:false"></nz-datepicker> |
| | | </div> |
| | | </div> |
| | |
| | | <div nz-col [nzSpan]="6" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | | <div nz-form-label> |
| | | <label > 到</label> |
| | | <label >时间至</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="query.timeb" name="timeb" [nzPlaceHolder]="'请选择'" [nzSize]="'large'" [nzFormat]="timeType.format" |
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="query.timeb" name="timeb" [nzPlaceHolder]="'请选择 时间'" [nzSize]="'large'" [nzFormat]="timeType.format" |
| | | [nzMode]="timeType.value=='hour'||timeType.value=='day'?'day':'month'" [nzShowTime]="timeType.value=='hour'?true:false"></nz-datepicker> |
| | | </div> |
| | | </div> |
| | |
| | | import {Component, OnInit, Inject} from '@angular/core'; |
| | | import {HttpClient} from '@angular/common/http'; |
| | | import {ITokenService, DA_SERVICE_TOKEN} from '@delon/auth'; |
| | | 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 {Subject} from 'rxjs/Subject'; |
| | | |
| | | @Component({ |
| | | selector: 'app-excel', |
| | |
| | | {value: 'hour', label: '时', format: 'YYYY-MM-DD HH'} |
| | | ]; |
| | | |
| | | private treeClickStream: Subject<any> = new Subject<any>(); |
| | | private _sensors: {[key: string]: string} = {}; |
| | | private _sensorNames: string; |
| | | get sensorNames(): string { |
| | | return this._sensorNames; |
| | | } |
| | | |
| | | constructor( |
| | | public http: HttpClient, |
| | | public dateSrv: DateService, |
| | | public msgSrv: NzMessageService, |
| | | private areacodeService: AreacodeService, |
| | | @Inject(DA_SERVICE_TOKEN) public tokenService: ITokenService |
| | | ) { |
| | | this.timeType = this.typeOptions[1]; |
| | |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.sensorOptions = res.data; |
| | | this.sensorOptions.push({id: -1, name: '全部', isExpanded: true, children: res.data}); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | searchChange(searchText) { |
| | | if (searchText) { |
| | | const query = encodeURI(searchText); |
| | | if (query) { |
| | | this.http.get(environment.SERVER_BASH_URL + '/monitor-point/list/' + query).subscribe((res: any) => { |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.monitorPointOptions = res.data; |
| | | public onTreeClickSelect(event): void { |
| | | this.treeClickStream.next(event); |
| | | } |
| | | |
| | | public onSensorSelect(event): void { |
| | | const data = event.node.data; |
| | | if (data.id === -1 && data.halfChecked === false) { |
| | | if (!!data.checked) { |
| | | this.sensorOptions[0].children.forEach( |
| | | sensor => { |
| | | this._sensors[sensor.id] = sensor.sensorKey + '-' + sensor.name + '-' + sensor.unit; |
| | | } |
| | | }); |
| | | ); |
| | | } else { |
| | | this._sensors = {}; |
| | | } |
| | | } else { |
| | | if (!!data.checked) { |
| | | this._sensors[data.id] = data.sensorKey + '-' + data.name + '-' + data.unit; |
| | | } else { |
| | | delete this._sensors[data.id]; |
| | | } |
| | | } |
| | | this.reloadSensorNames(); |
| | | |
| | | } |
| | | private reloadSensorNames(): void { |
| | | // 异步提升展现速度 |
| | | setTimeout(() => { |
| | | this._sensorNames = ''; |
| | | const sensorNameList = Object.keys(this._sensors).map( |
| | | id => { |
| | | const sensor = this.sensorOptions[0].children.find(item => { |
| | | return Number(id) === Number(item.id); |
| | | }); |
| | | return sensor.name; |
| | | } |
| | | ); |
| | | this._sensorNames = sensorNameList.join(', '); |
| | | }, 1); |
| | | } |
| | | |
| | | public areaLazyLoad(event: {option: CascaderOption, index: number, resolve: (children: CascaderOption[]) => void, reject: () => void}) { |
| | | const index = event['index']; |
| | | const option = event.option; |
| | | switch (index) { |
| | | case -1: |
| | | this.areacodeService.getProvinces().subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve(res); |
| | | } |
| | | ); break; |
| | | case 0: |
| | | this.areacodeService.getCities(option.value).subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve(res); |
| | | } |
| | | ); break; |
| | | case 1: |
| | | this.areacodeService.getAreas(option.value).subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve(res); |
| | | } |
| | | ); break; |
| | | } |
| | | } |
| | | |
| | | public regionChange(event: {option: CascaderOption, index: number}) { |
| | | let name = ''; |
| | | const option = event.option; |
| | | this.query.areaCode = null; |
| | | this.query.monitorPointId = null; |
| | | this.query.mac = null; |
| | | switch (event.index) { |
| | | case 0: |
| | | name = 'provinceCode'; |
| | | this.query.provinceCode = option.value; |
| | | this.query.cityCode = null; |
| | | break; |
| | | case 1: |
| | | name = 'cityCode'; |
| | | this.query.cityCode = option.value; |
| | | break; |
| | | case 2: |
| | | name = 'areaCode'; |
| | | this.query.areaCode = option.value; |
| | | break; |
| | | } |
| | | this.http.get(environment.SERVER_BASH_URL + 'monitor-point/list/region', {params: {name: name, value: option.value}}).subscribe((res: any) => { |
| | | if (res.code === 0) { |
| | | this.msgSrv.error(res.message); |
| | | } else { |
| | | this.monitorPointOptions = res.data; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | monitorPointChange(value) { |
| | |
| | | |
| | | reportQuery() { |
| | | const query = this.query; |
| | | if (this.timeType && query.monitorPointId && query.time) { |
| | | if (this.monitorPointOptions.length > 0 && query.time) { |
| | | query.time = this.dateSrv.date_format(query.time, this.timeType.format); |
| | | if (query.timeb) { |
| | | query.timeb = this.dateSrv.date_format(query.timeb, this.timeType.format); |
| | | } |
| | | if (query.sensorKey && query.sensorKey.length > 0) { |
| | | query.sensors = JSON.stringify(query.sensorKey); |
| | | } |
| | | query.type = this.timeType.value; |
| | | if (this._sensors) { |
| | | const sensors = []; |
| | | for (var key in this._sensors) { |
| | | sensors.push(this._sensors[key]); |
| | | } |
| | | if (sensors.length > 0) { |
| | | query.sensors = JSON.stringify(sensors); |
| | | } |
| | | } |
| | | |
| | | let url = environment.SERVER_BASH_URL + 'report/excel?'; |
| | | for (const a in query) { |
| | | if (query[a]) { |
| | |
| | | } |
| | | window.location.href = url + '_token=' + this.tokenService.get().token; |
| | | } else { |
| | | this.msgSrv.error('请完善搜索项'); |
| | | this.msgSrv.error('开始时间为空或者所选区域没有监控点数据!'); |
| | | } |
| | | } |
| | | } |
| | |
| | | <nz-popconfirm [nzTitle]="'确定要删除该'+grid.title+'吗?'" [nzOkText]="'Yes'" [nzCancelText]="'No'" (nzOnConfirm)="delete(row.id)" > |
| | | <a nz-popconfirm>删除</a> |
| | | </nz-popconfirm> |
| | | <span nz-table-divider></span> |
| | | <a [routerLink]="['/systems/registration']" (click)="registration(row)">注册码</a> |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | |
| | | this.organizationService.title = '组织配置'; |
| | | }); |
| | | } |
| | | |
| | | registration(row){ |
| | | sessionStorage.setItem("organization", JSON.stringify(row)); |
| | | } |
| | | } |
New file |
| | |
| | | <div class="content__title">
|
| | | <h1>注册码管理({{organization.name}})</h1>
|
| | | </div>
|
| | | <nz-card [nzBordered]="false">
|
| | | <div class="mb-md">
|
| | | <button nz-button [nzType]="'primary'" [nzSize]="'large'" (click)="isVisible=true">
|
| | | <i class="anticon anticon-plus"></i><span>新建</span>
|
| | | </button>
|
| | | </div>
|
| | | <simple-table #simpleTable [data]="dataUrl" [extraParams]="extraParams" [columns]="columns" [showTotal]="true" [ps]="10" [reqReName]="{pi: 'pageIndex',ps: 'pageSize'}" [resReName]="{list: 'data',total: 'total'}">
|
| | | </simple-table> |
| | | </nz-card>
|
| | |
|
| | | <nz-modal [nzVisible]="isVisible" [nzTitle]="'新建注册码'" [nzContent]="modalContent" (nzOnCancel)="isVisible=false" (nzOnOk)="registrationOk()">
|
| | | <ng-template #modalContent>
|
| | | <form nz-form >
|
| | | <div nz-form-item nz-row>
|
| | | <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
|
| | | <label nz-form-item-required>失效日期</label>
|
| | | </div>
|
| | | <div nz-col [nzSm]="14" [nzXs]="24">
|
| | | <nz-datepicker style="width: 100%;" [(ngModel)]="_date" name='_date' [nzFormat]="'YYYY-MM-DD'" [nzDisabledDate]="_disabledDate" [nzAllowClear]="false"></nz-datepicker>
|
| | | </div>
|
| | | </div>
|
| | | </form>
|
| | | </ng-template>
|
| | | </nz-modal>
|
New file |
| | |
| | | import {environment} from "../../../../environments/environment";
|
| | | import {Component, OnInit, ViewChild} from '@angular/core';
|
| | | import {SimpleTableColumn} from "@delon/abc";
|
| | | import {_HttpClient} from '@delon/theme';
|
| | | import {Subject} from "rxjs";
|
| | | import * as moment from 'moment';
|
| | | import {NzMessageService} from "ng-zorro-antd";
|
| | | @Component({
|
| | | selector: 'app-registration',
|
| | | templateUrl: './registration.component.html',
|
| | | })
|
| | | export class RegistrationComponent implements OnInit {
|
| | | constructor(
|
| | | public msgSrv: NzMessageService,
|
| | | private http: _HttpClient
|
| | | ) {}
|
| | |
|
| | | @ViewChild('simpleTable') simpleTable: {load: Function};
|
| | |
|
| | | dataUrl = environment.SERVER_BASH_URL + 'machineactivate/list';
|
| | |
|
| | | queryTextStream: Subject<string> = new Subject<string>();
|
| | |
|
| | | extraParams: any = {};
|
| | | organization: any = {};
|
| | | columns: SimpleTableColumn[] = [
|
| | | {title: '注册码', index: 'activationCode'},
|
| | | {
|
| | | title: '是否使用', index: 'isUsed', format: function(machineActivate) {
|
| | | return machineActivate.isUsed == 1 ? '是' : '否';
|
| | | }
|
| | | },
|
| | | {
|
| | | title: '生成时间', type: 'date', index: 'createTime', format: function(machineActivate) {
|
| | | return moment(machineActivate.createTime).format('YYYY-MM-DD HH:mm:ss');
|
| | | }
|
| | | },
|
| | | {
|
| | | title: '失效日期', type: 'date', index: 'expireDate', format: function(machineActivate) {
|
| | | return moment(machineActivate.expireDate).format('YYYY-MM-DD');
|
| | | }
|
| | | },
|
| | | ];
|
| | | isVisible: boolean = false;
|
| | | _date = new Date(Date.now() + 3600 * 24 * 1 * 1000);
|
| | |
|
| | | ngOnInit() {
|
| | | const organization = this.organization = JSON.parse(sessionStorage.getItem("organization"));
|
| | | this.extraParams.organizationId = organization.id;
|
| | | this.queryTextStream.debounceTime(900).distinctUntilChanged().subscribe(value => {
|
| | | this.load();
|
| | | });
|
| | | }
|
| | |
|
| | | load() {
|
| | | this.simpleTable.load();
|
| | | }
|
| | |
|
| | | _disabledDate(current: Date): boolean {
|
| | | return current && current.getTime() < Date.now();
|
| | | }
|
| | |
|
| | | registrationOk() {
|
| | | this.http.get(environment.SERVER_BASH_URL + '/machineactivate/machine', {organizationId: this.organization.id, expireDate: moment(this._date).format('YYYY-MM-DD')}).subscribe((res: any) => {
|
| | | if (res.code == 1 && res.data == 1) {
|
| | | this.isVisible = false;
|
| | | this.msgSrv.success('新建注册码成功!');
|
| | | this.load();
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | import { AreacodeService } from '@business/services/http/areacode.service'; |
| | | import { OrganizationConfigComponent } from './organization/organization-config/organization-config.component'; |
| | | import { OrganizationListComponent } from './organization/organization-list/organization-list.component'; |
| | | import { RegistrationComponent } from "./registration/registration.component"; |
| | | import { SensorsService } from '@business/services/http/sensors.service'; |
| | | import { BusinessModule } from '@business/business.module'; |
| | | |
| | |
| | | path: '', |
| | | children: [ |
| | | { path: 'account', component: AccountComponent }, |
| | | { path: 'organization', component: OrganizationComponent } |
| | | { path: 'organization', component: OrganizationComponent }, |
| | | { path: 'registration', component: RegistrationComponent } |
| | | ] |
| | | } |
| | | ]; |
| | |
| | | AccountEditComponent, |
| | | OrganizationComponent, |
| | | OrganizationConfigComponent, |
| | | OrganizationListComponent |
| | | OrganizationListComponent, |
| | | RegistrationComponent |
| | | ], |
| | | providers: [ToolsService, SensorsService, OrganizationService, _HttpClient, FormBuilder, AreacodeService], |
| | | entryComponents: COMPONENTS_NOROUNT |
| | |
| | | { |
| | | "text": "组织管理", |
| | | "link": "/systems/organization" |
| | | } |
| | | }, |
| | | { |
| | | "text": "注册码管理", |
| | | "link": "/systems/registration", |
| | | "hide": true |
| | | } |
| | | ] |
| | | } |
| | | ] |