Compare commits

...

3 Commits

  1. 2
      src/app/pipe/cameraTypePipe.ts
  2. 1
      src/app/system-management/analysis-of-the-host/addhost/addhost.component.html
  3. 3
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
  4. 1
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
  5. 1
      src/app/system-management/analysis-of-the-host/edithost/edithost.component.html
  6. 1
      src/app/system-management/host-config/addcamera/addcamera.component.html
  7. 1
      src/app/system-management/host-config/editcamera/editcamera.component.html
  8. 5
      src/app/system-management/host-config/host-config.component.html
  9. 100
      src/app/system-management/host-config/host-config.component.ts
  10. 10
      src/app/system-management/image-label-anxin/image-label-anxin.component.html
  11. 92
      src/app/system-management/image-label-anxin/image-label-anxin.component.ts
  12. 2
      src/app/system-management/organization/organization.component.html

2
src/app/pipe/cameraTypePipe.ts

@ -11,7 +11,7 @@ import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'cameraType' }) @Pipe({ name: 'cameraType' })
export class cameraType implements PipeTransform { export class cameraType implements PipeTransform {
transform(value: number): string { transform(value: number): string {
let arr = ['进出口', '加油区', '卸油区', '便利店'] let arr = ['进出口', '加油区', '卸油区', '便利店','办公区']
return arr[value] return arr[value]
} }
} }

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

@ -15,6 +15,7 @@
<nz-option [nzValue]="0" nzLabel="警旗1"></nz-option> <nz-option [nzValue]="0" nzLabel="警旗1"></nz-option>
<nz-option [nzValue]="1" nzLabel="警旗2"></nz-option> <nz-option [nzValue]="1" nzLabel="警旗2"></nz-option>
<nz-option [nzValue]="2" nzLabel="警旗3"></nz-option> <nz-option [nzValue]="2" nzLabel="警旗3"></nz-option>
<nz-option [nzValue]="3" nzLabel="北京展厅"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

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

@ -49,7 +49,8 @@
<tr *ngFor="let data of basicTable.data"> <tr *ngFor="let data of basicTable.data">
<td>{{data.hostIPAddress}}</td> <td>{{data.hostIPAddress}}</td>
<td>!配置状态!</td> <td>!配置状态!</td>
<td>{{data.deviceProvider === 0 ? '警旗1' : data.deviceProvider === 1 ? '警旗2' :'警旗3'}}</td> <td>{{data.deviceProvider === 0 ? '警旗1' : data.deviceProvider === 1 ? '警旗2' : data.deviceProvider === 2
?'警旗3' :'北京展厅'}}</td>
<td class="operation"> <td class="operation">
<a (click)="edit(data)" style="margin-right: 12px;">编辑</a> <a (click)="edit(data)" style="margin-right: 12px;">编辑</a>
<a (click)="config(data)" style="margin-right: 12px;">配置</a> <a (click)="config(data)" style="margin-right: 12px;">配置</a>

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

@ -323,4 +323,5 @@ enum DeviceProvider {
'警旗1' = 0, '警旗1' = 0,
'警旗2' = 1, '警旗2' = 1,
'警旗3' = 2, '警旗3' = 2,
'北京展厅' = 3,
} }

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

@ -15,6 +15,7 @@
<nz-option [nzValue]="0" nzLabel="警旗1"></nz-option> <nz-option [nzValue]="0" nzLabel="警旗1"></nz-option>
<nz-option [nzValue]="1" nzLabel="警旗2"></nz-option> <nz-option [nzValue]="1" nzLabel="警旗2"></nz-option>
<nz-option [nzValue]="2" nzLabel="警旗3"></nz-option> <nz-option [nzValue]="2" nzLabel="警旗3"></nz-option>
<nz-option [nzValue]="3" nzLabel="北京展厅"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

1
src/app/system-management/host-config/addcamera/addcamera.component.html

@ -40,6 +40,7 @@
<nz-option [nzValue]="1" nzLabel="加油区"></nz-option> <nz-option [nzValue]="1" nzLabel="加油区"></nz-option>
<nz-option [nzValue]="2" nzLabel="卸油区"></nz-option> <nz-option [nzValue]="2" nzLabel="卸油区"></nz-option>
<nz-option [nzValue]="3" nzLabel="便利店"></nz-option> <nz-option [nzValue]="3" nzLabel="便利店"></nz-option>
<nz-option [nzValue]="4" nzLabel="办公区"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

1
src/app/system-management/host-config/editcamera/editcamera.component.html

@ -40,6 +40,7 @@
<nz-option [nzValue]="1" nzLabel="加油区"></nz-option> <nz-option [nzValue]="1" nzLabel="加油区"></nz-option>
<nz-option [nzValue]="2" nzLabel="卸油区"></nz-option> <nz-option [nzValue]="2" nzLabel="卸油区"></nz-option>
<nz-option [nzValue]="3" nzLabel="便利店"></nz-option> <nz-option [nzValue]="3" nzLabel="便利店"></nz-option>
<nz-option [nzValue]="4" nzLabel="办公区"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

5
src/app/system-management/host-config/host-config.component.html

@ -35,7 +35,7 @@
<span *ngIf="hostType === '警旗2'"> <span *ngIf="hostType === '警旗2'">
{{item.dimensionedPointsHuanghai ? '已标注' : '未标注'}} {{item.dimensionedPointsHuanghai ? '已标注' : '未标注'}}
</span> </span>
<span *ngIf="hostType === '警旗3'"> <span *ngIf="hostType === '警旗3' || hostType === '北京展厅'">
{{item.dimensionedPointsAnxin ? '已标注' : '未标注'}} {{item.dimensionedPointsAnxin ? '已标注' : '未标注'}}
</span> </span>
</td> </td>
@ -67,6 +67,9 @@
<div class="footer" *ngIf="hostType === '警旗3'"> <div class="footer" *ngIf="hostType === '警旗3'">
<button nz-button nzType="primary" (click)="configToAx()">下发安信data.yaml配置</button> <button nz-button nzType="primary" (click)="configToAx()">下发安信data.yaml配置</button>
</div> </div>
<div class="footer" *ngIf="hostType === '北京展厅'">
<button nz-button nzType="primary" (click)="configToAx()">下发北京展厅data.yaml配置</button>
</div>
</div> </div>
</div> </div>
<div class="rightbox"> <div class="rightbox">

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

@ -307,7 +307,7 @@ export class HostConfigComponent implements OnInit {
modal.afterClose.subscribe((result) => { modal.afterClose.subscribe((result) => {
this.ngOnInit(); this.ngOnInit();
}); });
} else if (this.hostType == '警旗3') { } else if (this.hostType == '警旗3' || this.hostType == '北京展厅') {
const element = document.documentElement; const element = document.documentElement;
if (element.requestFullscreen) { if (element.requestFullscreen) {
//进入全屏 //进入全屏
@ -1516,8 +1516,12 @@ rule_threshold:
let data = this.configJsonToAx(); let data = this.configJsonToAx();
console.log(data); console.log(data);
// return; // return;
let title =
this.hostType === '北京展厅'
? '下发北京展厅配置'
: '下发安信config.json配置';
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '下发安信config.json配置', nzTitle: title,
nzContent: AnxinConfigComponent, nzContent: AnxinConfigComponent,
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 1000, nzWidth: 1000,
@ -1532,7 +1536,15 @@ rule_threshold:
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
console.log('表单信息', instance.validateForm); console.log('表单信息', instance.validateForm);
let body = { let body = {
configFiles: [{ name: 'data.yaml', content: instance.datacopy }], configFiles: [
{
name:
this.hostType === '北京展厅'
? 'bjzhanting.yaml'
: 'data.yaml',
content: instance.datacopy,
},
],
}; };
this.http.put(`/api/EdgeDevices/${this.hostId}`, body).subscribe({ this.http.put(`/api/EdgeDevices/${this.hostId}`, body).subscribe({
next: (data) => { next: (data) => {
@ -1541,7 +1553,10 @@ rule_threshold:
this.getHostData(); this.getHostData();
let params = { let params = {
edgeDeviceId: this.hostId, edgeDeviceId: this.hostId,
fileName: 'data.yaml', fileName:
this.hostType === '北京展厅'
? 'bjzhanting.yaml'
: 'data.yaml',
}; };
this.http this.http
.put('/api/EdgeDevices/Commands/PushFile', '', { .put('/api/EdgeDevices/Commands/PushFile', '', {
@ -1565,7 +1580,52 @@ rule_threshold:
} }
configJsonToAx() { configJsonToAx() {
let data = { let data;
if (this.hostType === '北京展厅') {
data = {
server: null,
obs: null,
userInfo: {
user: '',
password: '',
},
ip: this.hostData.hostIPAddress,
imgScale: 1.5,
cpuRtsp: false,
pipline: '',
workerTag: ['worker'],
caps: [],
params: {
smoke_sleep_m: 1,
smoke_continue_s: 1,
call_sleep_m: 1,
call_continue_s: 1,
pay_sleep_m: 5,
pay_continue_s: 3,
oilin_sleep_m: 5,
oilin_continue_s: 1,
stop_step_s: 60,
stop_continue_m: 30,
sameCarThreshold: 5,
smog_sleep_m: 5,
smog_continue_s: 3,
fire_sleep_m: 5,
fire_continue_s: 3,
geli_continue_s: 1,
miehuo_continue_s: 1,
gather_dis_min: 0.15,
gather_err_num: 3,
gather_continue_s: 0.5,
gather_sleep: 1,
helmeted_continue_s: 3,
workerIn_continue_s: 3,
workerOut_continue_s: 5,
workerSleep_continue_s: 3,
lossScore: 40, //没检测到物体的惩罚分数
},
};
} else {
data = {
server: null, server: null,
obs: null, obs: null,
userInfo: { userInfo: {
@ -1597,14 +1657,21 @@ rule_threshold:
lossScore: 40, //没检测到物体的惩罚分数 lossScore: 40, //没检测到物体的惩罚分数
}, },
}; };
console.log(this.hostData); }
// console.log(this.hostData);
//如果保存过安信的配置文件 //如果保存过安信的配置文件
let yamlname;
this.hostType === '北京展厅'
? (yamlname = 'bjzhanting.yaml')
: (yamlname = 'data.yaml');
if ( if (
this.hostData.configFiles && this.hostData.configFiles &&
this.hostData.configFiles.find((v) => v.name === 'data.yaml') this.hostData.configFiles.find((v) => v.name === yamlname)
) { ) {
let oldFile = yaml.load( let oldFile = yaml.load(
this.hostData.configFiles.find((v) => v.name === 'data.yaml').content this.hostData.configFiles.find((v) => v.name === yamlname).content
); );
// console.log('曾经保存过安信的配置文件', oldFile); // console.log('曾经保存过安信的配置文件', oldFile);
for (const key in oldFile) { for (const key in oldFile) {
@ -1626,9 +1693,14 @@ rule_threshold:
} else { } else {
let server; let server;
let obs; let obs;
console.log('location.origin', location.origin);
if (location.origin.indexOf('121') !== -1) { if (location.origin.indexOf('121') !== -1) {
server = 'http://121.36.37.70:8208'; if (location.origin.indexOf('8225') !== -1) {
obs = 'http://121.36.37.70:8226';
} else {
obs = 'http://121.36.37.70:8906'; obs = 'http://121.36.37.70:8906';
}
server = 'http://121.36.37.70:8208';
} else { } else {
server = 'http://10.156.134.53:8208'; server = 'http://10.156.134.53:8208';
obs = 'https://znaq.sinochemoilmarketing.com'; obs = 'https://znaq.sinochemoilmarketing.com';
@ -1641,13 +1713,15 @@ rule_threshold:
if (item.isEnabled) { if (item.isEnabled) {
let type = null; let type = null;
item.type === 0 item.type === 0
? (type = 2) ? (type = 2) //进出口
: item.type === 1 : item.type === 1
? (type = 1) ? (type = 1) //加油区
: item.type === 2 : item.type === 2
? (type = 0) ? (type = 0) //卸油区
: item.type === 3 : item.type === 3
? (type = 4) ? (type = 4) //收银区
: item.type === 4
? (type = 5) //办公区
: null; : null;
let areas = []; let areas = [];

10
src/app/system-management/image-label-anxin/image-label-anxin.component.html

@ -6,7 +6,7 @@
<label class="leftTitle" *ngIf="markType === 1">加油区</label> <label class="leftTitle" *ngIf="markType === 1">加油区</label>
<label class="leftTitle" *ngIf="markType === 2">卸油区</label> <label class="leftTitle" *ngIf="markType === 2">卸油区</label>
<label class="leftTitle" *ngIf="markType === 3">便利店</label> <label class="leftTitle" *ngIf="markType === 3">便利店</label>
<label class="leftTitle" *ngIf="markType === 4">办公区</label>
<button nz-button [ngClass]="{selectBtn: selectedBtn === '进出口'}" (click)="selectedBtn = '进出口'">进出口 <button nz-button [ngClass]="{selectBtn: selectedBtn === '进出口'}" (click)="selectedBtn = '进出口'">进出口
@ -28,6 +28,14 @@
<span class="colorBlock" style="background-color: black;"></span> <span class="colorBlock" style="background-color: black;"></span>
<span class="deleteItem" (click)="clearCanvasItem($event,'卸油区')">删除</span> <span class="deleteItem" (click)="clearCanvasItem($event,'卸油区')">删除</span>
</button> </button>
<button nz-button [ngClass]="{selectBtn: selectedBtn === '办公区'}" (click)="selectedBtn = '办公区'">办公区
<span class="colorBlock" style="background-color: pink;"></span>
<span class="deleteItem" (click)="clearCanvasItem($event,'办公区')">删除</span>
</button>
<button nz-button [ngClass]="{selectBtn: selectedBtn === '工位'}" (click)="selectedBtn = '工位'">工位
<span class="colorBlock" style="background-color: purple;"></span>
<span class="deleteItem" (click)="clearCanvasItem($event,'工位')">删除</span>
</button>
<button nz-button nzType="primary" (click)="anewgetImg()">重新捕获摄像头图片</button> <button nz-button nzType="primary" (click)="anewgetImg()">重新捕获摄像头图片</button>

92
src/app/system-management/image-label-anxin/image-label-anxin.component.ts

@ -1,5 +1,6 @@
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { NzMessageService } from 'ng-zorro-antd/message'; import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
@ -12,7 +13,8 @@ export class ImageLabelAnxinComponent implements OnInit {
constructor( constructor(
private http: HttpClient, private http: HttpClient,
private message: NzMessageService, private message: NzMessageService,
private modal: NzModalService private modal: NzModalService,
private route: ActivatedRoute
) {} ) {}
@Input() cameraId: any; //传递id @Input() cameraId: any; //传递id
@ -29,7 +31,21 @@ export class ImageLabelAnxinComponent implements OnInit {
} }
ngOnInit(): void {} ngOnInit(): void {}
ngAfterContentInit(): void {
this.getImgMarkData()
.then((res: any) => {
this.imgItem = window.URL.createObjectURL(res);
window.setTimeout(() => {
this.initBackgroundImg();
}, 0);
})
.catch((err) => {
this.message.create('error', '获取图片失败!');
window.setTimeout(() => {
this.initBackgroundImg();
}, 0);
});
}
//获取 摄像头图片/标注点位 //获取 摄像头图片/标注点位
getImgMarkData() { getImgMarkData() {
console.log('获取照片', new Date().getTime()); console.log('获取照片', new Date().getTime());
@ -74,22 +90,6 @@ export class ImageLabelAnxinComponent implements OnInit {
}); });
} }
ngAfterContentInit(): void {
this.getImgMarkData()
.then((res: any) => {
this.imgItem = window.URL.createObjectURL(res);
window.setTimeout(() => {
this.initBackgroundImg();
}, 0);
})
.catch((err) => {
this.message.create('error', '获取图片失败!');
window.setTimeout(() => {
this.initBackgroundImg();
}, 0);
});
}
//初始化背景图 //初始化背景图
canvas; canvas;
ctx; ctx;
@ -156,32 +156,6 @@ export class ImageLabelAnxinComponent implements OnInit {
} }
console.log('原始标点数据', this.camerasData.dimensionedPointsAnxin); console.log('原始标点数据', this.camerasData.dimensionedPointsAnxin);
// for (const key in this.camerasData.dimensionedPointsAnxin.rawData) {
// const element = this.camerasData.dimensionedPointsAnxin.rawData[key];
// console.log(key, element);
// if (element.length !== 0) {
// for (let index = 0; index < element.length; index++) {
// const item = element[index];
// console.log(666, item);
// let obj = this.PolygonData[key];
// this.DrawPolygoning = key;
// this.DrawPolygon(
// item.x,
// item.y,
// canvas,
// context,
// obj.Points,
// obj.Circles,
// obj.Allpoints,
// obj.IsDragging,
// obj.IsInOut,
// obj.Color
// );
// }
// }
// this.DrawPolygoning = '';
// }
for ( for (
let key = 0; let key = 0;
key < this.camerasData.dimensionedPointsAnxin.yamlData.length; key < this.camerasData.dimensionedPointsAnxin.yamlData.length;
@ -190,6 +164,9 @@ export class ImageLabelAnxinComponent implements OnInit {
const element = this.camerasData.dimensionedPointsAnxin.yamlData[key]; const element = this.camerasData.dimensionedPointsAnxin.yamlData[key];
let name = enum_area[element.type]; let name = enum_area[element.type];
let arr = this.handleArr(element.points); let arr = this.handleArr(element.points);
console.log('arr', arr);
for (let index = 0; index < arr.length; index++) { for (let index = 0; index < arr.length; index++) {
const item = arr[index]; const item = arr[index];
let obj = this.PolygonData[name]; let obj = this.PolygonData[name];
@ -210,6 +187,7 @@ export class ImageLabelAnxinComponent implements OnInit {
this.DrawPolygoning = ''; this.DrawPolygoning = '';
} }
} }
// 将比例点转换为底图的坐标点
handleArr(arr, n = 2) { handleArr(arr, n = 2) {
const res = []; const res = [];
for (let i = 0; i < arr.length - 1; i += 2) { for (let i = 0; i < arr.length - 1; i += 2) {
@ -306,6 +284,22 @@ export class ImageLabelAnxinComponent implements OnInit {
IsInOut: false, //是否在绘制区域内 IsInOut: false, //是否在绘制区域内
Color: 'black', Color: 'black',
}, },
: {
Points: [], //线段的点的集合
Circles: [], //可拖动圆圈的点的集合
Allpoints: [], //整体移动点位
IsDragging: false, //是否可拖拽
IsInOut: false, //是否在绘制区域内
Color: 'pink',
},
: {
Points: [], //线段的点的集合
Circles: [], //可拖动圆圈的点的集合
Allpoints: [], //整体移动点位
IsDragging: false, //是否可拖拽
IsInOut: false, //是否在绘制区域内
Color: 'purple',
},
}; };
//绘制多边形的方法 //绘制多边形的方法
@ -515,6 +509,8 @@ export class ImageLabelAnxinComponent implements OnInit {
console.log(this.camerasData.dimensionedPointsAnxin); console.log(this.camerasData.dimensionedPointsAnxin);
console.log('标点数据', this.PolygonData); console.log('标点数据', this.PolygonData);
// console.log(999, this.route.snapshot.queryParams.type);
// return;
for (const key in this.PolygonData) { for (const key in this.PolygonData) {
const element = this.PolygonData[key]; const element = this.PolygonData[key];
if (element.Points.length !== 0 && element.Points.length <= 2) { if (element.Points.length !== 0 && element.Points.length <= 2) {
@ -529,6 +525,8 @@ export class ImageLabelAnxinComponent implements OnInit {
: [], : [],
: [], : [],
: [], : [],
: [],
: [],
}; };
this.camerasData.dimensionedPointsAnxin.yamlData = []; this.camerasData.dimensionedPointsAnxin.yamlData = [];
} }
@ -598,8 +596,10 @@ export class ImageLabelAnxinComponent implements OnInit {
} }
enum enum_area { enum enum_area {
'进出口' = 0,
'收银区' = 1,
'加油区' = 2, '加油区' = 2,
'卸油区' = 3, '卸油区' = 3,
'收银区' = 1, '办公区' = 4,
'进出口' = 0, '工位' = 5,
} }

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

@ -17,7 +17,7 @@
</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 nzBlockNode [nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys" nzDraggable nzBlockNode
(nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop"> (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop" [nzTreeTemplate]="nzTreeTemplate">
</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">

Loading…
Cancel
Save