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 return
} }
if (error.status === 400) { if (error.status === 400) {
this.message.create('error', `请核对您的输入信息或格式是否正确!`); this.message.create('error', error.error);
return return
} }
if (error.status === 503) { if (error.status === 503) {

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

@ -43,7 +43,7 @@
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <!-- <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="type">序号</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="type">序号</nz-form-label>
<nz-form-control> <nz-form-control>
<nz-select formControlName="order" nzPlaceHolder="请选择序号"> <nz-select formControlName="order" nzPlaceHolder="请选择序号">
@ -70,6 +70,6 @@
<nz-option [nzValue]="20" nzLabel="20"></nz-option> <nz-option [nzValue]="20" nzLabel="20"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item> -->
</form> </form>
</div> </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]], password: [null, [Validators.required]],
uri: [null, [Validators.required]], uri: [null, [Validators.required]],
type: [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 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> <th>标注情况</th>
<th>状态</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
@ -35,9 +36,17 @@
{{item.dimensionedPoints ? '已标注' : '未标注'}} {{item.dimensionedPoints ? '已标注' : '未标注'}}
</ng-template> </ng-template>
</td> </td>
<td>{{ item.isEnabled ? '已启用' : '已禁用'}}</td>
<td> <td>
<span class="blue" style="margin-right: 12px;" (click)="editCamera(item)">编辑</span> <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> <span class="red" (click)="deleteCamera(item)">删除</span>
</td> </td>
</tr> </tr>
@ -54,4 +63,4 @@
<div class="rightbox"> <div class="rightbox">
</div> </div>
</div> </div>

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

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

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

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

Loading…
Cancel
Save