Browse Source

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

master
邵佳豪 2 months ago
parent
commit
eb7d88f6aa
  1. 2
      src/app/app.component.ts
  2. 10
      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. 264
      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 //调用服务中的function刷新token
this.token.startUp() this.token.startUp()
} }
console.log('更新日期:20241109') console.log('更新日期:20241202')
} }
} }

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

@ -55,16 +55,6 @@
<td class="operation"> <td class="operation">
<a (click)="edit(data)" style="margin-right: 12px;">编辑</a> <a (click)="edit(data)" style="margin-right: 12px;">编辑</a>
<a (click)="config(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 (click)="download(data)" style="margin-right: 12px;">下载设备编号</a>
<a class="red" (click)="delete(data)">删除</a> <a class="red" (click)="delete(data)">删除</a>
</td> </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; isVisible = false;
radioValue = '警旗1'; radioValue = '警旗1';
configdata; configdata;
deviceProviderObj = {
0: '警旗1',
1: '警旗2',
2: '警旗3',
4: '警旗3',
};
config(data: any) { config(data: any) {
// this.isVisible = true; // this.isVisible = true;
this.configdata = data; this.configdata = data;
console.log(this.configdata); console.log(this.configdata);
// return;
let body = { let body = {
deviceProvider: this.configdata.deviceProvider, deviceProvider: this.configdata.deviceProvider,
}; };
@ -238,7 +246,7 @@ export class AnalysisOfTheHostComponent implements OnInit {
queryParams: { queryParams: {
hostId: this.configdata.id, hostId: this.configdata.id,
orId: this.selectedOilStation.id, orId: this.selectedOilStation.id,
type: DeviceProvider[this.configdata.deviceProvider], type: this.deviceProviderObj[this.configdata.deviceProvider],
}, },
}); });
}, 0); }, 0);
@ -323,5 +331,5 @@ export class AnalysisOfTheHostComponent implements OnInit {
enum DeviceProvider { enum DeviceProvider {
'警旗1' = 0, '警旗1' = 0,
'警旗2' = 1, '警旗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> </div>
<div *ngIf="type==2"> <div *ngIf="type==2">
<input nz-input [(ngModel)]="oldValue" placeholder="老值" /> <input nz-input [(ngModel)]="oldValue" type="number" placeholder="老值" />
<input nz-input [(ngModel)]="newValue" placeholder="新值" /> <input nz-input [(ngModel)]="newValue" type="number" placeholder="新值" />
</div> </div>
</div> </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() { function BatchModifyoi() {
var a = new Promise<void>((resolve, reject) => { var a = new Promise<void>((resolve, reject) => {
let obj = { let obj = {
replaceString: _this.newValue, replaceString: 'oilin_sleep_m: ' + _this.newValue,
targetString: _this.oldValue, targetString: 'oilin_sleep_m: ' + _this.oldValue,
}; };
_this.http _this.http
.put('/api/EdgeDevices/BatchModifyConfig', ids, { .put('/api/EdgeDevices/BatchModifyConfig', ids, {
@ -140,6 +140,7 @@ export class WorkerTagComponent implements OnInit {
}); });
return a; return a;
} }
function BatchPushFile() { function BatchPushFile() {
let b = new Promise<void>((resolve, reject) => { let b = new Promise<void>((resolve, reject) => {
_this.http _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-item> <nz-form-item>
<!-- <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="state">设备状态</nz-form-label> -->
<nz-form-control> <nz-form-control>
<nz-select formControlName="state" nzPlaceHolder="请选择设备状态"> <nz-select formControlName="state" nzPlaceHolder="请选择设备状态">
<nz-option [nzValue]="0" nzLabel="离线"></nz-option> <nz-option [nzValue]="0" nzLabel="离线"></nz-option>
@ -28,7 +27,16 @@
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </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-item class="btn">
<nz-form-control> <nz-form-control>

264
src/app/system-management/condition-monitoring/condition-monitoring.component.ts

@ -9,43 +9,51 @@ import { ModelComponent } from './model/model.component';
@Component({ @Component({
selector: 'app-condition-monitoring', selector: 'app-condition-monitoring',
templateUrl: './condition-monitoring.component.html', templateUrl: './condition-monitoring.component.html',
styleUrls: ['./condition-monitoring.component.scss'] styleUrls: ['./condition-monitoring.component.scss'],
}) })
export class ConditionMonitoringComponent implements OnInit { export class ConditionMonitoringComponent implements OnInit {
constructor(
constructor(private http: HttpClient, private fb: FormBuilder, private toTree: TreeService, private message: NzMessageService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } private http: HttpClient,
private fb: FormBuilder,
private toTree: TreeService,
private message: NzMessageService,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef
) {}
validateForm!: FormGroup; validateForm!: FormGroup;
ngOnInit(): void { ngOnInit(): void {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
organization: [null], organization: [null],
state: [null] state: [null],
updatestate: [null],
}); });
this.getAllOrganization() this.getAllOrganization();
} }
//获取所有组织机构 //获取所有组织机构
nodes: any = [] nodes: any = [];
defaultOrId: string defaultOrId: string;
defaultExpandedKeys = []; defaultExpandedKeys = [];
getAllOrganization() { getAllOrganization() {
let params = { let params = {
ContainsChildren: true, ContainsChildren: true,
pageSize: 9999 pageSize: 9999,
} };
this.http.get('/api/Organizations', { this.http
params: params .get('/api/Organizations', {
}).subscribe((data: any) => { params: params,
console.log('组织机构列表', data) })
data.items.forEach(element => { .subscribe((data: any) => {
element.key = element.id console.log('组织机构列表', data);
element.title = element.name data.items.forEach((element) => {
element.key = element.id;
element.title = element.name;
// element.selectable = false // element.selectable = false
}); });
this.nodes = [...this.toTree.toTree(data.items)] this.nodes = [...this.toTree.toTree(data.items)];
this.defaultOrId = this.nodes[0].id this.defaultOrId = this.nodes[0].id;
this.validateForm.value.organization = this.defaultOrId this.validateForm.value.organization = this.defaultOrId;
this.getConditionMonitoring() this.getConditionMonitoring();
}) });
} }
submitForm(): void { submitForm(): void {
@ -53,7 +61,7 @@ export class ConditionMonitoringComponent implements OnInit {
this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity(); this.validateForm.controls[i].updateValueAndValidity();
} }
this.getConditionMonitoring() this.getConditionMonitoring();
} }
resetForm(e: MouseEvent): void { resetForm(e: MouseEvent): void {
e.preventDefault(); e.preventDefault();
@ -65,13 +73,13 @@ export class ConditionMonitoringComponent implements OnInit {
this.validateForm.patchValue({ this.validateForm.patchValue({
organization: this.nodes[0].id, organization: this.nodes[0].id,
}); });
this.PageNumber = 1 this.PageNumber = 1;
this.getConditionMonitoring() this.getConditionMonitoring();
} }
listOfData: any listOfData: any;
num: string num: string;
PageNumber: number = 1 PageNumber: number = 1;
isLoading = false isLoading = false;
//获取盒子状态 //获取盒子状态
getConditionMonitoring() { getConditionMonitoring() {
let params = { let params = {
@ -79,28 +87,27 @@ export class ConditionMonitoringComponent implements OnInit {
OrganizationId: this.defaultOrId, OrganizationId: this.defaultOrId,
PageNumber: this.PageNumber, PageNumber: this.PageNumber,
PageSize: 10, PageSize: 10,
HubConnectionState: this.validateForm.value.state HubConnectionState: this.validateForm.value.state,
} AppUpdatingState: this.validateForm.value.updatestate,
this.isLoading = true };
this.isLoading = true;
this.http.get('/api/EdgeDevices/Statuses', { params: params }).subscribe( this.http.get('/api/EdgeDevices/Statuses', { params: params }).subscribe(
(data: any) => { (data: any) => {
console.log(data) console.log(data);
this.isLoading = false this.isLoading = false;
this.listOfData = data.items this.listOfData = data.items;
this.num = data.totalCount this.num = data.totalCount;
}, err => { },
(err) => {}
} );
)
} }
pageChange($event) { pageChange($event) {
this.PageNumber = $event this.PageNumber = $event;
this.getConditionMonitoring() this.getConditionMonitoring();
} }
checked = false; checked = false;
loading loading;
indeterminate = false; indeterminate = false;
listOfCurrentPageData: readonly any[] = []; listOfCurrentPageData: readonly any[] = [];
setOfCheckedId = new Set<number>(); setOfCheckedId = new Set<number>();
@ -118,9 +125,15 @@ export class ConditionMonitoringComponent implements OnInit {
} }
refreshCheckedStatus(): void { refreshCheckedStatus(): void {
const listOfEnabledData = this.listOfCurrentPageData.filter(({ disabled }) => !disabled); const listOfEnabledData = this.listOfCurrentPageData.filter(
this.checked = listOfEnabledData.every(({ id }) => this.setOfCheckedId.has(id)); ({ disabled }) => !disabled
this.indeterminate = listOfEnabledData.some(({ id }) => this.setOfCheckedId.has(id)) && !this.checked; );
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 { onItemChecked(id: number, checked: boolean): void {
@ -135,60 +148,64 @@ export class ConditionMonitoringComponent implements OnInit {
this.refreshCheckedStatus(); this.refreshCheckedStatus();
} }
selectedBoxId = [];
selectedBoxId = []
updateBox(type, name) { updateBox(type, name) {
const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); const requestData = this.listOfData.filter((data) =>
this.selectedBoxId = [] this.setOfCheckedId.has(data.id)
requestData.forEach(element => { );
this.selectedBoxId.push(element.id) this.selectedBoxId = [];
requestData.forEach((element) => {
this.selectedBoxId.push(element.id);
}); });
if (this.selectedBoxId.length == 0) { if (this.selectedBoxId.length == 0) {
this.modal.confirm({ this.modal.confirm({
nzTitle: `<i>确定更新所有边缘主机的${name}吗?</i>`, nzTitle: `<i>确定更新所有边缘主机的${name}吗?</i>`,
nzOnOk: () => { nzOnOk: () => {
console.log('OK') console.log('OK');
this.sendRequest(type, true) this.sendRequest(type, true);
} },
}); });
} else { } else {
this.sendRequest(type, false) this.sendRequest(type, false);
} }
} }
sendRequest(type, isAllBox): void { sendRequest(type, isAllBox): void {
let body let body;
if (type != 'UpdateModels') { if (type != 'UpdateModels') {
this.loading = type; this.loading = type;
body = { body = {
edgeDeviceIds: this.selectedBoxId, edgeDeviceIds: this.selectedBoxId,
allEdgeDevices: isAllBox allEdgeDevices: isAllBox,
} };
this.http.patch('/api/EdgeDevices/Commands', body, { params: { command: type } }).subscribe({ this.http
.patch('/api/EdgeDevices/Commands', body, { params: { command: type } })
.subscribe({
next: (data: any) => { next: (data: any) => {
this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); this.message.create(
let str = '更新失败列表<br>' 'success',
'通知边缘盒子成功,请过一段时间手动刷新尝试!'
);
let str = '更新失败列表<br>';
if (data.failedItems.length != 0) { if (data.failedItems.length != 0) {
data.failedItems.forEach(element => { data.failedItems.forEach((element) => {
str += element.detail + '<br>' str += element.detail + '<br>';
}); });
this.message.create('info', str, { this.message.create('info', str, {
nzDuration: 3000 nzDuration: 3000,
}); });
} }
this.setOfCheckedId.clear(); this.setOfCheckedId.clear();
this.refreshCheckedStatus(); this.refreshCheckedStatus();
this.loading = null; this.loading = null;
this.getConditionMonitoring() this.getConditionMonitoring();
}, },
error: (err) => { error: (err) => {
this.loading = null; this.loading = null;
} },
}) });
} else { } else {
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '选择更新模型类型', nzTitle: '选择更新模型类型',
@ -201,66 +218,73 @@ export class ConditionMonitoringComponent implements OnInit {
body = { body = {
edgeDeviceIds: this.selectedBoxId, edgeDeviceIds: this.selectedBoxId,
modelNames: instance.validateForm.value.type, modelNames: instance.validateForm.value.type,
allEdgeDevices: isAllBox allEdgeDevices: isAllBox,
} };
await new Promise(resolve => { await new Promise((resolve) => {
this.http.patch('/api/EdgeDevices/Commands', body, { params: { command: type } }).subscribe({ this.http
.patch('/api/EdgeDevices/Commands', body, {
params: { command: type },
})
.subscribe({
next: (data: any) => { next: (data: any) => {
resolve(data) resolve(data);
this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); this.message.create(
let str = '更新失败列表<br>' 'success',
'通知边缘盒子成功,请过一段时间手动刷新尝试!'
);
let str = '更新失败列表<br>';
if (data.failedItems.length != 0) { if (data.failedItems.length != 0) {
data.failedItems.forEach(element => { data.failedItems.forEach((element) => {
str += element.detail + '<br>' str += element.detail + '<br>';
}); });
this.message.create('info', str, { this.message.create('info', str, {
nzDuration: 3000 nzDuration: 3000,
}); });
} }
this.setOfCheckedId.clear(); this.setOfCheckedId.clear();
this.refreshCheckedStatus(); this.refreshCheckedStatus();
this.loading = null; this.loading = null;
this.getConditionMonitoring() this.getConditionMonitoring();
return true return true;
}, },
error: (err) => { error: (err) => {
resolve(err) resolve(err);
this.loading = null; this.loading = null;
return false return false;
} },
}) });
}) });
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create('warning', '请填写完整!');
return false return false;
}
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
} }
updateBoxfile() { updateBoxfile() {
const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); const requestData = this.listOfData.filter((data) =>
this.selectedBoxId = [] this.setOfCheckedId.has(data.id)
requestData.forEach(element => { );
this.selectedBoxId.push(element.id) this.selectedBoxId = [];
requestData.forEach((element) => {
this.selectedBoxId.push(element.id);
}); });
if (this.selectedBoxId.length == 0) { if (this.selectedBoxId.length == 0) {
this.modal.confirm({ this.modal.confirm({
nzTitle: `<i>确定更新所有边缘主机的监控程序配置文件吗?</i>`, nzTitle: `<i>确定更新所有边缘主机的监控程序配置文件吗?</i>`,
nzOnOk: () => { nzOnOk: () => {
this.file(true) this.file(true);
} },
}); });
} else { } else {
this.file(false) this.file(false);
} }
} }
file(isAllBox) { file(isAllBox) {
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '配置文件', nzTitle: '配置文件',
@ -276,42 +300,46 @@ export class ConditionMonitoringComponent implements OnInit {
host: instance.validateForm.value.host, host: instance.validateForm.value.host,
port: instance.validateForm.value.port, port: instance.validateForm.value.port,
maxRetries: instance.validateForm.value.maxRetries, maxRetries: instance.validateForm.value.maxRetries,
allEdgeDevices: isAllBox allEdgeDevices: isAllBox,
} };
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
this.loading = 'file' this.loading = 'file';
this.http.patch('/api/EdgeDevices/Commands/PushMonitorSettingsJson', body).subscribe({ this.http
.patch('/api/EdgeDevices/Commands/PushMonitorSettingsJson', body)
.subscribe({
next: (data: any) => { next: (data: any) => {
this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); this.message.create(
let str = '更新失败列表<br>' 'success',
'通知边缘盒子成功,请过一段时间手动刷新尝试!'
);
let str = '更新失败列表<br>';
if (data.failedItems.length != 0) { if (data.failedItems.length != 0) {
data.failedItems.forEach(element => { data.failedItems.forEach((element) => {
str += element.detail + '<br>' str += element.detail + '<br>';
}); });
this.message.create('info', str, { this.message.create('info', str, {
nzDuration: 3000 nzDuration: 3000,
}); });
} }
this.setOfCheckedId.clear(); this.setOfCheckedId.clear();
this.refreshCheckedStatus(); this.refreshCheckedStatus();
this.getConditionMonitoring() this.getConditionMonitoring();
this.loading = null; this.loading = null;
resolve(data) resolve(data);
return true return true;
}, },
error: (err) => { error: (err) => {
reject(err) reject(err);
this.loading = null; this.loading = null;
} },
}) });
}) });
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create('warning', '请填写完整!');
return false return false;
}
} }
},
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
} }

Loading…
Cancel
Save