diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 06cd154..4d5661c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -13,6 +13,6 @@ export class AppComponent { //调用服务中的function刷新token this.token.startUp() } - console.log('更新日期:20241109') + console.log('更新日期:20241202') } } 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 d78ecbb..56c8504 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 @@ -2,7 +2,7 @@
- 组织机构列表 + 组织机构列表
@@ -55,16 +55,6 @@ 编辑 配置 - 下载设备编号 删除 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 70327be..ddc8e14 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 @@ -224,10 +224,18 @@ export class AnalysisOfTheHostComponent implements OnInit { isVisible = false; radioValue = '警旗1'; configdata; + + deviceProviderObj = { + 0: '警旗1', + 1: '警旗2', + 2: '警旗3', + 4: '警旗3', + }; config(data: any) { // this.isVisible = true; this.configdata = data; console.log(this.configdata); + // return; let body = { deviceProvider: this.configdata.deviceProvider, }; @@ -238,7 +246,7 @@ export class AnalysisOfTheHostComponent implements OnInit { queryParams: { hostId: this.configdata.id, orId: this.selectedOilStation.id, - type: DeviceProvider[this.configdata.deviceProvider], + type: this.deviceProviderObj[this.configdata.deviceProvider], }, }); }, 0); @@ -323,5 +331,5 @@ export class AnalysisOfTheHostComponent implements OnInit { enum DeviceProvider { '警旗1' = 0, '警旗2' = 1, - '警旗3' = 2, + '警旗3' = 2 | 4, } diff --git a/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.html b/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.html index f975e57..7f55c62 100644 --- a/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.html +++ b/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.html @@ -10,8 +10,8 @@
- - + +
diff --git a/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.ts b/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.ts index aaf9b5a..cd82a1e 100644 --- a/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.ts +++ b/src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.ts @@ -120,8 +120,8 @@ export class WorkerTagComponent implements OnInit { function BatchModifyoi() { var a = new Promise((resolve, reject) => { let obj = { - replaceString: _this.newValue, - targetString: _this.oldValue, + replaceString: 'oilin_sleep_m: ' + _this.newValue, + targetString: 'oilin_sleep_m: ' + _this.oldValue, }; _this.http .put('/api/EdgeDevices/BatchModifyConfig', ids, { @@ -140,6 +140,7 @@ export class WorkerTagComponent implements OnInit { }); return a; } + function BatchPushFile() { let b = new Promise((resolve, reject) => { _this.http diff --git a/src/app/system-management/condition-monitoring/condition-monitoring.component.html b/src/app/system-management/condition-monitoring/condition-monitoring.component.html index f5b5fd8..54c7832 100644 --- a/src/app/system-management/condition-monitoring/condition-monitoring.component.html +++ b/src/app/system-management/condition-monitoring/condition-monitoring.component.html @@ -20,7 +20,6 @@ - @@ -28,7 +27,16 @@ - + + + + + + + + + + diff --git a/src/app/system-management/condition-monitoring/condition-monitoring.component.ts b/src/app/system-management/condition-monitoring/condition-monitoring.component.ts index bf204eb..7eee565 100644 --- a/src/app/system-management/condition-monitoring/condition-monitoring.component.ts +++ b/src/app/system-management/condition-monitoring/condition-monitoring.component.ts @@ -9,43 +9,51 @@ import { ModelComponent } from './model/model.component'; @Component({ selector: 'app-condition-monitoring', templateUrl: './condition-monitoring.component.html', - styleUrls: ['./condition-monitoring.component.scss'] + styleUrls: ['./condition-monitoring.component.scss'], }) export class ConditionMonitoringComponent implements OnInit { - - constructor(private http: HttpClient, private fb: FormBuilder, private toTree: TreeService, private message: NzMessageService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } + constructor( + private http: HttpClient, + private fb: FormBuilder, + private toTree: TreeService, + private message: NzMessageService, + private modal: NzModalService, + private viewContainerRef: ViewContainerRef + ) {} validateForm!: FormGroup; ngOnInit(): void { this.validateForm = this.fb.group({ organization: [null], - state: [null] + state: [null], + updatestate: [null], }); - this.getAllOrganization() - + this.getAllOrganization(); } //获取所有组织机构 - nodes: any = [] - defaultOrId: string + nodes: any = []; + defaultOrId: string; defaultExpandedKeys = []; getAllOrganization() { let params = { ContainsChildren: true, - pageSize: 9999 - } - this.http.get('/api/Organizations', { - params: params - }).subscribe((data: any) => { - console.log('组织机构列表', data) - data.items.forEach(element => { - element.key = element.id - element.title = element.name - // element.selectable = false + pageSize: 9999, + }; + this.http + .get('/api/Organizations', { + params: params, + }) + .subscribe((data: any) => { + console.log('组织机构列表', data); + data.items.forEach((element) => { + element.key = element.id; + element.title = element.name; + // element.selectable = false + }); + this.nodes = [...this.toTree.toTree(data.items)]; + this.defaultOrId = this.nodes[0].id; + this.validateForm.value.organization = this.defaultOrId; + this.getConditionMonitoring(); }); - this.nodes = [...this.toTree.toTree(data.items)] - this.defaultOrId = this.nodes[0].id - this.validateForm.value.organization = this.defaultOrId - this.getConditionMonitoring() - }) } submitForm(): void { @@ -53,7 +61,7 @@ export class ConditionMonitoringComponent implements OnInit { this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].updateValueAndValidity(); } - this.getConditionMonitoring() + this.getConditionMonitoring(); } resetForm(e: MouseEvent): void { e.preventDefault(); @@ -65,13 +73,13 @@ export class ConditionMonitoringComponent implements OnInit { this.validateForm.patchValue({ organization: this.nodes[0].id, }); - this.PageNumber = 1 - this.getConditionMonitoring() + this.PageNumber = 1; + this.getConditionMonitoring(); } - listOfData: any - num: string - PageNumber: number = 1 - isLoading = false + listOfData: any; + num: string; + PageNumber: number = 1; + isLoading = false; //获取盒子状态 getConditionMonitoring() { let params = { @@ -79,28 +87,27 @@ export class ConditionMonitoringComponent implements OnInit { OrganizationId: this.defaultOrId, PageNumber: this.PageNumber, PageSize: 10, - HubConnectionState: this.validateForm.value.state - } - this.isLoading = true + HubConnectionState: this.validateForm.value.state, + AppUpdatingState: this.validateForm.value.updatestate, + }; + this.isLoading = true; this.http.get('/api/EdgeDevices/Statuses', { params: params }).subscribe( (data: any) => { - console.log(data) - this.isLoading = false - this.listOfData = data.items - this.num = data.totalCount - }, err => { - - } - ) + console.log(data); + this.isLoading = false; + this.listOfData = data.items; + this.num = data.totalCount; + }, + (err) => {} + ); } pageChange($event) { - this.PageNumber = $event - this.getConditionMonitoring() + this.PageNumber = $event; + this.getConditionMonitoring(); } - checked = false; - loading + loading; indeterminate = false; listOfCurrentPageData: readonly any[] = []; setOfCheckedId = new Set(); @@ -118,9 +125,15 @@ export class ConditionMonitoringComponent implements OnInit { } refreshCheckedStatus(): void { - const listOfEnabledData = this.listOfCurrentPageData.filter(({ disabled }) => !disabled); - this.checked = listOfEnabledData.every(({ id }) => this.setOfCheckedId.has(id)); - this.indeterminate = listOfEnabledData.some(({ id }) => this.setOfCheckedId.has(id)) && !this.checked; + const listOfEnabledData = this.listOfCurrentPageData.filter( + ({ disabled }) => !disabled + ); + this.checked = listOfEnabledData.every(({ id }) => + this.setOfCheckedId.has(id) + ); + this.indeterminate = + listOfEnabledData.some(({ id }) => this.setOfCheckedId.has(id)) && + !this.checked; } onItemChecked(id: number, checked: boolean): void { @@ -135,60 +148,64 @@ export class ConditionMonitoringComponent implements OnInit { this.refreshCheckedStatus(); } - - selectedBoxId = [] + selectedBoxId = []; updateBox(type, name) { - const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); - this.selectedBoxId = [] - requestData.forEach(element => { - this.selectedBoxId.push(element.id) + const requestData = this.listOfData.filter((data) => + this.setOfCheckedId.has(data.id) + ); + this.selectedBoxId = []; + requestData.forEach((element) => { + this.selectedBoxId.push(element.id); }); if (this.selectedBoxId.length == 0) { this.modal.confirm({ nzTitle: `确定更新所有边缘主机的${name}吗?`, nzOnOk: () => { - console.log('OK') - this.sendRequest(type, true) - } + console.log('OK'); + this.sendRequest(type, true); + }, }); } else { - this.sendRequest(type, false) + this.sendRequest(type, false); } } - - sendRequest(type, isAllBox): void { - let body + let body; if (type != 'UpdateModels') { this.loading = type; body = { edgeDeviceIds: this.selectedBoxId, - allEdgeDevices: isAllBox - } - this.http.patch('/api/EdgeDevices/Commands', body, { params: { command: type } }).subscribe({ - next: (data: any) => { - this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); - let str = '更新失败列表
' - if (data.failedItems.length != 0) { - data.failedItems.forEach(element => { - str += element.detail + '
' - }); - this.message.create('info', str, { - nzDuration: 3000 - }); - } + allEdgeDevices: isAllBox, + }; + this.http + .patch('/api/EdgeDevices/Commands', body, { params: { command: type } }) + .subscribe({ + next: (data: any) => { + this.message.create( + 'success', + '通知边缘盒子成功,请过一段时间手动刷新尝试!' + ); + let str = '更新失败列表
'; + if (data.failedItems.length != 0) { + data.failedItems.forEach((element) => { + str += element.detail + '
'; + }); + this.message.create('info', str, { + nzDuration: 3000, + }); + } - this.setOfCheckedId.clear(); - this.refreshCheckedStatus(); - this.loading = null; - this.getConditionMonitoring() - }, - error: (err) => { - this.loading = null; - } - }) + this.setOfCheckedId.clear(); + this.refreshCheckedStatus(); + this.loading = null; + this.getConditionMonitoring(); + }, + error: (err) => { + this.loading = null; + }, + }); } else { const modal = this.modal.create({ nzTitle: '选择更新模型类型', @@ -201,66 +218,73 @@ export class ConditionMonitoringComponent implements OnInit { body = { edgeDeviceIds: this.selectedBoxId, modelNames: instance.validateForm.value.type, - allEdgeDevices: isAllBox - } - await new Promise(resolve => { - this.http.patch('/api/EdgeDevices/Commands', body, { params: { command: type } }).subscribe({ - next: (data: any) => { - resolve(data) - this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); - let str = '更新失败列表
' - if (data.failedItems.length != 0) { - data.failedItems.forEach(element => { - str += element.detail + '
' - }); - this.message.create('info', str, { - nzDuration: 3000 - }); - } + allEdgeDevices: isAllBox, + }; + await new Promise((resolve) => { + this.http + .patch('/api/EdgeDevices/Commands', body, { + params: { command: type }, + }) + .subscribe({ + next: (data: any) => { + resolve(data); + this.message.create( + 'success', + '通知边缘盒子成功,请过一段时间手动刷新尝试!' + ); + let str = '更新失败列表
'; + if (data.failedItems.length != 0) { + data.failedItems.forEach((element) => { + str += element.detail + '
'; + }); + this.message.create('info', str, { + nzDuration: 3000, + }); + } - this.setOfCheckedId.clear(); - this.refreshCheckedStatus(); - this.loading = null; - this.getConditionMonitoring() - return true - }, - error: (err) => { - resolve(err) - this.loading = null; - return false - } - }) - }) + this.setOfCheckedId.clear(); + this.refreshCheckedStatus(); + this.loading = null; + this.getConditionMonitoring(); + return true; + }, + error: (err) => { + resolve(err); + this.loading = null; + return false; + }, + }); + }); } else { this.message.create('warning', '请填写完整!'); - return false + return false; } - } + }, }); const instance = modal.getContentComponent(); } - } updateBoxfile() { - const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); - this.selectedBoxId = [] - requestData.forEach(element => { - this.selectedBoxId.push(element.id) + const requestData = this.listOfData.filter((data) => + this.setOfCheckedId.has(data.id) + ); + this.selectedBoxId = []; + requestData.forEach((element) => { + this.selectedBoxId.push(element.id); }); if (this.selectedBoxId.length == 0) { this.modal.confirm({ nzTitle: `确定更新所有边缘主机的监控程序配置文件吗?`, nzOnOk: () => { - this.file(true) - } + this.file(true); + }, }); } else { - this.file(false) + this.file(false); } } - file(isAllBox) { const modal = this.modal.create({ nzTitle: '配置文件', @@ -276,42 +300,46 @@ export class ConditionMonitoringComponent implements OnInit { host: instance.validateForm.value.host, port: instance.validateForm.value.port, maxRetries: instance.validateForm.value.maxRetries, - allEdgeDevices: isAllBox - } + allEdgeDevices: isAllBox, + }; await new Promise((resolve, reject) => { - this.loading = 'file' - this.http.patch('/api/EdgeDevices/Commands/PushMonitorSettingsJson', body).subscribe({ - next: (data: any) => { - this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); - let str = '更新失败列表
' - if (data.failedItems.length != 0) { - data.failedItems.forEach(element => { - str += element.detail + '
' - }); - this.message.create('info', str, { - nzDuration: 3000 - }); - } - this.setOfCheckedId.clear(); - this.refreshCheckedStatus(); - this.getConditionMonitoring() - this.loading = null; - resolve(data) - return true - }, - error: (err) => { - reject(err) - this.loading = null; - } - }) - }) + this.loading = 'file'; + this.http + .patch('/api/EdgeDevices/Commands/PushMonitorSettingsJson', body) + .subscribe({ + next: (data: any) => { + this.message.create( + 'success', + '通知边缘盒子成功,请过一段时间手动刷新尝试!' + ); + let str = '更新失败列表
'; + if (data.failedItems.length != 0) { + data.failedItems.forEach((element) => { + str += element.detail + '
'; + }); + this.message.create('info', str, { + nzDuration: 3000, + }); + } + this.setOfCheckedId.clear(); + this.refreshCheckedStatus(); + this.getConditionMonitoring(); + this.loading = null; + resolve(data); + return true; + }, + error: (err) => { + reject(err); + this.loading = null; + }, + }); + }); } else { this.message.create('warning', '请填写完整!'); - return false + return false; } - } + }, }); const instance = modal.getContentComponent(); - } }