Browse Source

[完善]完善黄海配置文件

非煤矿业企业安全风险监测预警系统
邵佳豪 2 years ago
parent
commit
e0750a4b75
  1. 2
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
  2. 15
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
  3. 42
      src/app/system-management/host-config/host-config.component.ts
  4. 1
      src/app/system-management/image-label/image-label.component.ts
  5. 10
      src/app/system-management/organization/organization.component.html
  6. 243
      src/app/system-management/organization/organization.component.ts

2
src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html

@ -25,7 +25,9 @@
<div class="lefttop"> <div class="lefttop">
<span>{{selectedOilStation ? selectedOilStation.displayName : '加油站'}} 边缘盒子列表 <span>{{selectedOilStation ? selectedOilStation.displayName : '加油站'}} 边缘盒子列表
<span class="yellowspan">(请从左侧选择加油站)</span> <span class="yellowspan">(请从左侧选择加油站)</span>
<i style="cursor: pointer;" (click)="refresh()" nz-icon nzType="redo" nzTheme="outline"></i>
</span> </span>
</div> </div>
<!-- <div class="righttop" *ngIf="selectedOilStation"> <!-- <div class="righttop" *ngIf="selectedOilStation">
<button nz-button nzType="primary" (click)="addHost()"><i nz-icon nzType="plus-circle" <button nz-button nzType="primary" (click)="addHost()"><i nz-icon nzType="plus-circle"

15
src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts

@ -118,6 +118,21 @@ export class AnalysisOfTheHostComponent implements OnInit {
}); });
} }
refresh() {
if (!this.selectedOilStation.id) {
return;
}
this.http.put('/api/GasStations/SyncAllGasStations', null).subscribe({
next: (data) => {
this.message.success('同步成功');
this.getHost();
},
error: (err) => {
this.message.error('同步失败');
},
});
}
ngAfterViewInit(): void {} ngAfterViewInit(): void {}
//新增边缘盒子 //新增边缘盒子

42
src/app/system-management/host-config/host-config.component.ts

@ -130,8 +130,11 @@ export class HostConfigComponent implements OnInit {
// order: instance.validateForm.value.order, // order: instance.validateForm.value.order,
}; };
this.http.post('/api/Cameras', body).subscribe({ this.http.post('/api/Cameras', body).subscribe({
next: (data) => { next: (data: any) => {
resolve(data); resolve(data);
if (this.hostType === '黄海') {
this.anewgetImg(data.id);
}
this.message.create('success', '创建成功!'); this.message.create('success', '创建成功!');
this.getCamera(); this.getCamera();
this.isSourceYaml = false; this.isSourceYaml = false;
@ -175,8 +178,11 @@ export class HostConfigComponent implements OnInit {
edgeDeviceId: this.hostId, edgeDeviceId: this.hostId,
order: instance.validateForm.value.order, order: instance.validateForm.value.order,
}; };
this.http.put(`/api/Cameras/${data.id}`, body).subscribe((data) => { this.http.put(`/api/Cameras/${data.id}`, body).subscribe((mes) => {
resolve(data); if (this.hostType === '黄海') {
this.anewgetImg(data.id);
}
resolve(mes);
this.message.create('success', '编辑成功!'); this.message.create('success', '编辑成功!');
this.getCamera(); this.getCamera();
this.isSourceYaml = false; this.isSourceYaml = false;
@ -191,6 +197,27 @@ export class HostConfigComponent implements OnInit {
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
anewgetImg(id) {
let params = {
cameraId: id,
provider: 1,
};
this.http
.put('/api/Cameras/Commands/CaptureImages', '', { params: params })
.subscribe({
next: (value: Object) => {
// this.message.create(
// 'success',
// '向边缘设备发送请求成功,请过一段时间手动刷新页面!'
// );
console.log('向边缘设备发送拉取图片请求成功');
},
error: (error: HttpErrorResponse) => {},
complete: () => {},
});
}
deleteCamera(item) { deleteCamera(item) {
console.log(item); console.log(item);
this.modal.confirm({ this.modal.confirm({
@ -1186,6 +1213,7 @@ rule_threshold:
}) })
.subscribe({ .subscribe({
next: (data) => { next: (data) => {
console.log('牛逼', JSON.parse(instance.datacopy));
this.message.create('success', `发送文件名成功`); this.message.create('success', `发送文件名成功`);
}, },
}); });
@ -1227,7 +1255,7 @@ rule_threshold:
let objitem: any = { let objitem: any = {
nickName: '进出口', nickName: '进出口',
rtsp: item.uri, rtsp: item.uri,
cameraName: item.name, areaName: item.name,
}; };
if ( if (
item.dimensionedPointsHuanghaiObj && item.dimensionedPointsHuanghaiObj &&
@ -1243,7 +1271,7 @@ rule_threshold:
let objitem: any = { let objitem: any = {
nickName: '加油区', nickName: '加油区',
rtsp: item.uri, rtsp: item.uri,
cameraName: item.name, areaName: item.name,
}; };
if ( if (
item.dimensionedPointsHuanghaiObj && item.dimensionedPointsHuanghaiObj &&
@ -1259,7 +1287,7 @@ rule_threshold:
let objitem: any = { let objitem: any = {
nickName: '卸油区', nickName: '卸油区',
rtsp: item.uri, rtsp: item.uri,
cameraName: item.name, areaName: item.name,
}; };
if ( if (
item.dimensionedPointsHuanghaiObj && item.dimensionedPointsHuanghaiObj &&
@ -1296,7 +1324,7 @@ rule_threshold:
let objitem: any = { let objitem: any = {
nickName: '便利店', nickName: '便利店',
rtsp: item.uri, rtsp: item.uri,
cameraName: item.name, areaName: item.name,
}; };
if ( if (
item.dimensionedPointsHuanghaiObj && item.dimensionedPointsHuanghaiObj &&

1
src/app/system-management/image-label/image-label.component.ts

@ -67,6 +67,7 @@ export class ImageLabelComponent implements OnInit {
anewgetImg() { anewgetImg() {
let params = { let params = {
cameraId: this.cameraId, cameraId: this.cameraId,
provider: 1,
}; };
this.http this.http
.put('/api/Cameras/Commands/CaptureImages', '', { params: params }) .put('/api/Cameras/Commands/CaptureImages', '', { params: params })

10
src/app/system-management/organization/organization.component.html

@ -9,17 +9,15 @@
<nz-input-group nzPrefixIcon="search"> <nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" [(ngModel)]="searchValue" /> <input type="text" nz-input placeholder="请输入单位" [(ngModel)]="searchValue" />
</nz-input-group> </nz-input-group>
<!-- <button nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增</button> -->
</div> </div>
</div> </div>
<div class="treeTitle"> <div class="treeTitle">
<span>组织机构</span> <span>组织机构 <i style="margin-left: 12px;cursor: pointer;" (click)="refresh()" nz-icon nzType="redo"
<!-- <span>操作</span> --> nzTheme="outline"></i></span>
</div> </div>
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" <nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes"
[nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" nzDraggable [nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" nzDraggable nzBlockNode
nzBlockNode (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop"> (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop">
</nz-tree> </nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin"> <ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox"> <div class="nodebox">

243
src/app/system-management/organization/organization.component.ts

@ -1,7 +1,17 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core'; import {
Component,
OnInit,
AfterViewInit,
ViewChild,
ViewContainerRef,
} from '@angular/core';
import { TreeService } from 'src/app/service/tree.service'; import { TreeService } from 'src/app/service/tree.service';
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; import {
NzFormatEmitEvent,
NzTreeComponent,
NzTreeNodeOptions,
} from 'ng-zorro-antd/tree';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message'; import { NzMessageService } from 'ng-zorro-antd/message';
@ -15,20 +25,38 @@ import { CustomReuseStrategy } from 'src/app/CustomReuseStrategy';
@Component({ @Component({
selector: 'app-organization', selector: 'app-organization',
templateUrl: './organization.component.html', templateUrl: './organization.component.html',
styleUrls: ['./organization.component.scss'] styleUrls: ['./organization.component.scss'],
}) })
export class OrganizationComponent implements OnInit { export class OrganizationComponent implements OnInit {
validateForm!: FormGroup; validateForm!: FormGroup;
constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } constructor(
private fb: FormBuilder,
private http: HttpClient,
private toTree: TreeService,
private modal: NzModalService,
private message: NzMessageService,
private viewContainerRef: ViewContainerRef
) {}
ngOnInit(): void { ngOnInit(): void {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
search: [null] search: [null],
}); });
this.getAllOrganization() this.getAllOrganization();
}
// this.deleteRouteSnapshot(); refresh() {
this.http.put('/api/Organizations/SyncAllOrganizations', null).subscribe({
next: (data) => {
this.message.success('同步成功');
this.getAllOrganization();
},
error: (err) => {
this.message.error('同步失败');
},
});
} }
deleteRouteSnapshot() { deleteRouteSnapshot() {
CustomReuseStrategy.deleteRouteSnapshot('/system/host'); CustomReuseStrategy.deleteRouteSnapshot('/system/host');
} }
@ -43,44 +71,46 @@ export class OrganizationComponent implements OnInit {
//获取所有组织机构 //获取所有组织机构
searchValue = ''; searchValue = '';
nzExpandAll = false; nzExpandAll = false;
totalCount: string totalCount: string;
allOrList: any allOrList: any;
getAllOrganization() { getAllOrganization() {
let OrganizationUnitId = '' let OrganizationUnitId = '';
let params = { let params = {
// OrganizationUnitId: OrganizationUnitId, // OrganizationUnitId: OrganizationUnitId,
// IsContainsChildren: "true" // IsContainsChildren: "true"
ContainsChildren: true, ContainsChildren: true,
pageSize: 9999 pageSize: 9999,
} };
this.http.get('/api/Organizations', { this.http
params: params .get('/api/Organizations', {
}).subscribe((data: any) => { params: params,
console.log('组织机构列表', data) })
this.totalCount = data.totalCount .subscribe((data: any) => {
data.items.forEach(element => { console.log('组织机构列表', data);
element.key = element.id this.totalCount = data.totalCount;
element.title = element.name data.items.forEach((element) => {
element.selectable = false element.key = element.id;
if (element.isGasStation) { element.title = element.name;
element.isLeaf = true element.selectable = false;
} if (element.isGasStation) {
element.isLeaf = true;
}
});
this.allOrList = data.items;
this.nodes = [...this.toTree.toTree(data.items)];
this.defaultExpandedKeys.length == 0
? (this.defaultExpandedKeys = [this.nodes[0].id])
: (this.defaultExpandedKeys = [...this.defaultExpandedKeys]);
}); });
this.allOrList = data.items
this.nodes = [...this.toTree.toTree(data.items)]
this.defaultExpandedKeys.length == 0 ? this.defaultExpandedKeys = [this.nodes[0].id] : this.defaultExpandedKeys = [...this.defaultExpandedKeys]
})
} }
@ViewChild('nzTreeComponent', { static: false })
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; nzTreeComponent!: NzTreeComponent;
defaultExpandedKeys = []; defaultExpandedKeys = [];
nodes: any[] = [] nodes: any[] = [];
addOr(node?: any) { addOr(node?: any) {
// console.log(node.key) // console.log(node.key)
@ -92,37 +122,32 @@ export class OrganizationComponent implements OnInit {
nzComponentParams: {}, nzComponentParams: {},
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise(resolve => { await new Promise((resolve) => {
let body = { let body = {
name: instance.validateForm.value.name, name: instance.validateForm.value.name,
parentId: node ? node.key : null, parentId: node ? node.key : null,
isGasStation: instance.validateForm.value.isGasStation isGasStation: instance.validateForm.value.isGasStation,
} };
this.http.post('/api/Organizations', body).subscribe(data => { this.http.post('/api/Organizations', body).subscribe((data) => {
resolve(data) resolve(data);
this.message.create('success', '创建成功!'); this.message.create('success', '创建成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key) this.defaultExpandedKeys.push(item.key);
}) });
this.getAllOrganization() this.getAllOrganization();
return true return true;
}, err => { });
resolve(err) });
this.message.create('warning', '创建失败');
return false
})
})
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create('warning', '请填写完整!');
return false return false;
} }
} },
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
editOr(node) { editOr(node) {
console.log(node) console.log(node);
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '编辑组织机构', nzTitle: '编辑组织机构',
nzContent: EditorComponent, nzContent: EditorComponent,
@ -133,36 +158,34 @@ export class OrganizationComponent implements OnInit {
}, },
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise(resolve => { await new Promise((resolve) => {
let body = { let body = {
name: instance.validateForm.value.name, name: instance.validateForm.value.name,
isGasStation: instance.validateForm.value.isGasStation, isGasStation: instance.validateForm.value.isGasStation,
parentId: node.origin.parentId parentId: node.origin.parentId,
} };
this.http.put(`/api/Organizations/${node.origin.id}`, body).subscribe(data => { this.http
resolve(data) .put(`/api/Organizations/${node.origin.id}`, body)
this.message.create('success', '编辑成功!'); .subscribe((data) => {
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { resolve(data);
this.defaultExpandedKeys.push(item.key) this.message.create('success', '编辑成功!');
}) this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.getAllOrganization() this.defaultExpandedKeys.push(item.key);
return true });
}, err => { this.getAllOrganization();
resolve(err) return true;
this.message.create('warning', '编辑失败'); });
return false });
})
})
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create('warning', '请填写完整!');
return false return false;
} }
} },
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
deleteOr(item) { deleteOr(item) {
console.log(item) console.log(item);
if (item.origin.children && item.origin.children.length != 0) { if (item.origin.children && item.origin.children.length != 0) {
this.message.create('warning', '请先删除所有子节点'); this.message.create('warning', '请先删除所有子节点');
} else { } else {
@ -171,66 +194,64 @@ export class OrganizationComponent implements OnInit {
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'primary', nzOkType: 'primary',
nzOnOk: () => { nzOnOk: () => {
this.http.delete(`/api/Organizations/${item.origin.id}`).subscribe(data => { this.http
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { .delete(`/api/Organizations/${item.origin.id}`)
this.defaultExpandedKeys.push(item.key) .subscribe((data) => {
}) this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.getAllOrganization() this.defaultExpandedKeys.push(item.key);
this.message.create('success', '删除成功!'); });
}) this.getAllOrganization();
this.message.create('success', '删除成功!');
});
}, },
nzCancelText: '取消', nzCancelText: '取消',
nzOnCancel: () => { nzOnCancel: () => {},
}
}); });
} }
} }
nzEvent(event: NzFormatEmitEvent): void { nzEvent(event: NzFormatEmitEvent): void {
console.log('event', event) console.log('event', event);
if (this.isDrag) { if (this.isDrag) {
let parentId let parentId;
if (this.pos == 0) {//目标节点内部 if (this.pos == 0) {
parentId = event.node.key //目标节点内部
parentId = event.node.key;
} else { } else {
if (event.node.level == 0) { if (event.node.level == 0) {
parentId = null parentId = null;
} else { } else {
parentId = event.node.origin.parentId parentId = event.node.origin.parentId;
} }
} }
let body = { let body = {
parentId: parentId, parentId: parentId,
name: event.dragNode.origin.name, name: event.dragNode.origin.name,
isGasStation: event.dragNode.origin.isGasStation isGasStation: event.dragNode.origin.isGasStation,
} };
this.http.put(`/api/Organizations/${event.dragNode.origin.id}`, body).subscribe(data => { this.http
this.message.create('success', '拖拽成功!'); .put(`/api/Organizations/${event.dragNode.origin.id}`, body)
this.nzTreeComponent.getExpandedNodeList().forEach((item) => { .subscribe((data) => {
this.defaultExpandedKeys.push(item.key) this.message.create('success', '拖拽成功!');
}) this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.getAllOrganization() this.defaultExpandedKeys.push(item.key);
return true });
}, err => { this.getAllOrganization();
this.message.create('warning', '拖拽失败'); return true;
return false });
})
} }
} }
isDrag //是否可以拖动 isDrag; //是否可以拖动
pos//放置位置 pos; //放置位置
beforeDrop = (arg: NzFormatBeforeDropEvent) => { beforeDrop = (arg: NzFormatBeforeDropEvent) => {
console.log('arg', arg) console.log('arg', arg);
if (arg.pos != 0 && arg.node.level === 0) {//如果为数据节点则不允许拖到一级节点 if (arg.pos != 0 && arg.node.level === 0) {
//如果为数据节点则不允许拖到一级节点
this.message.create('warning', '不允许拖拽到一级节点'); this.message.create('warning', '不允许拖拽到一级节点');
this.isDrag = false this.isDrag = false;
return of(false); return of(false);
} else { } else {
return of(true) return of(true);
} }
} };
} }

Loading…
Cancel
Save