diff --git a/src/app/http-interceptors/base-interceptor.ts b/src/app/http-interceptors/base-interceptor.ts index 7c4b323..b41f38d 100644 --- a/src/app/http-interceptors/base-interceptor.ts +++ b/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) { diff --git a/src/app/system-management/host-config/addcamera/addcamera.component.html b/src/app/system-management/host-config/addcamera/addcamera.component.html index aa313d5..5a3d6a3 100644 --- a/src/app/system-management/host-config/addcamera/addcamera.component.html +++ b/src/app/system-management/host-config/addcamera/addcamera.component.html @@ -43,7 +43,7 @@ - + \ No newline at end of file diff --git a/src/app/system-management/host-config/addcamera/addcamera.component.ts b/src/app/system-management/host-config/addcamera/addcamera.component.ts index 9e9f94e..a21b539 100644 --- a/src/app/system-management/host-config/addcamera/addcamera.component.ts +++ b/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` } }; } } diff --git a/src/app/system-management/host-config/host-config.component.html b/src/app/system-management/host-config/host-config.component.html index 1fd7a1d..205e294 100644 --- a/src/app/system-management/host-config/host-config.component.html +++ b/src/app/system-management/host-config/host-config.component.html @@ -16,6 +16,7 @@ 地址 类型 标注情况 + 状态 操作 @@ -35,9 +36,17 @@ {{item.dimensionedPoints ? '已标注' : '未标注'}} + {{ item.isEnabled ? '已启用' : '已禁用'}} 编辑 - 标注 + 标注 + + 禁用 + + + 启用 + 删除 @@ -54,4 +63,4 @@
- + \ No newline at end of file diff --git a/src/app/system-management/host-config/host-config.component.ts b/src/app/system-management/host-config/host-config.component.ts index 794d967..b0ae78d 100644 --- a/src/app/system-management/host-config/host-config.component.ts +++ b/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. diff --git a/src/app/system-management/navigation/navigation.component.html b/src/app/system-management/navigation/navigation.component.html index 6534a33..6bcc771 100644 --- a/src/app/system-management/navigation/navigation.component.html +++ b/src/app/system-management/navigation/navigation.component.html @@ -21,8 +21,8 @@ src="../../../assets/images/icon/push.png" alt="">边缘盒子更新
  • 边缘盒子监控
  • -
  • kafka检查
  • + diff --git a/src/app/system-management/status-monitoring/status-monitoring.component.html b/src/app/system-management/status-monitoring/status-monitoring.component.html index 974b104..1d79674 100644 --- a/src/app/system-management/status-monitoring/status-monitoring.component.html +++ b/src/app/system-management/status-monitoring/status-monitoring.component.html @@ -45,11 +45,11 @@