设备管理添加新的设备类型,修改设备配置接口

This commit is contained in:
fan 2021-11-03 13:48:35 +08:00
parent 2e0449bb43
commit a4172815ca
6 changed files with 67 additions and 39 deletions

View File

@ -61,6 +61,14 @@ export function setSwitchConfig(id, data) {
data: data
});
}
/** 添加/修改区段设备网关映射配置 */
export function setSectionConfig(id, data) {
return request({
url: `/api/device/${id}/config/section`,
method: 'put',
data: data
});
}
/** 添加/修改端头控制盒网关映射配置 */
export function setPslConfig(id, data) {
return request({
@ -177,3 +185,11 @@ export function setIlwConfig(id, data) {
data: data
});
}
/** 添加/修改设备配置 */
export function setDeviceConfig(data) {
return request({
url: `/api/device/config/updateConfig`,
method: 'put',
data: data
});
}

View File

@ -207,7 +207,9 @@ export default {
{label: '虚拟电子沙盘', value: 'SANDBOX'},
{label: '联锁工作站', value: 'ILW'},
{label: 'UDP下位机', value: 'UDP_LOW'},
{label: '区段', value: 'SECTION'}
{label: '区段', value: 'SECTION'},
{label: '列车', value: 'TRAIN'},
{label: 'UDP客户端', value: 'UDP_CLIENT'}
],
ossList: [
{ name: '场景1', url: '场景1—桂花园道岔故障配分版60分.pdf' },

View File

@ -128,7 +128,6 @@ export default {
this.$jlmap.setUpdateScreen(size);
} else {
this.maskOpen = true;
// this.$messageBox('线, ');
}
},
back() {},

View File

@ -278,7 +278,6 @@ export default {
await this.setWindowSize();
await this.initLoadData();
this.selfJmap = Vue.prototype.$jlmap;
console.log(this.selfJmap, Vue.prototype.$jlmap);
},
async beforeDestroy() {
await this.$store.dispatch('training/end', null);

View File

@ -51,7 +51,7 @@
</template>
<script>
import { getDeviceDetail, setPsdConfig, setSignalConfig, setSwitchConfig, setPslConfig, setPscConfig } from '@/api/project';
import { setDeviceConfig, getDeviceDetail } from '@/api/project';
import { getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode } from '@/api/jmap/map';
export default {
@ -66,9 +66,17 @@ export default {
leftRules: {},
rightRules: {},
setDeviceConfigFunction: null,
addrName: '',
data: {},
titleMap: { SWITCH: '道岔', PSD:'屏蔽门', SIGNAL: '信号机', PSL:'端头控制盒', PSC: 'PSC控制柜' },
titleMap: {
SWITCH: '道岔',
PSD:'屏蔽门',
SIGNAL: '信号机',
PSL:'端头控制盒',
PSC: 'PSC控制柜',
SECTION: '区段',
TRAIN: '列车',
UDP_CLIENT: 'UDP客户端'
},
mapId: '',
mapList: [],
stationCode: '',
@ -92,33 +100,34 @@ export default {
}
},
methods: {
initForm(row) {
switch (row.type) {
case 'PSD': {
this.setDeviceConfigFunction = setPsdConfig;
break;
}
case 'SIGNAL': {
this.setDeviceConfigFunction = setSignalConfig;
break;
}
case 'SWITCH': {
this.setDeviceConfigFunction = setSwitchConfig;
this.addrName = '网关地址:';
break;
}
case 'PSL': {
this.setDeviceConfigFunction = setPslConfig;
this.addrName = '网关地址:';
break;
}
case 'PSC': {
this.setDeviceConfigFunction = setPscConfig;
this.addrName = '网关位地址:';
break;
}
}
},
// initForm(row) {
// switch (row.type) {
// case 'PSD': {
// this.setDeviceConfigFunction = setPsdConfig;
// break;
// }
// case 'SIGNAL': {
// this.setDeviceConfigFunction = setSignalConfig;
// break;
// }
// case 'SWITCH': {
// this.setDeviceConfigFunction = setSwitchConfig;
// break;
// }
// case 'PSL': {
// this.setDeviceConfigFunction = setPslConfig;
// break;
// }
// case 'PSC': {
// this.setDeviceConfigFunction = setPscConfig;
// break;
// }
// case 'SECTION': {
// this.setDeviceConfigFunction = setSectionConfig;
// break;
// }
// }
// },
initData(row) {
this.jsonConfig = '{}';
getDeviceDetail(row.id).then(resp => {
@ -143,7 +152,7 @@ export default {
},
doShow(row) {
this.initData(row);
this.initForm(row);
// this.initForm(row);
this.dialogVisible = true;
this.data = row;
},
@ -155,7 +164,7 @@ export default {
flag = valid;
});
}
const form = JSON.parse(this.jsonConfig);
// const form = JSON.parse(this.jsonConfig);
// if (this.data.type === 'PSC' || this.data.type === 'PSL') {
// form.psdCode = this.formModel.psdCode;
// flag && self.setDeviceConfigFunction(this.data.id, form).then(response => {
@ -166,7 +175,8 @@ export default {
// self.$message.error(this.$t('tip.modifyTheFailure') + error.message);
// });
// } else {
flag && self.setDeviceConfigFunction(this.data.id, form).then(response => {
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: this.jsonConfig };
flag && setDeviceConfig(data).then(response => {
self.$message.success('设置设备网关映射配置成功');
self.handleClose();
self.$emit('reloadTable');

View File

@ -29,7 +29,7 @@ export default {
EditConfigIbp
},
data() {
const noShowPathType = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'IBP'];
const noShowPathType = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'IBP', 'SECTION', 'TRAIN', 'UDP_CLIENT'];
return {
examResultList: [],
url: '',
@ -51,7 +51,8 @@ export default {
designgzb: 'GZB',
designheb: 'HEB',
designsdy: 'SDY',
designrichorjoint: 'RICHOR_JOINT'
designrichorjoint: 'RICHOR_JOINT',
designsrsandbox: 'SR_SANDBOX'
},
queryForm: {
labelWidth: '120px',
@ -188,9 +189,10 @@ export default {
});
},
editConfig(index, row) {
const configGatewayList = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'PSC', 'UDP_LOW', 'SECTION', 'TRAIN', 'UDP_CLIENT'];
if (row.type === 'LW' || row.type === 'VR_IBP' || row.type === 'ISCS_LW' || row.type === 'ISCS_CW') {
this.$refs.editConfig.doShow(row);
} else if (row.type === 'SWITCH' || row.type === 'SIGNAL' || row.type === 'PSD' || row.type === 'PSL' || row.type === 'PSC' || row.type === 'UDP_LOW' || row.type === 'SECTION') {
} else if (configGatewayList.includes(row.type)) {
this.$refs.editConfigGateway.doShow(row);
} else if (row.type == 'LSW' || row.type == 'CCTV' || row.type == 'VR_PSD' || row.type === 'PLC_GATEWAY' || row.type === 'SANDBOX' || row.type === 'ILW') {
this.$refs.editConfigScreen.doShow(row);