tms&pis可视化配置

This commit is contained in:
fan 2023-12-19 11:21:24 +08:00
parent 388f4593f1
commit 1aaa427dac
2 changed files with 90 additions and 3 deletions

View File

@ -88,6 +88,50 @@
</el-select>
</el-form-item>
</el-form>
<el-form v-show="['TMS', 'PIS'].includes(data.type)" ref="formTms" :model="formTms" label-width="100px" :rules="rulesTms">
<el-form-item label="关联设备:" prop="deviceCode" size="small">
<el-select v-model="formTms.deviceCode" placeholder="请选择" size="small">
<el-option
v-for="item in lwList"
:key="item.code"
:label="item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="关联角色:" prop="roleCode">
<el-select v-model="formTms.roleCode" placeholder="请选择" size="small">
<el-option
v-for="item in roleList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="客户端列表:" prop="clientList">
<el-select v-model="formTms.clientList" multiple placeholder="请选择" size="small">
<el-option
v-for="item in clientList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="初始客户端:" prop="client">
<el-select v-model="formTms.client" placeholder="请选择" size="small">
<template v-for="item in clientList">
<el-option
v-if="formTms.clientList.includes(item.id)"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</template>
</el-select>
</el-form-item>
</el-form>
<el-form v-show="data.type === 'LW'" ref="formLw" :model="formLw" label-width="100px" :rules="rulesLw">
<el-form-item label="关联车站:" prop="stationCode">
<el-select v-model="formLw.stationCode" placeholder="请选择" size="small">
@ -242,11 +286,31 @@ export default {
client:'',
clientList: []
},
formTms: {
deviceCode: '',
roleCode:'',
client:'',
clientList: []
},
clientList: [],
pictureList: [
{ label: '广播系统', value: 'paMain' },
{ label: '乘客信息', value: 'pidsMain' }
],
rulesTms:{
deviceCode: [
{ required: true, message: '请选择归属车站', trigger: 'change'}
],
roleCode: [
{ required: true, message: '请选择关联角色', trigger: 'change'}
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
],
clientList: [
{ required: true, message: '请选择客户端列表', trigger: 'change'}
]
},
rulesIm:{
roleCode: [
{ required: true, message: '请选择关联角色', trigger: 'change'}
@ -331,6 +395,10 @@ export default {
this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config);
this.formIscs = Object.assign(this.formIscs, form);
} else if (resp.data.config && ['PIS', 'TMS'].includes(resp.data.type)) {
this.formTms = {deviceCode: '', roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config);
this.formTms = Object.assign(this.formTms, form);
}
}).catch(()=> {
this.$message.error('获取项目设备详情失败!');
@ -348,7 +416,7 @@ export default {
}).catch(() => {
this.$message.error('获取设备列表失败!');
});
} else if (this.data.type === 'ISCS_CW') {
} else if (this.data.type === 'ISCS_CW' || this.data.type === 'PIS') {
getDevicesByType(row.project, 'CW').then(res => {
if (res.data && res.data.length) {
this.lwList = res.data;
@ -356,6 +424,14 @@ export default {
}).catch(() => {
this.$message.error('获取设备列表失败!');
});
} else if (this.data.type === 'TMS') {
getDevicesByType(row.project, 'DRIVE').then(res => {
if (res.data && res.data.length) {
this.lwList = res.data;
}
}).catch(() => {
this.$message.error('获取设备列表失败!');
});
}
getBackProjectConfigByCode(row.project).then(res=>{
const data = res.data;
@ -435,6 +511,17 @@ export default {
self.$message.error(this.$t('tip.modifyTheFailure') + error.message);
});
});
} else if (this.data.type === 'PIS' || this.data.type === 'TMS') {
this.$refs.formTms.validate(() => {
const data = {id: this.data.id, project: this.data.project, code: this.data.code, type: this.data.type, config: JSON.stringify(this.formTms) };
setDeviceConfig(data).then(response => {
self.$message.success('设置设备配置成功');
self.handleClose();
self.$emit('reloadTable');
}).catch(error => {
self.$message.error(this.$t('tip.modifyTheFailure') + error.message);
});
});
}
},
handleClose() {

View File

@ -187,8 +187,8 @@ export default {
});
},
editConfig(index, row) {
const configGatewayList = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'PSC', 'UDP_LOW', 'SECTION', 'TRAIN', 'UDP_CLIENT', 'PIS_STAND', 'PIS_TRAIN', 'PIS', 'TMS'];
if (['LW', 'VR_IBP', 'ISCS_LW', 'ISCS_CW', 'IM', 'CW', 'DRIVE', 'DEPOT'].includes(row.type)) {
const configGatewayList = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'PSC', 'UDP_LOW', 'SECTION', 'TRAIN', 'UDP_CLIENT', 'PIS_STAND', 'PIS_TRAIN', 'PIS'];
if (['LW', 'VR_IBP', 'ISCS_LW', 'ISCS_CW', 'IM', 'CW', 'DRIVE', 'DEPOT', 'TMS', 'PIS'].includes(row.type)) {
this.$refs.editConfig.doShow(row);
} else if (configGatewayList.includes(row.type)) {
this.$refs.editConfigGateway.doShow(row);