Browse Source

[新增]同步功能

非煤矿业企业安全风险监测预警系统
邵佳豪 2 years ago
parent
commit
29d33ee06b
  1. 9
      src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
  2. 58
      src/app/system-management/host-config/host-config.component.ts
  3. 13
      src/app/system-management/organization/organization.component.ts

9
src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts

@ -119,16 +119,13 @@ export class AnalysisOfTheHostComponent implements OnInit {
} }
refresh() { refresh() {
if (!this.selectedOilStation.id) { this.http.put('/api/EdgeDevices/SyncAllEdgeDevices', null).subscribe({
return;
}
this.http.put('/api/GasStations/SyncAllGasStations', null).subscribe({
next: (data) => { next: (data) => {
this.message.success('同步成功'); this.message.success('同步边缘设备成功');
this.getHost(); this.getHost();
}, },
error: (err) => { error: (err) => {
this.message.error('同步失败'); this.message.error('同步边缘设备失败');
}, },
}); });
} }

58
src/app/system-management/host-config/host-config.component.ts

@ -1504,7 +1504,7 @@ ${newstr}class-id=0
//安信配置文件 //安信配置文件
configToAx() { configToAx() {
let data = this.configJsonToAx(); let data = this.configJsonToAx();
console.log(data) console.log(data);
// return; // return;
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '下发安信config.json配置', nzTitle: '下发安信config.json配置',
@ -1559,40 +1559,42 @@ ${newstr}class-id=0
user: '', user: '',
password: '', password: '',
}, },
caps:[], caps: [],
}; };
console.log(this.listOfData); console.log(this.listOfData);
this.listOfData.forEach((item: any) => { this.listOfData.forEach((item: any) => {
let type = null; if (item.isEnabled) {
item.type === 0 let type = null;
? (type = 2) item.type === 0
: item.type === 1 ? (type = 2)
? (type = 1) : item.type === 1
: item.type === 2 ? (type = 1)
? (type = 0) : item.type === 2
: item.type === 3 ? (type = 0)
? (type = 4) : item.type === 3
: null; ? (type = 4)
: null;
let areas = [];
if (item.dimensionedPointsAnxinObj) { let areas = [];
if (item.dimensionedPointsAnxinObj.yamlData.length !== 0) { if (item.dimensionedPointsAnxinObj) {
areas = item.dimensionedPointsAnxinObj.yamlData; if (item.dimensionedPointsAnxinObj.yamlData.length !== 0) {
areas = item.dimensionedPointsAnxinObj.yamlData;
}
} }
}
let obj:any = { let obj: any = {
id: item.id, id: item.id,
type: type, type: type,
url: item.uri, url: item.uri,
name: item.name, name: item.name,
}; };
if(areas.length !== 0){ if (areas.length !== 0) {
obj.areas = areas obj.areas = areas;
}
data.caps.push(obj);
} }
data.caps.push(obj);
}); });
return data return data;
} }
} }

13
src/app/system-management/organization/organization.component.ts

@ -48,11 +48,20 @@ export class OrganizationComponent implements OnInit {
refresh() { refresh() {
this.http.put('/api/Organizations/SyncAllOrganizations', null).subscribe({ this.http.put('/api/Organizations/SyncAllOrganizations', null).subscribe({
next: (data) => { next: (data) => {
this.message.success('同步成功'); this.message.success('同步组织机构成功');
this.getAllOrganization(); this.getAllOrganization();
}, },
error: (err) => { error: (err) => {
this.message.error('同步失败'); this.message.error('同步组织机构失败');
},
});
this.http.put('/api/GasStations/SyncAllGasStations', null).subscribe({
next: (data) => {
this.message.success('同步油站成功');
this.getAllOrganization();
},
error: (err) => {
this.message.error('同步油站失败');
}, },
}); });
} }

Loading…
Cancel
Save