Browse Source

[完善]预警记录列表对接接口

dev
邵佳豪 3 years ago
parent
commit
40794786d0
  1. 36
      src/app/pages/criminal-records-admin/criminal-records-admin.component.html
  2. 89
      src/app/pages/criminal-records-admin/criminal-records-admin.component.ts
  3. 32
      src/app/pages/criminal-records/criminal-records.component.html
  4. 123
      src/app/pages/criminal-records/criminal-records.component.ts
  5. 2
      src/app/pages/plan-admin/plan-admin.component.ts

36
src/app/pages/criminal-records-admin/criminal-records-admin.component.html

@ -101,7 +101,7 @@
<div class="table"> <div class="table">
<div nz-row class="th"> <div nz-row class="th">
<div nz-col nzSpan="1" style="text-align: right;"> <div nz-col nzSpan="1" style="text-align: right;">
</div> </div>
<div nz-col nzSpan="2"> <div nz-col nzSpan="2">
预警级别 预警级别
@ -134,43 +134,53 @@
<div class="tbody" id="tbody"> <div class="tbody" id="tbody">
<div nz-row class="tr" *ngFor="let item of list"> <div nz-row class="tr" *ngFor="let item of list">
<div nz-col nzSpan="1" style="text-align: right;"> <div nz-col nzSpan="1" style="text-align: right;">
<img style="width: 36px;" src="../../../assets/images/level1.png" alt=""> <img *ngIf="item.violation.level == 1" style="width: 36px;" src="../../../assets/images/level1.png"
alt="">
<img *ngIf="item.violation.level == 2" style="width: 36px;" src="../../../assets/images/level2.png"
alt="">
<img *ngIf="item.violation.level == 3" style="width: 36px;" src="../../../assets/images/level3.png"
alt="">
<img *ngIf="item.violation.level == 4" style="width: 36px;" src="../../../assets/images/level4.png"
alt="">
</div> </div>
<div nz-col nzSpan="2"> <div nz-col nzSpan="2">
Ⅰ级 <span *ngIf="item.violation.level == 1">Ⅰ级</span>
<span *ngIf="item.violation.level == 2">Ⅱ级</span>
<span *ngIf="item.violation.level == 3">Ⅲ级</span>
<span *ngIf="item.violation.level == 4">Ⅳ级</span>
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
日常预警行为 {{item.violation.violationType}}
</div> </div>
<div nz-col nzSpan="4"> <div nz-col nzSpan="4">
中化某某省公司 {{item.gasStation.companyName}}
</div> </div>
<div nz-col nzSpan="2"> <div nz-col nzSpan="2">
山东-淄博 {{item.gasStation.locationName}}
</div> </div>
<div nz-col nzSpan="1" style="text-align: right;box-sizing: border-box;padding-right: 8px;"> <div nz-col nzSpan="1" style="text-align: right;box-sizing: border-box;padding-right: 8px;">
<span class="ziying">自营</span> <!-- <span class="ziying">自营</span> -->
</div> </div>
<div nz-col nzSpan="4"> <div nz-col nzSpan="4">
中化山东省淄博市第6加油站 {{item.gasStation.stationName}}
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
便利店 {{item.violateArea}}
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
2021-10-12 09:28:13 {{item.violateTime | date:"yyyy-MM-dd HH:mm:ss"}}
</div> </div>
<div nz-col nzSpan="1"> <div nz-col nzSpan="1">
<span class="look" (click)="look()">查看</span> <span class="look" (click)="look(item)">查看</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="pagination"> <!-- <div class="pagination">
<nz-pagination [nzPageIndex]="1" [nzTotal]="85" [nzPageSize]="20" [nzShowTotal]="totalTemplate" <nz-pagination [nzPageIndex]="1" [nzTotal]="85" [nzPageSize]="20" [nzShowTotal]="totalTemplate"
nzShowQuickJumper></nz-pagination> nzShowQuickJumper></nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共100条 </ng-template> <ng-template #totalTemplate let-total> 16条/页,共100条 </ng-template>
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>

89
src/app/pages/criminal-records-admin/criminal-records-admin.component.ts

@ -1,11 +1,15 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Component, ElementRef, OnInit } from '@angular/core'; import { Component, ElementRef, OnInit, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router' import { Router } from '@angular/router'
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { fromEvent } from 'rxjs'; import { fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
import * as moment from 'moment';
import { NzModalService } from 'ng-zorro-antd/modal';
import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component';
@Component({ @Component({
selector: 'app-criminal-records-admin', selector: 'app-criminal-records-admin',
templateUrl: './criminal-records-admin.component.html', templateUrl: './criminal-records-admin.component.html',
@ -14,7 +18,7 @@ import { debounceTime } from 'rxjs/operators';
export class CriminalRecordsAdminComponent implements OnInit { export class CriminalRecordsAdminComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
constructor(private element: ElementRef, private http: HttpClient, private fb: FormBuilder, private router: Router) { } constructor(private element: ElementRef, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { }
//饼图 //饼图
myChart myChart
option = { option = {
@ -303,13 +307,50 @@ export class CriminalRecordsAdminComponent implements OnInit {
this.mybarChart.setOption(this.baroption); this.mybarChart.setOption(this.baroption);
this.warningType() this.warningType()
this.getViolateRecordList()
}
//获得违规记录列表
SkipCount: string = '0'
MaxResultCount: string = '50'
list: any = []
totalCount: string
getViolateRecordList() {
let ViolationIds = []
if (this.validateForm.value.type) {
this.warningTypesDetails.forEach(item => {
item.id ? ViolationIds.push(item.id) : null
});
}
let params = {
Level: this.validateForm.value.level,
ViolationIds: ViolationIds,
ViolateArea: this.validateForm.value.site,
OrganizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id,
IsContainsChildren: 'true',
ViolateTime: this.validateForm.value.datePicker ? [moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD'), moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD')] : null,
SkipCount: this.SkipCount,
MaxResultCount: this.MaxResultCount
}
this.http.get('/api/services/app/ViolateRecord/GetAll', {
params: params
}).subscribe((data: any) => {
this.list = this.list.concat(data.result.items);
this.list = [...this.list]
// this.list = data.result.items
this.totalCount = data.result.totalCount
console.log('违规记录列表', data)
})
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
fromEvent(this.element.nativeElement.querySelector(`#tbody`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe((event: any) => { //监听 DOM 滚动事件 fromEvent(this.element.nativeElement.querySelector(`#tbody`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe((event: any) => { //监听 DOM 滚动事件
if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) { if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) {
console.log('需要加载数据了', event) console.log('需要加载数据了', event)
this.SkipCount = String(Number(this.SkipCount) + 50)
this.getViolateRecordList()
} }
}); });
} }
@ -352,15 +393,9 @@ export class CriminalRecordsAdminComponent implements OnInit {
this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity(); this.validateForm.controls[i].updateValueAndValidity();
} }
console.log(this.validateForm.value) this.list = []
this.SkipCount = '0'
this.getViolateRecordList()
let ViolationIds = []
if (this.validateForm.value.type) {
this.warningTypesDetails.forEach(item => {
item.id ? ViolationIds.push(item.id) : null
});
}
} }
resetForm(e: MouseEvent): void { resetForm(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
@ -369,6 +404,12 @@ export class CriminalRecordsAdminComponent implements OnInit {
this.validateForm.controls[key].markAsPristine(); this.validateForm.controls[key].markAsPristine();
this.validateForm.controls[key].updateValueAndValidity(); this.validateForm.controls[key].updateValueAndValidity();
} }
this.validateForm.patchValue({
datePicker: [this.startdate, this.enddate]
});
this.list = []
this.SkipCount = '0'
this.getViolateRecordList()
} }
//预警类型接口 //预警类型接口
@ -392,9 +433,29 @@ export class CriminalRecordsAdminComponent implements OnInit {
} }
list: any = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
look() { look(item) {
this.router.navigate(['/records/petrolStation']) const modal = this.modal.create({
nzContent: GetOutOfLineDetailsComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 1200,
nzBodyStyle: {
'border': '1px solid #6d9cc7',
'border-radius': '0px',
'padding': '0px',
'box-shadow': '0 0 8px 0 #fff',
'background': '#000D21',
},
nzComponentParams: {
data: item
},
nzFooter: null,
nzOnOk: async () => {
}
});
const instance = modal.getContentComponent();
} }

32
src/app/pages/criminal-records/criminal-records.component.html

@ -14,7 +14,7 @@
<nz-form-item class="searchParams"> <nz-form-item class="searchParams">
<nz-form-control> <nz-form-control>
<nz-select formControlName="type" nzPlaceHolder="请选择预警类型"> <nz-select formControlName="type" (ngModelChange)="typeChange($event)" nzPlaceHolder="请选择预警类型">
<nz-option *ngFor="let item of warningTypes" [nzValue]="item.key" [nzLabel]="item.key"></nz-option> <nz-option *ngFor="let item of warningTypes" [nzValue]="item.key" [nzLabel]="item.key"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
@ -121,37 +121,47 @@
操作 操作
</div> </div>
</div> </div>
<div class="tbody"> <div class="tbody" id="tbody">
<div nz-row class="tr" *ngFor="let item of list"> <div nz-row class="tr" *ngFor="let item of list">
<div nz-col nzSpan="1" style="text-align: right;"> <div nz-col nzSpan="1" style="text-align: right;">
<img style="width: 36px;" src="../../../assets/images/level1.png" alt=""> <img *ngIf="item.violation.level == 1" style="width: 36px;" src="../../../assets/images/level1.png"
alt="">
<img *ngIf="item.violation.level == 2" style="width: 36px;" src="../../../assets/images/level2.png"
alt="">
<img *ngIf="item.violation.level == 3" style="width: 36px;" src="../../../assets/images/level3.png"
alt="">
<img *ngIf="item.violation.level == 4" style="width: 36px;" src="../../../assets/images/level4.png"
alt="">
</div> </div>
<div nz-col nzSpan="3"> <div nz-col nzSpan="3">
Ⅰ级 <span *ngIf="item.violation.level == 1">Ⅰ级</span>
<span *ngIf="item.violation.level == 2">Ⅱ级</span>
<span *ngIf="item.violation.level == 3">Ⅲ级</span>
<span *ngIf="item.violation.level == 4">Ⅳ级</span>
</div> </div>
<div nz-col nzSpan="5"> <div nz-col nzSpan="5">
日常预警行为 {{item.violation.violationType}}
</div> </div>
<div nz-col nzSpan="5"> <div nz-col nzSpan="5">
工作人员倚靠加油机或立柱 {{item.violation.violationName}}
</div> </div>
<div nz-col nzSpan="4"> <div nz-col nzSpan="4">
便利店 {{item.violateArea}}
</div> </div>
<div nz-col nzSpan="4"> <div nz-col nzSpan="4">
2021-10-12 09:28:13 {{item.violateTime | date:"yyyy-MM-dd HH:mm:ss"}}
</div> </div>
<div nz-col nzSpan="2"> <div nz-col nzSpan="2">
<span class="look">查看</span> <span class="look" (click)="look(item)">查看</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="pagination"> <!-- <div class="pagination">
<nz-pagination [nzPageIndex]="1" [nzTotal]="85" [nzPageSize]="20" [nzShowTotal]="totalTemplate" <nz-pagination [nzPageIndex]="1" [nzTotal]="85" [nzPageSize]="20" [nzShowTotal]="totalTemplate"
nzShowQuickJumper></nz-pagination> nzShowQuickJumper></nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共100条 </ng-template> <ng-template #totalTemplate let-total> 16条/页,共100条 </ng-template>
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>

123
src/app/pages/criminal-records/criminal-records.component.ts

@ -1,7 +1,12 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewContainerRef, ElementRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { NzModalService } from 'ng-zorro-antd/modal';
import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component';
import * as moment from 'moment';
import { fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-criminal-records', selector: 'app-criminal-records',
templateUrl: './criminal-records.component.html', templateUrl: './criminal-records.component.html',
@ -9,7 +14,7 @@ import * as echarts from 'echarts';
}) })
export class CriminalRecordsComponent implements OnInit { export class CriminalRecordsComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
constructor(private http: HttpClient, private fb: FormBuilder) { } constructor(private http: HttpClient, private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef) { }
myChart: any //左侧饼图 myChart: any //左侧饼图
option = { option = {
@ -273,16 +278,30 @@ export class CriminalRecordsComponent implements OnInit {
return dateList; return dateList;
} }
isEcharts:boolean = true isEcharts: boolean = true
isEchartsShow(){ isEchartsShow() {
this.isEcharts = !this.isEcharts this.isEcharts = !this.isEcharts
} }
startdate
enddate
ngOnInit(): void { ngOnInit(): void {
//当前日期
let myDate: any = new Date();
let nowY = myDate.getFullYear();
let nowM = myDate.getMonth() + 1;
let nowD = myDate.getDate();
this.enddate = nowY + "-" + (nowM < 10 ? "0" + nowM : nowM) + "-" + (nowD < 10 ? "0" + nowD : nowD);//当前日期
//获取三十天前日期
let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 30);//最后一个数字30可改,30天的意思
let lastY = lw.getFullYear();
let lastM = lw.getMonth() + 1;
let lastD = lw.getDate();
this.startdate = lastY + "-" + (lastM < 10 ? "0" + lastM : lastM) + "-" + (lastD < 10 ? "0" + lastD : lastD);//三十天之前日期
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
level: [null], level: [null],
type: [null], type: [null],
site: [null], site: [null],
datePicker: [null] datePicker: [[this.startdate, this.enddate]]
}); });
// 饼图 // 饼图
this.myChart = echarts.init(document.getElementById('piechart')); this.myChart = echarts.init(document.getElementById('piechart'));
@ -292,14 +311,60 @@ export class CriminalRecordsComponent implements OnInit {
this.mybarChart.setOption(this.baroption); this.mybarChart.setOption(this.baroption);
this.warningType() this.warningType()
this.getViolateRecordList()
} }
//获得违规记录列表
SkipCount: string = '0'
MaxResultCount: string = '50'
list: any = []
totalCount: string
getViolateRecordList() {
let ViolationIds = []
if (this.validateForm.value.type) {
this.warningTypesDetails.forEach(item => {
item.id ? ViolationIds.push(item.id) : null
});
}
let params = {
Level: this.validateForm.value.level,
ViolationIds: ViolationIds,
ViolateArea: this.validateForm.value.site,
OrganizationUnitId: JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id,
IsContainsChildren: 'true',
ViolateTime: this.validateForm.value.datePicker ? [moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD'), moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD')] : null,
SkipCount: this.SkipCount,
MaxResultCount: this.MaxResultCount
}
this.http.get('/api/services/app/ViolateRecord/GetAll', {
params: params
}).subscribe((data: any) => {
this.list = this.list.concat(data.result.items);
this.list = [...this.list]
// this.list = data.result.items
this.totalCount = data.result.totalCount
console.log('违规记录列表', data)
})
}
ngAfterViewInit(): void {
fromEvent(this.element.nativeElement.querySelector(`#tbody`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe((event: any) => { //监听 DOM 滚动事件
if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) {
console.log('需要加载数据了', event)
this.SkipCount = String(Number(this.SkipCount) + 50)
this.getViolateRecordList()
}
});
}
submitForm(): void { submitForm(): void {
for (const i in this.validateForm.controls) { for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity(); this.validateForm.controls[i].updateValueAndValidity();
} }
console.log(this.validateForm) this.list = []
this.SkipCount = '0'
this.getViolateRecordList()
} }
resetForm(e: MouseEvent): void { resetForm(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
@ -308,6 +373,12 @@ export class CriminalRecordsComponent implements OnInit {
this.validateForm.controls[key].markAsPristine(); this.validateForm.controls[key].markAsPristine();
this.validateForm.controls[key].updateValueAndValidity(); this.validateForm.controls[key].updateValueAndValidity();
} }
this.validateForm.patchValue({
datePicker: [this.startdate, this.enddate]
});
this.list = []
this.SkipCount = '0'
this.getViolateRecordList()
} }
@ -316,14 +387,17 @@ export class CriminalRecordsComponent implements OnInit {
warningTypesDetails: any warningTypesDetails: any
warningType() { warningType() {
this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => { this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => {
this.warningTypesDetails = data.result // this.warningTypesDetails = data.result
this.warningTypes = (data.result as any).groupBy((t) => { return t.violationType }); this.warningTypes = (data.result as any).groupBy((t) => { return t.violationType });
}) })
} }
typeChange(e) {
this.warningTypes.forEach(element => {
list: any = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] if (element.key == e) {
this.warningTypesDetails = element
}
});
}
selectedType = '分布' selectedType = '分布'
selectedRankingType = '站点排名' selectedRankingType = '站点排名'
echartClick(type) { echartClick(type) {
@ -337,7 +411,28 @@ export class CriminalRecordsComponent implements OnInit {
} }
} }
// echartClick2(type) {
// this.selectedRankingType = type look(item) {
// } const modal = this.modal.create({
nzContent: GetOutOfLineDetailsComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 1200,
nzBodyStyle: {
'border': '1px solid #6d9cc7',
'border-radius': '0px',
'padding': '0px',
'box-shadow': '0 0 8px 0 #fff',
'background': '#000D21',
},
nzComponentParams: {
data: item
},
nzFooter: null,
nzOnOk: async () => {
}
});
const instance = modal.getContentComponent();
}
} }

2
src/app/pages/plan-admin/plan-admin.component.ts

@ -32,7 +32,7 @@ export class PlanAdminComponent implements OnInit {
fromEvent(this.element.nativeElement.querySelector(`.ant-table-body`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe(async (event: any) => { //监听 DOM 滚动事件 fromEvent(this.element.nativeElement.querySelector(`.ant-table-body`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe(async (event: any) => { //监听 DOM 滚动事件
if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) { if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) {
console.log('需要加载数据了', event) console.log('需要加载数据了', event)
this.SkipCount += 100 this.SkipCount = String(Number(this.SkipCount) + 50)
await this.getGasStation() await this.getGasStation()
} }
}); });

Loading…
Cancel
Save