diff --git a/src/app/system-management/analysis-of-the-host/addhost/addhost.component.html b/src/app/system-management/analysis-of-the-host/addhost/addhost.component.html index 06d354d..b729a80 100644 --- a/src/app/system-management/analysis-of-the-host/addhost/addhost.component.html +++ b/src/app/system-management/analysis-of-the-host/addhost/addhost.component.html @@ -1,11 +1,22 @@
+ ip + + 类型 + + + + + + + +
\ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/addhost/addhost.component.scss b/src/app/system-management/analysis-of-the-host/addhost/addhost.component.scss index 6f8c35d..afee7bf 100644 --- a/src/app/system-management/analysis-of-the-host/addhost/addhost.component.scss +++ b/src/app/system-management/analysis-of-the-host/addhost/addhost.component.scss @@ -1,3 +1,3 @@ -.ant-form-item{ - margin-bottom: 0; -} \ No newline at end of file +.ant-form-item { + margin-bottom: 12px; +} diff --git a/src/app/system-management/analysis-of-the-host/addhost/addhost.component.ts b/src/app/system-management/analysis-of-the-host/addhost/addhost.component.ts index 73d5163..b80f604 100644 --- a/src/app/system-management/analysis-of-the-host/addhost/addhost.component.ts +++ b/src/app/system-management/analysis-of-the-host/addhost/addhost.component.ts @@ -6,16 +6,20 @@ import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-addhost', templateUrl: './addhost.component.html', - styleUrls: ['./addhost.component.scss'] + styleUrls: ['./addhost.component.scss'], }) export class AddhostComponent implements OnInit { - validateForm!: FormGroup; - constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } + constructor( + private modal: NzModalRef, + private fb: FormBuilder, + private http: HttpClient + ) {} ngOnInit(): void { this.validateForm = this.fb.group({ - ip: [null, [Validators.required]] + ip: [null, [Validators.required]], + type: [null, [Validators.required]], }); } } diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html index e3b135d..a23de25 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html @@ -29,10 +29,10 @@ - +
@@ -40,6 +40,7 @@ ip 配置状态 + 设备类型 操作 @@ -47,8 +48,9 @@ {{data.hostIPAddress}} !配置状态! + {{data.deviceProvider === 0 ? '警旗1' : data.deviceProvider === 1 ? '警旗2' :'警旗3'}} - + 编辑 配置 @@ -61,7 +63,7 @@ 下载设备编号 - + 删除 diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts index 80c8a83..caae1cf 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts @@ -147,6 +147,7 @@ export class AnalysisOfTheHostComponent implements OnInit { console.log('表单信息', instance.validateForm); let body = { hostIPAddress: instance.validateForm.value.ip, + deviceProvider: instance.validateForm.value.type, OrganizationId: this.selectedOilStation.id, }; this.http.post('/api/EdgeDevices', body).subscribe((data) => { @@ -174,20 +175,22 @@ export class AnalysisOfTheHostComponent implements OnInit { nzWidth: 288, nzComponentParams: { ip: data.hostIPAddress, + type: data.deviceProvider, }, nzOnOk: async () => { if (instance.validateForm.valid) { + console.log('表单信息', instance.validateForm.value); await new Promise((resolve) => { - console.log('表单信息', instance.validateForm); (data.hostIPAddress = instance.validateForm.value.ip), - this.http - .put(`/api/EdgeDevices/${data.id}`, data) - .subscribe((data) => { - resolve(data); - this.message.create('success', '修改成功!'); - this.getHost(); - return true; - }); + (data.deviceProvider = instance.validateForm.value.type); + this.http + .put(`/api/EdgeDevices/${data.id}`, data) + .subscribe((data) => { + resolve(data); + this.message.create('success', '修改成功!'); + this.getHost(); + return true; + }); }); } else { this.message.create('warning', '请填写完整!'); @@ -217,9 +220,29 @@ export class AnalysisOfTheHostComponent implements OnInit { isVisible = false; radioValue = '警旗1'; configdata; - config(data) { - this.isVisible = true; + config(data: any) { + // this.isVisible = true; this.configdata = data; + console.log(this.configdata); + let body = { + deviceProvider: this.configdata.deviceProvider, + }; + this.http.put(`/api/EdgeDevices/${this.configdata.id}`, body).subscribe({ + next: (data) => { + setTimeout(() => { + this.router.navigate([`/system/host/camera`], { + queryParams: { + hostId: this.configdata.id, + orId: this.selectedOilStation.id, + type: DeviceProvider[this.configdata.deviceProvider], + }, + }); + }, 0); + }, + error: (err) => { + this.message.create('error', '更新边缘设备失败'); + }, + }); } handleOk(): void { diff --git a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html index 4e62039..5a52191 100644 --- a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html +++ b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html @@ -1,11 +1,22 @@
+ ip + + 类型 + + + + + + + +
\ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts index 22fc01b..f2122b2 100644 --- a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts +++ b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts @@ -6,18 +6,23 @@ import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-edithost', templateUrl: './edithost.component.html', - styleUrls: ['./edithost.component.scss'] + styleUrls: ['./edithost.component.scss'], }) export class EdithostComponent implements OnInit { - - @Input() ip: any - + @Input() ip: any; + @Input() type: any; validateForm!: FormGroup; - constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } + constructor( + private modal: NzModalRef, + private fb: FormBuilder, + private http: HttpClient + ) {} ngOnInit(): void { + console.log('设备类型',this.type); this.validateForm = this.fb.group({ - ip: [null, [Validators.required]] + ip: [null, [Validators.required]], + type: [null, [Validators.required]], }); } }