|
|
@ -11,7 +11,7 @@ interface Camera { |
|
|
|
name: string; |
|
|
|
name: string; |
|
|
|
user: string; |
|
|
|
user: string; |
|
|
|
password: string; |
|
|
|
password: string; |
|
|
|
url: string; |
|
|
|
uri: string; |
|
|
|
type: number |
|
|
|
type: number |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -31,22 +31,18 @@ export class HostConfigComponent implements OnInit { |
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
this.hostId = this.route.snapshot.queryParams.hostId |
|
|
|
this.hostId = this.route.snapshot.queryParams.hostId |
|
|
|
this.orId = this.route.snapshot.queryParams.orId |
|
|
|
this.orId = this.route.snapshot.queryParams.orId |
|
|
|
|
|
|
|
this.getCamera() |
|
|
|
} |
|
|
|
} |
|
|
|
listOfData: Camera[] = [ |
|
|
|
listOfData: Camera[] = []; |
|
|
|
{ |
|
|
|
|
|
|
|
name: '1', |
|
|
|
|
|
|
|
user: 'John Brown', |
|
|
|
|
|
|
|
password: '32', |
|
|
|
|
|
|
|
url: 'New York No. 1 Lake Park', |
|
|
|
|
|
|
|
type: 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
goback() { |
|
|
|
goback() { |
|
|
|
history.go(-1) |
|
|
|
history.go(-1) |
|
|
|
} |
|
|
|
} |
|
|
|
//摄像头
|
|
|
|
//摄像头
|
|
|
|
getCamera() { |
|
|
|
getCamera() { |
|
|
|
|
|
|
|
this.http.get('/api/Cameras').subscribe((data: any) => { |
|
|
|
|
|
|
|
this.listOfData = data.items |
|
|
|
|
|
|
|
console.log('摄像头列表', data.items) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
addCamera() { |
|
|
|
addCamera() { |
|
|
|
const modal = this.modal.create({ |
|
|
|
const modal = this.modal.create({ |
|
|
@ -59,20 +55,20 @@ export class HostConfigComponent implements OnInit { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
await new Promise(resolve => { |
|
|
|
await new Promise(resolve => { |
|
|
|
console.log('表单信息', instance.validateForm) |
|
|
|
console.log('表单信息', instance.validateForm) |
|
|
|
// let body = {
|
|
|
|
let body = { |
|
|
|
// organizationUnitId: '111',
|
|
|
|
name: instance.validateForm.value.name, |
|
|
|
// ipAdress: instance.validateForm.value.ip,
|
|
|
|
user: instance.validateForm.value.user, |
|
|
|
// code: instance.validateForm.value.code,
|
|
|
|
password: instance.validateForm.value.password, |
|
|
|
// name: instance.validateForm.value.name,
|
|
|
|
uri: instance.validateForm.value.uri, |
|
|
|
// }
|
|
|
|
type: instance.validateForm.value.type, |
|
|
|
// this.http.post('/api/services/app/Camera/Create', body).subscribe(data => {
|
|
|
|
organizationId: this.orId |
|
|
|
// resolve(data)
|
|
|
|
} |
|
|
|
// this.message.create('success', '创建成功!');
|
|
|
|
this.http.post('/api/Cameras', body).subscribe(data => { |
|
|
|
// this.getCamera()
|
|
|
|
resolve(data) |
|
|
|
// return true
|
|
|
|
this.message.create('success', '创建成功!'); |
|
|
|
// }, err => {
|
|
|
|
this.getCamera() |
|
|
|
// return false
|
|
|
|
return true |
|
|
|
// })
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
@ -96,17 +92,20 @@ export class HostConfigComponent implements OnInit { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
await new Promise(resolve => { |
|
|
|
await new Promise(resolve => { |
|
|
|
console.log('表单信息', instance.validateForm) |
|
|
|
console.log('表单信息', instance.validateForm) |
|
|
|
// data.name = instance.validateForm.value.name
|
|
|
|
let body = { |
|
|
|
// data.code = instance.validateForm.value.code
|
|
|
|
name: instance.validateForm.value.name, |
|
|
|
// data.ipAdress = instance.validateForm.value.ip
|
|
|
|
user: instance.validateForm.value.user, |
|
|
|
// this.http.put('/api/services/app/Camera/Update', data).subscribe(data => {
|
|
|
|
password: instance.validateForm.value.password, |
|
|
|
// resolve(data)
|
|
|
|
uri: instance.validateForm.value.uri, |
|
|
|
// this.message.create('success', '编辑成功!');
|
|
|
|
type: instance.validateForm.value.type, |
|
|
|
// this.getCamera()
|
|
|
|
organizationId: this.orId |
|
|
|
// return true
|
|
|
|
} |
|
|
|
// }, err => {
|
|
|
|
this.http.put(`/api/Cameras/${data.id}`, body).subscribe(data => { |
|
|
|
// return false
|
|
|
|
resolve(data) |
|
|
|
// })
|
|
|
|
this.message.create('success', '创建成功!'); |
|
|
|
|
|
|
|
this.getCamera() |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
@ -123,11 +122,7 @@ export class HostConfigComponent implements OnInit { |
|
|
|
nzOkText: '确定', |
|
|
|
nzOkText: '确定', |
|
|
|
nzOkType: 'default', |
|
|
|
nzOkType: 'default', |
|
|
|
nzOnOk: () => { |
|
|
|
nzOnOk: () => { |
|
|
|
this.http.delete('/api/services/app/Camera/Delete', { |
|
|
|
this.http.delete(`/api/Cameras/${item.id}`).subscribe(data => { |
|
|
|
params: { |
|
|
|
|
|
|
|
Id: item.id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).subscribe(data => { |
|
|
|
|
|
|
|
this.message.create('success', '删除成功!'); |
|
|
|
this.message.create('success', '删除成功!'); |
|
|
|
this.getCamera() |
|
|
|
this.getCamera() |
|
|
|
}) |
|
|
|
}) |
|
|
|