|
|
|
@ -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.
|
|
|
|
|