Browse Source

[新增]查询选择识别程序更新状态

master
邵佳豪 2 months ago
parent
commit
eb7d88f6aa
  1. 2
      src/app/app.component.ts
  2. 12
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
  3. 12
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
  4. 4
      src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.html
  5. 5
      src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.ts
  6. 12
      src/app/system-management/condition-monitoring/condition-monitoring.component.html
  7. 338
      src/app/system-management/condition-monitoring/condition-monitoring.component.ts

2
src/app/app.component.ts

@ -13,6 +13,6 @@ export class AppComponent {
//调用服务中的function刷新token
this.token.startUp()
}
console.log('更新日期:20241109')
console.log('更新日期:20241202')
}
}

12
src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html

@ -2,7 +2,7 @@
<div class="orbox">
<div class="topbox">
<div class="lefttop">
<span>组织机构列表</span>
<span>组织机构列表</span>
</div>
<div class="righttop">
<nz-input-group nzPrefixIcon="search">
@ -55,16 +55,6 @@
<td class="operation">
<a (click)="edit(data)" style="margin-right: 12px;">编辑</a>
<a (click)="config(data)" style="margin-right: 12px;">配置</a>
<!-- <nz-modal [(nzVisible)]="isVisible" [nzWidth]="350" nzTitle="请选择要配置的边缘主机" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()">
<ng-container *nzModalContent>
<nz-radio-group [(ngModel)]="radioValue">
<label nz-radio nzValue="警旗1">警旗1</label>
<label nz-radio nzValue="警旗2">警旗2</label>
<label nz-radio nzValue="警旗3">警旗3</label>
</nz-radio-group>
</ng-container>
</nz-modal> -->
<a (click)="download(data)" style="margin-right: 12px;">下载设备编号</a>
<a class="red" (click)="delete(data)">删除</a>
</td>

12
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,
}

4
src/app/system-management/analysis-of-the-host/worker-tag/worker-tag.component.html

@ -10,8 +10,8 @@
</div>
</div>
<div *ngIf="type==2">
<input nz-input [(ngModel)]="oldValue" placeholder="老值" />
<input nz-input [(ngModel)]="newValue" placeholder="新值" />
<input nz-input [(ngModel)]="oldValue" type="number" placeholder="老值" />
<input nz-input [(ngModel)]="newValue" type="number" placeholder="新值" />
</div>
</div>
</div>

5
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<void>((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<void>((resolve, reject) => {
_this.http

12
src/app/system-management/condition-monitoring/condition-monitoring.component.html

@ -20,7 +20,6 @@
</nz-form-item>
<nz-form-item>
<!-- <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="state">设备状态</nz-form-label> -->
<nz-form-control>
<nz-select formControlName="state" nzPlaceHolder="请选择设备状态">
<nz-option [nzValue]="0" nzLabel="离线"></nz-option>
@ -28,7 +27,16 @@
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-select formControlName="updatestate" nzPlaceHolder="请选择识别程序更新状态" nzAllowClear>
<nz-option [nzValue]="'Never'" nzLabel="未更新"></nz-option>
<nz-option [nzValue]="'Updating'" nzLabel="更新中"></nz-option>
<nz-option [nzValue]="'Updated'" nzLabel="已更新"></nz-option>
<nz-option [nzValue]="'UpdatingTimeout'" nzLabel="更新超时"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item class="btn">
<nz-form-control>

338
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<number>();
@ -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: `<i>确定更新所有边缘主机的${name}吗?</i>`,
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 = '更新失败列表<br>'
if (data.failedItems.length != 0) {
data.failedItems.forEach(element => {
str += element.detail + '<br>'
});
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 = '更新失败列表<br>';
if (data.failedItems.length != 0) {
data.failedItems.forEach((element) => {
str += element.detail + '<br>';
});
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 = '更新失败列表<br>'
if (data.failedItems.length != 0) {
data.failedItems.forEach(element => {
str += element.detail + '<br>'
});
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 = '更新失败列表<br>';
if (data.failedItems.length != 0) {
data.failedItems.forEach((element) => {
str += element.detail + '<br>';
});
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: `<i>确定更新所有边缘主机的监控程序配置文件吗?</i>`,
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 = '更新失败列表<br>'
if (data.failedItems.length != 0) {
data.failedItems.forEach(element => {
str += element.detail + '<br>'
});
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 = '更新失败列表<br>';
if (data.failedItems.length != 0) {
data.failedItems.forEach((element) => {
str += element.detail + '<br>';
});
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();
}
}

Loading…
Cancel
Save