|
|
@ -135,19 +135,37 @@ export class ConditionMonitoringComponent implements OnInit { |
|
|
|
this.refreshCheckedStatus(); |
|
|
|
this.refreshCheckedStatus(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sendRequest(type): void { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectedBoxId = [] |
|
|
|
|
|
|
|
updateBox(type, name) { |
|
|
|
const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); |
|
|
|
const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); |
|
|
|
|
|
|
|
this.selectedBoxId = [] |
|
|
|
let strArr = [] |
|
|
|
|
|
|
|
requestData.forEach(element => { |
|
|
|
requestData.forEach(element => { |
|
|
|
strArr.push(element.id) |
|
|
|
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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.sendRequest(type, false) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sendRequest(type, isAllBox): void { |
|
|
|
let body |
|
|
|
let body |
|
|
|
if (type != 'UpdateModels') { |
|
|
|
if (type != 'UpdateModels') { |
|
|
|
this.loading = type; |
|
|
|
this.loading = type; |
|
|
|
body = { |
|
|
|
body = { |
|
|
|
edgeDeviceIds: strArr |
|
|
|
edgeDeviceIds: this.selectedBoxId, |
|
|
|
|
|
|
|
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) => { |
|
|
@ -175,11 +193,11 @@ export class ConditionMonitoringComponent implements OnInit { |
|
|
|
nzWidth: 288, |
|
|
|
nzWidth: 288, |
|
|
|
nzComponentParams: {}, |
|
|
|
nzComponentParams: {}, |
|
|
|
nzOnOk: async () => { |
|
|
|
nzOnOk: async () => { |
|
|
|
// console.log(instance.validateForm.value.type)
|
|
|
|
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
body = { |
|
|
|
body = { |
|
|
|
edgeDeviceIds: strArr, |
|
|
|
edgeDeviceIds: this.selectedBoxId, |
|
|
|
modelNames: instance.validateForm.value.type |
|
|
|
modelNames: instance.validateForm.value.type, |
|
|
|
|
|
|
|
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({ |
|
|
@ -215,12 +233,26 @@ export class ConditionMonitoringComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
file() { |
|
|
|
updateBoxfile() { |
|
|
|
const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); |
|
|
|
const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id)); |
|
|
|
let strArr = [] |
|
|
|
this.selectedBoxId = [] |
|
|
|
requestData.forEach(element => { |
|
|
|
requestData.forEach(element => { |
|
|
|
strArr.push(element.id) |
|
|
|
this.selectedBoxId.push(element.id) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (this.selectedBoxId.length == 0) { |
|
|
|
|
|
|
|
this.modal.confirm({ |
|
|
|
|
|
|
|
nzTitle: `<i>确定更新所有边缘主机的监控程序配置文件吗?</i>`, |
|
|
|
|
|
|
|
nzOnOk: () => { |
|
|
|
|
|
|
|
this.file(true) |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.file(false) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file(isAllBox) { |
|
|
|
const modal = this.modal.create({ |
|
|
|
const modal = this.modal.create({ |
|
|
|
nzTitle: '配置文件', |
|
|
|
nzTitle: '配置文件', |
|
|
|
nzContent: FileComponent, |
|
|
|
nzContent: FileComponent, |
|
|
@ -230,18 +262,18 @@ export class ConditionMonitoringComponent implements OnInit { |
|
|
|
nzOnOk: async () => { |
|
|
|
nzOnOk: async () => { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
if (instance.validateForm.valid) { |
|
|
|
let body = { |
|
|
|
let body = { |
|
|
|
edgeDeviceIds: strArr, |
|
|
|
edgeDeviceIds: this.selectedBoxId, |
|
|
|
scheme: instance.validateForm.value.scheme, |
|
|
|
scheme: instance.validateForm.value.scheme, |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
|
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('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!'); |
|
|
|
// console.log(data)
|
|
|
|
|
|
|
|
if (data.failedItems.length != 0) { |
|
|
|
if (data.failedItems.length != 0) { |
|
|
|
data.failedItems.forEach(element => { |
|
|
|
data.failedItems.forEach(element => { |
|
|
|
this.message.create('info', element.detail); |
|
|
|
this.message.create('info', element.detail); |
|
|
|