Browse Source

[完善]摄像头禁用功能

develop
邵佳豪 3 years ago
parent
commit
afb83d102a
  1. 2
      src/app/http-interceptors/base-interceptor.ts
  2. 4
      src/app/system-management/host-config/addcamera/addcamera.component.html
  3. 4
      src/app/system-management/host-config/addcamera/addcamera.component.ts
  4. 13
      src/app/system-management/host-config/host-config.component.html
  5. 54
      src/app/system-management/host-config/host-config.component.ts
  6. 4
      src/app/system-management/navigation/navigation.component.html
  7. 4
      src/app/system-management/status-monitoring/status-monitoring.component.html

2
src/app/http-interceptors/base-interceptor.ts

@ -65,7 +65,7 @@ export class BaseInterceptor implements HttpInterceptor {
return
}
if (error.status === 400) {
this.message.create('error', `请核对您的输入信息或格式是否正确!`);
this.message.create('error', error.error);
return
}
if (error.status === 503) {

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

@ -43,7 +43,7 @@
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<!-- <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="type">序号</nz-form-label>
<nz-form-control>
<nz-select formControlName="order" nzPlaceHolder="请选择序号">
@ -70,6 +70,6 @@
<nz-option [nzValue]="20" nzLabel="20"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</nz-form-item> -->
</form>
</div>

4
src/app/system-management/host-config/addcamera/addcamera.component.ts

@ -21,7 +21,7 @@ export class AddcameraComponent implements OnInit {
password: [null, [Validators.required]],
uri: [null, [Validators.required]],
type: [null, [Validators.required]],
order: [null, [Validators.required]],
// order: [null, [Validators.required]],
});
}
@ -37,7 +37,7 @@ export class MyValidators extends Validators {
return null;
}
return isPassword(value) ? null : { mobile: { 'zh-cn': `名称只能是汉字、大小写英文、数字,不能使用特殊字符`, en: `Password phone number is not valid` } };
return isPassword(value) ? null : { mobile: { 'zh-cn': `名称只能是汉字、大小写英文、数字,不能使用特殊字符`, en: `not valid` } };
}
}

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

@ -16,6 +16,7 @@
<th>地址</th>
<th>类型</th>
<th>标注情况</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
@ -35,9 +36,17 @@
{{item.dimensionedPoints ? '已标注' : '未标注'}}
</ng-template>
</td>
<td>{{ item.isEnabled ? '已启用' : '已禁用'}}</td>
<td>
<span class="blue" style="margin-right: 12px;" (click)="editCamera(item)">编辑</span>
<span class="blue" style="margin-right: 12px;" [ngClass]="{'forbid': item.type == 1}" (click)="label(item)">标注</span>
<span class="blue" style="margin-right: 12px;" [ngClass]="{'forbid': item.type == 1}"
(click)="label(item)">标注</span>
<ng-container *ngIf="item.isEnabled; else elseTemplate2">
<span class="red" style="margin-right: 12px;" (click)="forbidden(item)">禁用</span>
</ng-container>
<ng-template #elseTemplate2>
<span class="blue" style="margin-right: 12px;color: rgb(26, 173, 26);" (click)="forbidden(item)">启用</span>
</ng-template>
<span class="red" (click)="deleteCamera(item)">删除</span>
</td>
</tr>
@ -54,4 +63,4 @@
<div class="rightbox">
</div>
</div>
</div>

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

@ -18,7 +18,8 @@ interface Camera {
uri: string;
type: number;
order: number;
dimensionedPoints: string
dimensionedPoints: string,
isEnabled: boolean
}
@Component({
@ -93,7 +94,7 @@ export class HostConfigComponent implements OnInit {
nzComponentParams: {},
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise(resolve => {
await new Promise((resolve, rejects) => {
console.log('表单信息', instance.validateForm)
let body = {
name: instance.validateForm.value.name,
@ -103,14 +104,20 @@ export class HostConfigComponent implements OnInit {
type: instance.validateForm.value.type,
organizationId: this.orId,
edgeDeviceId: this.hostId,
order: instance.validateForm.value.order,
// order: instance.validateForm.value.order,
}
this.http.post('/api/Cameras', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getCamera()
this.isSourceYaml = false
return true
this.http.post('/api/Cameras', body).subscribe({
next: data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getCamera()
this.isSourceYaml = false
return true
},
error: (err) => {
rejects(err)
return false
}
})
})
} else {
@ -264,12 +271,25 @@ export class HostConfigComponent implements OnInit {
this.router.navigate(['/system/host/camera/configForm'], { queryParams: { 'hostId': this.hostId, 'orId': this.orId } })
}
forbidden(item) {
console.log(item)
let body = {
isEnabled: !item.isEnabled,
}
this.http.put(`/api/Cameras/${item.id}`, body).subscribe(data => {
this.message.create('success', '修改成功!');
this.getCamera()
})
}
sourceYaml() {
let copyListOfData = JSON.parse(JSON.stringify(this.listOfData))
copyListOfData = copyListOfData.filter((item, i) => {
return item.isEnabled;
})
let config4 = `video_rate: 5
inference_buffer_second: 6
sources:`
this.listOfData.forEach((item: any, index) => {
copyListOfData.forEach((item: any, index) => {
config4 += `
- name: '${item.name}'
user: '${item.user}'
@ -331,8 +351,13 @@ sources:`
}
//整理配置文件数据
disposalData() {
console.log(this.listOfData)
let copyListOfData = JSON.parse(JSON.stringify(this.listOfData))
copyListOfData = copyListOfData.filter((item, i) => {
return item.isEnabled;
})
console.log(copyListOfData)
let config1 = `[property]
enable=1
@ -352,10 +377,9 @@ logging_interval : 600
`
let xieyouqu = []
let order
this.listOfData.forEach((item: any, index) => {
copyListOfData.forEach((item: any, index) => {
if (item.type == 2) {
xieyouqu.push(item)
// console.log('xxxxxxxxx',item.order)
order = item.order
}
@ -418,7 +442,7 @@ mode=strict
jingdian = '0,0,0,0'
}
(order != undefined) ? null : order = this.listOfData[this.listOfData.length - 1].order + 1
(order != undefined) ? null : order = copyListOfData[copyListOfData.length - 1].order + 1
console.log('泄油管区域', xieyouguan)
console.log('静电接地', jingdian)
config2 = `# The all in one config file.

4
src/app/system-management/navigation/navigation.component.html

@ -21,8 +21,8 @@
src="../../../assets/images/icon/push.png" alt="">边缘盒子更新</li>
<li [routerLink]="['/system/statusMonitoring']" routerLinkActive="router-link-active"><img
src="../../../assets/images/icon/push.png" alt="">边缘盒子监控</li>
<li [routerLink]="['/system/kafka']" routerLinkActive="router-link-active"><img
src="../../../assets/images/icon/push.png" alt="">kafka检查</li>
<!-- <li [routerLink]="['/system/kafka']" routerLinkActive="router-link-active"><img
src="../../../assets/images/icon/push.png" alt="">kafka检查</li> -->
</ul>
</div>
</nz-sider>

4
src/app/system-management/status-monitoring/status-monitoring.component.html

@ -45,11 +45,11 @@
</nz-form-item>
<button nz-button nzType="primary" type="button" [disabled]="setOfCheckedId.size === 0"
[nzLoading]="loading == 'primary'" (click)="sendRequest('RestartApps')">
[nzLoading]="loading == 'RestartApps'" (click)="sendRequest('RestartApps')">
重启识别程序
</button>
<button nz-button nzType="primary" type="button" [disabled]="setOfCheckedId.size === 0"
[nzLoading]="loading == 'primary'" (click)="sendRequest('RestartMonitors')">
[nzLoading]="loading == 'RestartMonitors'" (click)="sendRequest('RestartMonitors')">
重启监控程序
</button>
</form>

Loading…
Cancel
Save