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 a23de25..2452983 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
@@ -52,7 +52,7 @@
编辑
配置
-
@@ -61,7 +61,7 @@
-
+ -->
下载设备编号
删除
|
diff --git a/src/app/system-management/host-config/host-config.component.ts b/src/app/system-management/host-config/host-config.component.ts
index 3db6614..e00cc8a 100644
--- a/src/app/system-management/host-config/host-config.component.ts
+++ b/src/app/system-management/host-config/host-config.component.ts
@@ -22,6 +22,7 @@ import { SendFileComponent } from './send-file/send-file.component';
import { ImageLabel2Component } from '../image-label2/image-label2.component';
import { ImageLabelComponent } from '../image-label/image-label.component';
import { HuangHaiConfigComponent } from './huang-hai-config/huang-hai-config.component';
+
interface Camera {
name: string;
user: string;
@@ -68,28 +69,25 @@ export class HostConfigComponent implements OnInit {
this.hostType = this.route.snapshot.queryParams.type;
this.getCamera();
+ this.getHostData();
+ }
+ //获得盒子配置
+ getHostData() {
this.http.get(`/api/EdgeDevices/${this.hostId}`).subscribe({
next: (data: any) => {
console.log(data);
this.hostData = data;
- // let isExist = data.configFiles.find((item, index, arr) => {
- // if (item.name == 'source.yaml') {
- // console.log("存在", index)
- // return item
- // }
- // })
if (data.configFiles && data.configFiles.length != 0) {
this.isSourceYaml = true;
} else {
this.isSourceYaml = false;
}
},
- error: (err) => {
- // this.message.create('error', '请先下发source.yaml配置');
- },
+ error: (err) => {},
});
}
+
listOfData: Camera[] = [];
goback() {
history.go(-1);
@@ -1540,6 +1538,7 @@ rule_threshold:
next: (data) => {
resolve(data);
this.message.success('文件保存成功');
+ this.getHostData();
let params = {
edgeDeviceId: this.hostId,
fileName: 'data.yaml',
@@ -1566,25 +1565,16 @@ rule_threshold:
}
configJsonToAx() {
- let server;
- let obs;
- if (location.origin.indexOf('121') !== -1) {
- server = 'http://121.36.37.70:8208';
- obs = 'http://121.36.37.70:8906';
- } else {
- server = 'http://10.156.134.53:8208';
- obs = 'https://znaq.sinochemoilmarketing.com';
- }
let data = {
- server: server,
- obs: obs,
+ server: null,
+ obs: null,
userInfo: {
user: '',
password: '',
},
ip: this.hostData.hostIPAddress,
imgScale: 1.5,
- cpuRtsp: true,
+ cpuRtsp: false,
caps: [],
params: {
smoke_sleep_m: 5,
@@ -1604,7 +1594,47 @@ rule_threshold:
fire_continue_s: 3,
},
};
- console.log(this.listOfData);
+ console.log(this.hostData);
+ //如果保存过安信的配置文件
+ if (
+ this.hostData.configFiles &&
+ this.hostData.configFiles.find((v) => v.name === 'data.yaml')
+ ) {
+ let oldFile = yaml.load(
+ this.hostData.configFiles.find((v) => v.name === 'data.yaml').content
+ );
+ // console.log('曾经保存过安信的配置文件', oldFile);
+ for (const key in oldFile) {
+ const element = oldFile[key];
+ if (key !== 'caps' && key !== 'params') {
+ if (data.hasOwnProperty(key)) {
+ data[key] = element;
+ }
+ }
+ if (key === 'params') {
+ for (const v in element) {
+ const item = element[v];
+ if (data.params.hasOwnProperty(v)) {
+ data.params[v] = item;
+ }
+ }
+ }
+ }
+ } else {
+ let server;
+ let obs;
+ if (location.origin.indexOf('121') !== -1) {
+ server = 'http://121.36.37.70:8208';
+ obs = 'http://121.36.37.70:8906';
+ } else {
+ server = 'http://10.156.134.53:8208';
+ obs = 'https://znaq.sinochemoilmarketing.com';
+ }
+ data.server = server;
+ data.obs = obs;
+ }
+
+ //填充caps数组
this.listOfData.forEach((item: any) => {
if (item.isEnabled) {
let type = null;
@@ -1639,7 +1669,6 @@ rule_threshold:
data.caps.push(obj);
}
});
-
return data;
}
}