From e91e87b7b86e8d1d66caeab727a3cdc68fdc09ef Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Fri, 03 Aug 2018 16:56:41 +0800 Subject: [PATCH] Merge branch 'master' of http://blit.7drlb.com:8888/r/screen_demo2 --- src/app/routes/forecasting-warning/forecasting-warning.component.html | 24 ++-- src/app/routes/raise-dust/statistical-query/statistical-query.component.ts | 96 +++++++++++++++++- src/app/routes/raise-dust/image-grabbing/image-grabbing.component.html | 44 ++++++++ src/app/routes/raise-dust/statistical-query/statistical-query.component.html | 70 +++++++++++++ src/app/routes/raise-dust/image-grabbing/image-grabbing.component.ts | 34 +++++- src/app/routes/pollution/management/management.component.html | 2 src/app/routes/raise-dust/real-time/real-time.component.html | 4 src/assets/img/5.jpg | 0 src/assets/img/6.jpg | 0 9 files changed, 241 insertions(+), 33 deletions(-) diff --git a/src/app/routes/forecasting-warning/forecasting-warning.component.html b/src/app/routes/forecasting-warning/forecasting-warning.component.html index 02a081a..9a1b2ee 100644 --- a/src/app/routes/forecasting-warning/forecasting-warning.component.html +++ b/src/app/routes/forecasting-warning/forecasting-warning.component.html @@ -12,24 +12,24 @@ </nz-card> <div nz-row [ngStyle]="{'display':isShow ? 'block' : 'none'}"> - <div nz-col [nzSpan]="12"><div id="warning_PM25" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="warning_PM10" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="warning_CO" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="warning_NO2" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="warning_O3" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="warning_SO2" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="warning_PM25" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="warning_PM10" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="warning_CO" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="warning_NO2" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="warning_O3" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="warning_SO2" style="height: 300px; width: 100%"></div></div> </div> <div nz-row [ngStyle]="{'display':isShow ? 'none' : 'block'}"> <!-- 24������ --> - <div nz-col [nzSpan]="12"><div id="forecasting_temp" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="forecasting_humidity" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="forecasting_pressure" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="forecasting_uvi" style="height: 300px; width: 100%"></div></div> - <div nz-col [nzSpan]="12"><div id="forecasting_wind" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="forecasting_temp" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="forecasting_humidity" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="forecasting_pressure" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="forecasting_uvi" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="forecasting_wind" style="height: 300px; width: 100%"></div></div> <!-- 15��� --> - <div nz-col [nzSpan]="12"><div id="forecasting_temp_day" style="height: 300px; width: 100%"></div></div> + <div nz-col nzXs="24" nzSm="12" nzMd="12"><div id="forecasting_temp_day" style="height: 300px; width: 100%"></div></div> <!-- <div nz-col [nzSpan]="12"><div id="forecasting_uvi" style="height: 300px; width: 100%"></div></div> --> </div> diff --git a/src/app/routes/pollution/management/management.component.html b/src/app/routes/pollution/management/management.component.html index 6467a90..3420e44 100644 --- a/src/app/routes/pollution/management/management.component.html +++ b/src/app/routes/pollution/management/management.component.html @@ -25,7 +25,7 @@ <th nz-th><span>������</span></th> <th nz-th><span>������������</span></th> <th nz-th class="text-right"> - <span>������������</span> + <span>������������</span> <nz-table-sort (nzValueChange)="sort('sum',$event)"></nz-table-sort> </th> </tr> diff --git a/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.html b/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.html index e9d3bb7..d113e07 100644 --- a/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.html +++ b/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.html @@ -1,4 +1,44 @@ <div class="content__title"> - <h1>Page Name</h1> + <h1>������������</h1> </div> -<pro-header [title]="'Page Name'"></pro-header> + +<nz-card [nzBordered]="false"> + <form nz-form [nzLayout]="'inline'"> + <div nz-row [nzGutter]="24" > + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <div nz-form-item class="d-flex"> + <div nz-form-label class="label-width-70"> + <label>������������</label> + </div> + <div nz-form-control class="flex-1"> + <nz-select [(ngModel)]="monitorPoint" name="monitorPoint" [nzPlaceHolder]="'��������� ������������'" [nzSize]="'large'" + [nzNotFoundContent]="'������������'" nzShowSearch (ngModelChange)="monitorPointChange($event)"> + <nz-option *ngFor="let option of monitorPointOptions" [nzLabel]="option['name']" [nzValue]="option.id"> </nz-option> + </nz-select> + </div> + </div> + </div> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <div nz-form-item class="d-flex"> + <div nz-form-label class="label-width-70"> + <label>������</label> + </div> + <div nz-form-control class="flex-1"> + <nz-select [(ngModel)]="device" name="device" [nzSize]="'large'" [nzPlaceHolder]="'��������� ������'" (ngModelChange)="deviceChange($event)"> + <nz-option *ngFor="let option of deviceOptions" [nzLabel]="option.name" [nzValue]="option.id"></nz-option> + </nz-select> + </div> + </div> + </div> + </div> + </form> +</nz-card> + +<nz-card [nzBordered]="false"> + <div nz-row [nzGutter]="24" class="pt-lg"> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md" *ngFor="let time of times;let i = index"> + <h3>{{time}} ������</h3> + <img src="./assets/img/{{i+ base}}.jpg" width="300" height="250" /> + </div> + </div> +</nz-card> diff --git a/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.ts b/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.ts index dcc2093..d40449f 100644 --- a/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.ts +++ b/src/app/routes/raise-dust/image-grabbing/image-grabbing.component.ts @@ -1,5 +1,7 @@ -import { Component, OnInit } from '@angular/core'; -import { _HttpClient } from '@delon/theme'; +import {environment} from '../../../../environments/environment'; +import {HttpClient} from '@angular/common/http'; +import {Component, OnInit} from '@angular/core'; +import * as moment from 'moment'; @Component({ selector: 'app-image-grabbing', @@ -7,11 +9,29 @@ }) export class ImageGrabbingComponent implements OnInit { - constructor( - private http: _HttpClient - ) { } + [x: string]: any; + + constructor( + private http: HttpClient + ) {} - ngOnInit() { - } + ngOnInit() { + this.http.get(environment.SERVER_BASH_URL + 'monitor-point/list/region', {params: {name: 'areaCode', value: '320583'}}).subscribe((res: any) => { + this.monitorPointOptions = res.data; + }); + } + monitorPointChange(id) { + this.device = null; + this.times = null; + this.http.get(environment.SERVER_BASH_URL + 'device/professionId', {params: {monitorPointId: id}}).subscribe((res: any) => { + this.deviceOptions = res.data; + }); + } + + deviceChange(id) { + const format = 'DD���HH���'; + this.base = id % 10 % 5; + this.times = [moment().subtract(2, 'h').format(format), moment().subtract(1, 'h').format(format), moment().format(format)]; + } } diff --git a/src/app/routes/raise-dust/real-time/real-time.component.html b/src/app/routes/raise-dust/real-time/real-time.component.html index 617b254..6b307c5 100644 --- a/src/app/routes/raise-dust/real-time/real-time.component.html +++ b/src/app/routes/raise-dust/real-time/real-time.component.html @@ -4,7 +4,7 @@ <form nz-form [nzLayout]="'inline'"> <div nz-row [nzGutter]="24"> - <div nz-col [nzSpan]="6" class="mb-md"> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> <div nz-form-item class="d-flex"> <div nz-form-label> <label>������������</label> @@ -55,7 +55,7 @@ </div> <div nz-row [nzGutter]="24" class="pt-lg" *ngIf="!!avgs.e1"> - <div nz-col [nzSpan]="12" nzType="flex" nzAlign="middle"> + <div nz-col nzXs="24" nzSm="12" nzMd="6" nzType="flex" nzAlign="middle"> <h2> <span style="color:#666666;">���������������</span> <span style="color:#FF0000;">{{avgs.e1 > levels[0] ? (avgs.e1 < levels[1] ? '������' : (avgs.e1 < levels[2]? '������':'������' )) : '���'}}������</span> diff --git a/src/app/routes/raise-dust/statistical-query/statistical-query.component.html b/src/app/routes/raise-dust/statistical-query/statistical-query.component.html index e9d3bb7..3f077f8 100644 --- a/src/app/routes/raise-dust/statistical-query/statistical-query.component.html +++ b/src/app/routes/raise-dust/statistical-query/statistical-query.component.html @@ -1,4 +1,70 @@ <div class="content__title"> - <h1>Page Name</h1> + <h1>������������</h1> </div> -<pro-header [title]="'Page Name'"></pro-header> + +<nz-card [nzBordered]="false"> + <form nz-form (ngSubmit)="reportQuery()" [nzLayout]="'inline'"> + <div nz-row [nzGutter]="24" > + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <div nz-form-item class="d-flex"> + <div nz-form-label class="label-width-70"> + <label>������</label> + </div> + <div nz-form-control class="flex-1"> + <nz-select [(ngModel)]="sensor" name="sensor" [nzSize]="'large'" [nzPlaceHolder]="'��������� ������'"> + <nz-option *ngFor="let option of sensorOptions" [nzLabel]="option.name" [nzValue]="option"></nz-option> + </nz-select> + </div> + </div> + </div> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <div nz-form-item class="d-flex"> + <div nz-form-label class="label-width-70"> + <label>������������</label> + </div> + <div nz-form-control class="flex-1"> + <nz-select [(ngModel)]="monitorPoint" name="monitorPoint" [nzPlaceHolder]="'��������� ������������'" [nzSize]="'large'" + [nzNotFoundContent]="'������������'" nzShowSearch> + <nz-option *ngFor="let option of monitorPointOptions" [nzLabel]="option['name']" [nzValue]="option"> </nz-option> + </nz-select> + </div> + </div> + </div> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <div nz-form-item class="d-flex"> + <div nz-form-label class="label-width-70"> + <label>������</label> + </div> + <div nz-form-control class="flex-1"> + <nz-select [(ngModel)]="timeType" name="timeType" [nzSize]="'large'"> + <nz-option *ngFor="let option of typeOptions" [nzLabel]="option.label" [nzValue]="option" ></nz-option> + </nz-select> + </div> + </div> + </div> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <div nz-form-item class="d-flex"> + <div nz-form-label class="label-width-70"> + <label>������</label> + </div> + <div nz-form-control class="flex-1"> + <nz-datepicker style="width: 100%;" [(ngModel)]="time" name="time" [nzFormat]="timeType.format" [nzDisabledDate]="_disabledDate" [nzAllowClear]="false" + [nzMode]="timeType.value=='hour'||timeType.value=='day'?'day':'month'" [nzShowTime]="timeType.value=='hour'?true:false" [nzSize]="'large'"></nz-datepicker> + </div> + </div> + </div> + </div> + + <div nz-row [nzGutter]="24"> + <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> + <button nz-button type="submit" [nzType]="'primary'" [nzSize]="'large'"> + ������ + </button> + </div> + </div> + </form> +</nz-card> + +<nz-card [nzBordered]="false"> + <div id="mydiv" style="height: 485.35px; width: 100%"></div> +</nz-card> diff --git a/src/app/routes/raise-dust/statistical-query/statistical-query.component.ts b/src/app/routes/raise-dust/statistical-query/statistical-query.component.ts index 22fc612..6c2ecdf 100644 --- a/src/app/routes/raise-dust/statistical-query/statistical-query.component.ts +++ b/src/app/routes/raise-dust/statistical-query/statistical-query.component.ts @@ -1,17 +1,99 @@ -import { Component, OnInit } from '@angular/core'; -import { _HttpClient } from '@delon/theme'; +import {environment} from '../../../../environments/environment'; +import {DateService} from '../../../business/services/util/date.service'; +import {NzMessageService} from 'ng-zorro-antd'; +import {Component, OnInit} from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {zip} from 'rxjs/observable/zip'; +import * as echarts from 'echarts'; @Component({ selector: 'app-statistical-query', templateUrl: './statistical-query.component.html', }) export class StatisticalQueryComponent implements OnInit { + [x: string]: any; + public query: any = {}; + public sensorOptions = []; + public typeOptions = [ + {value: 'year', label: '���', format: 'YYYY'}, + {value: 'month', label: '���', format: 'YYYY-MM'}, + {value: 'day', label: '���', format: 'YYYY-MM-DD'}, + {value: 'hour', label: '���', format: 'YYYY-MM-DD HH'} + ]; - constructor( - private http: _HttpClient - ) { } + constructor( + public http: HttpClient, + public dateSrv: DateService, + public msgSrv: NzMessageService + ) { + this.timeType = this.typeOptions[1]; + } - ngOnInit() { - } + private echartOption = { + title: { + text: '', + left: 'center' + }, + tooltip: { + trigger: 'item', + axisPointer: { + type: 'cross' + } + }, + xAxis: { + type: 'category', + data: [], + name: '' + }, + yAxis: { + type: 'value', + name: '' + }, + series: [ + { + data: [], + type: 'line', + smooth: true, + name: '' + } + ] + }; + + ngOnInit() { + + zip( + this.http.get(environment.SERVER_BASH_URL + 'sensor/all'), + this.http.get(environment.SERVER_BASH_URL + 'monitor-point/list/region', {params: {name: 'areaCode', value: '320583'}}) + ).subscribe( + ([sensors, monitorPoints]) => { + this.sensorOptions = sensors['data']; + this.monitorPointOptions = monitorPoints['data']; + }); + } + + _disabledDate(current: Date): boolean { + return current && current.getTime() > Date.now(); + } + + reportQuery() { + const query = this.query; + query.type = this.timeType.value; + const formatTime = this.dateSrv.date_format(this.time, this.timeType.format); + const queryItems = [{formatTime: formatTime, monitorPointId: this.monitorPoint.id}]; + query.items = JSON.stringify(queryItems); + query.sensors = JSON.stringify([this.sensor.sensorKey]); + const myChart = echarts.init(document.getElementById('mydiv')); + myChart.showLoading(); + this.http.get(environment.SERVER_BASH_URL + 'report/compare', {params: query}).subscribe((res: any) => { + const option = this.echartOption; + option.title.text = this.monitorPoint.name + ' ' + formatTime + ' ' + this.sensor.name + ' ' + this.timeType.label + '������'; + option.yAxis.name = '���������' + this.sensor.unit; + option.xAxis.data = res.data.times; + option.series[0].data = res.data.datas[0][this.sensor.sensorKey]; + myChart.setOption(option, true); + window.onresize = myChart.resize; + myChart.hideLoading(); + }); + } } diff --git a/src/assets/img/5.jpg b/src/assets/img/5.jpg new file mode 100644 index 0000000..ae99cbf --- /dev/null +++ b/src/assets/img/5.jpg Binary files differ diff --git a/src/assets/img/6.jpg b/src/assets/img/6.jpg new file mode 100644 index 0000000..5d2fc49 --- /dev/null +++ b/src/assets/img/6.jpg Binary files differ -- Gitblit v1.8.0