From cf07fa301531d9525f4198758f6d9f69418d4b71 Mon Sep 17 00:00:00 2001 From: liuxianghui <519646741@qq.com> Date: Wed, 1 Dec 2021 16:07:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AF=B9=E6=8E=A5superadmin=E5=92=8C?= =?UTF-8?q?=E5=86=85=E9=83=A8=E5=88=B6=E4=BD=9C=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/babylon/controller/mode-manager.ts | 2 +- src/app/pages/init3D.guard.ts | 13 +++++++++++-- src/app/pages/plan/plan.component.ts | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/babylon/controller/mode-manager.ts b/src/app/babylon/controller/mode-manager.ts index 146f793..8b28322 100644 --- a/src/app/babylon/controller/mode-manager.ts +++ b/src/app/babylon/controller/mode-manager.ts @@ -28,7 +28,7 @@ export class ModeManager { /** * 调试模式 */ - public static isDebug = true; + public static isDebug = false; diff --git a/src/app/pages/init3D.guard.ts b/src/app/pages/init3D.guard.ts index 651a426..4f4758c 100644 --- a/src/app/pages/init3D.guard.ts +++ b/src/app/pages/init3D.guard.ts @@ -10,12 +10,21 @@ import { NzMessageService } from 'ng-zorro-antd/message'; }) export class init3DGuard implements CanActivate { - constructor(private router: Router, private http: HttpClient, private message: NzMessageService,) { } + constructor(private router: Router, private http: HttpClient, private message: NzMessageService,) { } // 路由守卫 canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot,): Promise { return this.getGasStationBaseInfo().then((res: any) => { sessionStorage.setItem("3dSceneData", JSON.stringify(res)) + + if (true) //是superadmin,是内部制作账号 + { + ModeManager.s_isMakeMode = true; + } + else { + ModeManager.s_isMakeMode = true; + } + let isMakeMode = ModeManager.s_isMakeMode if (isMakeMode || res.hasBuildingInfo) { return true @@ -30,7 +39,7 @@ export class init3DGuard implements CanActivate { getGasStationBaseInfo() { return new Promise((resolve, reject) => { let params = { organizationUnitId: (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization.id } - this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any)=>{ + this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any) => { resolve(data.result) }) }) diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 3f662bd..b8258ed 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -63,6 +63,7 @@ export class PlanComponent implements OnInit { ServeManager.Init(this.buildingBISrv, this.objectsSrv); this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement; this.game.init(this.canvas); + this.companyData = (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization || {} let editMode = sessionStorage.getItem('isGasStation') if (editMode == 'false') { @@ -72,6 +73,7 @@ export class PlanComponent implements OnInit { this.editMode = false ModeManager.currentMode = ModeType.Look } + //监听 delete键盘事件 this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => { if (event.keyCode == 46) { //delete From 74ef65b1c652d7999ae06a4f8f4230c672e3ba5b Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 1 Dec 2021 16:19:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=91=84=E5=83=8F=E5=A4=B4=E4=BB=A5=E5=8F=8A=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../criminal-records-admin.component.html | 12 ++-- .../criminal-records-admin.component.ts | 57 +++++++++++++-- .../criminal-records.component.html | 4 +- .../criminal-records.component.ts | 56 +++++++++++++-- .../oil-unloading-process-list.component.ts | 9 ++- .../pages/plan-admin/plan-admin.component.ts | 1 - .../analysis-of-the-host.component.html | 6 +- .../analysis-of-the-host.component.ts | 69 ++++++++++++++++--- .../editcamera/editcamera.component.html | 19 ++++- .../editcamera/editcamera.component.ts | 15 +++- 10 files changed, 208 insertions(+), 40 deletions(-) diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.html b/src/app/pages/criminal-records-admin/criminal-records-admin.component.html index 8984933..606e22a 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.html +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.html @@ -115,7 +115,7 @@
预警级别
-
+
预警类型
@@ -139,7 +139,7 @@
状态
-
+
操作
@@ -161,7 +161,7 @@ Ⅲ级 Ⅳ级
-
+
{{item.violation.violationType}}
@@ -186,8 +186,10 @@ 已处置 未处置
-
- 查看 +
+ 查看 + 处置 + 处置
diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts index 4d70caa..062ca95 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts @@ -11,6 +11,8 @@ 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'; import { OilUnloadingProcessComponent } from '../oil-unloading-process/oil-unloading-process.component'; +import { DispositionComponent } from '../disposition/disposition.component'; +import { NzMessageService } from 'ng-zorro-antd/message'; @Component({ selector: 'app-criminal-records-admin', templateUrl: './criminal-records-admin.component.html', @@ -19,7 +21,7 @@ import { OilUnloadingProcessComponent } from '../oil-unloading-process/oil-unloa export class CriminalRecordsAdminComponent implements OnInit { validateForm!: FormGroup; - constructor(private element: ElementRef, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } + constructor(private element: ElementRef, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { } //饼图 myChart option = { @@ -33,7 +35,7 @@ export class CriminalRecordsAdminComponent implements OnInit { type: 'pie', radius: [88, 116],//内半径外,外半径 left: '0', - top:'8%', + top: '8%', avoidLabelOverlap: false,//防止标签重叠策略 label: {//每一个标签外网延伸的引导说明 show: false, @@ -427,6 +429,7 @@ export class CriminalRecordsAdminComponent implements OnInit { this.totalCount = data.result.totalCount console.log('违规记录列表', data) this.getAggregations() + console.log(this.list.length) }) } @@ -435,9 +438,11 @@ export class CriminalRecordsAdminComponent implements OnInit { 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() + if(this.totalCount > this.list.length){ + console.log('需要加载数据了', event) + this.SkipCount = String(Number(this.SkipCount) + 50) + this.getViolateRecordList() + } } }); } @@ -579,7 +584,47 @@ export class CriminalRecordsAdminComponent implements OnInit { //跳转卸油统计页面 - goOilList(){ + goOilList() { this.router.navigate(['/records/oliunloadinglist']) } + + + dispose(item) { + console.log(item) + const modal = this.modal.create({ + nzContent: DispositionComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 380, + nzBodyStyle: { + 'border': '1px solid #91CCFF', + 'border-radius': '0px', + 'padding': '7px', + 'box-shadow': '0 0 8px 0 #fff', + 'background-image': 'linear-gradient(#003665, #000f25)' + }, + nzComponentParams: {}, + nzFooter: null, + nzClosable: false, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + let body = { + id: item.id, + handleRecord: instance.validateForm.value.content + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '处置成功!'); + item.handleTime = new Date() + return true + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + }, + }); + const instance = modal.getContentComponent(); + } } diff --git a/src/app/pages/criminal-records/criminal-records.component.html b/src/app/pages/criminal-records/criminal-records.component.html index 699701a..2bc1e0f 100644 --- a/src/app/pages/criminal-records/criminal-records.component.html +++ b/src/app/pages/criminal-records/criminal-records.component.html @@ -168,7 +168,9 @@ 未处置
- 查看 + 查看 + 处置 + 处置
diff --git a/src/app/pages/criminal-records/criminal-records.component.ts b/src/app/pages/criminal-records/criminal-records.component.ts index eb1f400..db0e37a 100644 --- a/src/app/pages/criminal-records/criminal-records.component.ts +++ b/src/app/pages/criminal-records/criminal-records.component.ts @@ -8,6 +8,8 @@ import * as moment from 'moment'; import { fromEvent } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { Router } from '@angular/router'; +import { DispositionComponent } from '../disposition/disposition.component'; +import { NzMessageService } from 'ng-zorro-antd/message'; @Component({ selector: 'app-criminal-records', templateUrl: './criminal-records.component.html', @@ -15,7 +17,7 @@ import { Router } from '@angular/router'; }) export class CriminalRecordsComponent implements OnInit { validateForm!: FormGroup; - constructor(private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef) { } + constructor(private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef, private message: NzMessageService) { } myChart: any //左侧饼图 option = { @@ -29,7 +31,7 @@ export class CriminalRecordsComponent implements OnInit { type: 'pie', radius: [88, 116],//内半径外,外半径 left: '0', - top:'8%', + top: '8%', avoidLabelOverlap: false,//防止标签重叠策略 label: {//每一个标签外网延伸的引导说明 show: false, @@ -323,7 +325,7 @@ export class CriminalRecordsComponent implements OnInit { this.getViolateRecordList() - + } //刷新饼图图表数据 num @@ -440,9 +442,11 @@ export class CriminalRecordsComponent implements OnInit { 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() + if(this.totalCount > this.list.length){ + console.log('需要加载数据了', event) + this.SkipCount = String(Number(this.SkipCount) + 50) + this.getViolateRecordList() + } } }); } @@ -528,7 +532,45 @@ export class CriminalRecordsComponent implements OnInit { } - goOilList(){ + goOilList() { this.router.navigate(['/records/petrolStation/oliunloadinglist']) } + dispose(item) { + console.log(item) + const modal = this.modal.create({ + nzContent: DispositionComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 380, + nzBodyStyle: { + 'border': '1px solid #91CCFF', + 'border-radius': '0px', + 'padding': '7px', + 'box-shadow': '0 0 8px 0 #fff', + 'background-image': 'linear-gradient(#003665, #000f25)' + }, + nzComponentParams: {}, + nzFooter: null, + nzClosable: false, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + let body = { + id: item.id, + handleRecord: instance.validateForm.value.content + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '处置成功!'); + item.handleTime = new Date() + return true + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + }, + }); + const instance = modal.getContentComponent(); + } } diff --git a/src/app/pages/oil-unloading-process-list/oil-unloading-process-list.component.ts b/src/app/pages/oil-unloading-process-list/oil-unloading-process-list.component.ts index bb8ab9c..d3032dd 100644 --- a/src/app/pages/oil-unloading-process-list/oil-unloading-process-list.component.ts +++ b/src/app/pages/oil-unloading-process-list/oil-unloading-process-list.component.ts @@ -574,9 +574,12 @@ export class OilUnloadingProcessListComponent implements OnInit { 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() + if (this.totalCount > this.list.length) { + console.log('需要加载数据了', event) + this.SkipCount = String(Number(this.SkipCount) + 50) + this.getViolateRecordList() + } + } }); } diff --git a/src/app/pages/plan-admin/plan-admin.component.ts b/src/app/pages/plan-admin/plan-admin.component.ts index ca4c573..63cc687 100644 --- a/src/app/pages/plan-admin/plan-admin.component.ts +++ b/src/app/pages/plan-admin/plan-admin.component.ts @@ -33,7 +33,6 @@ export class PlanAdminComponent implements OnInit { if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) { console.log('需要加载数据了', event) this.SkipCount = String(Number(this.SkipCount) + 50) - // await this.getGasStation() let params = { StationName: this.validateForm.value.name, OrganizationUnitId: String(this.OrganizationUnitId), diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html index 637c86d..efab5e4 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html @@ -66,7 +66,7 @@ - + \ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts index e0c7ef5..e70c1e4 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts @@ -8,6 +8,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'; import { AddhostComponent } from './addhost/addhost.component'; import { AddcameraComponent } from './addcamera/addcamera.component'; import { EdithostComponent } from './edithost/edithost.component'; +import { EditcameraComponent } from './editcamera/editcamera.component'; @Component({ selector: 'app-analysis-of-the-host', templateUrl: './analysis-of-the-host.component.html', @@ -60,6 +61,7 @@ export class AnalysisOfTheHostComponent implements OnInit { this.nzSelectedKeys = [...this.nzSelectedKeys] this.selectedOilStation = event.node.origin this.getHost() + this.getCamera() } else { this.message.info('只有加油站才可以增加主机'); } @@ -88,7 +90,7 @@ export class AnalysisOfTheHostComponent implements OnInit { } }).subscribe((data: any) => { console.log('摄像头列表', data) - this.listOfDataCamera = data + this.listOfDataCamera = data.result.items }) } @@ -144,12 +146,12 @@ export class AnalysisOfTheHostComponent implements OnInit { await new Promise(resolve => { console.log('表单信息', instance.validateForm) data.hostIPAddress = instance.validateForm.value.ip, - this.http.put('/api/services/app/EdgeDevice/Update', data).subscribe(data => { - resolve(data) - this.message.create('success', '修改成功!'); - this.getHost() - return true - }) + this.http.put('/api/services/app/EdgeDevice/Update', data).subscribe(data => { + resolve(data) + this.message.create('success', '修改成功!'); + this.getHost() + return true + }) }) } else { this.message.create('warning', '请填写完整!'); @@ -197,7 +199,7 @@ export class AnalysisOfTheHostComponent implements OnInit { organizationUnitId: this.selectedOilStation.id, code: instance.validateForm.value.code, name: instance.validateForm.value.name, - description: "", + // description: "", } this.http.post('/api/services/app/Camera/Create', body).subscribe(data => { resolve(data) @@ -218,8 +220,55 @@ export class AnalysisOfTheHostComponent implements OnInit { } editCamera(data) { + console.log(data) + const modal = this.modal.create({ + nzTitle: '编辑加油站摄像头', + nzContent: EditcameraComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 288, + nzComponentParams: { + data: data + }, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + console.log('表单信息', instance.validateForm) + data.name = instance.validateForm.value.name + data.code = instance.validateForm.value.code + this.http.put('/api/services/app/Camera/Update', data).subscribe(data => { + resolve(data) + this.message.create('success', '编辑成功!'); + this.getCamera() + return true + }, err => { + return false + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + }); + const instance = modal.getContentComponent(); } - deleteCamera(data) { - + deleteCamera(item) { + console.log(item) + this.modal.confirm({ + nzTitle: `确定要删除${item.name}这个摄像头吗?`, + nzOkText: '确定', + nzOkType: 'danger', + nzOnOk: () => { + this.http.delete('/api/services/app/Camera/Delete', { + params: { + Id: item.id + } + }).subscribe(data => { + this.message.create('success', '删除成功!'); + this.getCamera() + }) + }, + nzCancelText: '取消' + }); } } diff --git a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html index b2ee9c5..b1d07c8 100644 --- a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html +++ b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html @@ -1 +1,18 @@ -

editcamera works!

+
+
+ + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts index b57a77c..6d3b601 100644 --- a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts +++ b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts @@ -1,4 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-editcamera', @@ -6,10 +9,16 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./editcamera.component.scss'] }) export class EditcameraComponent implements OnInit { - - constructor() { } + @Input() data: any + validateForm!: FormGroup; + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } ngOnInit(): void { + let datacopy = JSON.parse(JSON.stringify(this.data)) + this.validateForm = this.fb.group({ + name: [datacopy.name, [Validators.required]], + code: [datacopy.code, [Validators.required]] + }); } }