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-select>
</el-form-item> </el-form-item>
</el-form> </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 v-show="data.type === 'LW'" ref="formLw" :model="formLw" label-width="100px" :rules="rulesLw">
<el-form-item label="关联车站:" prop="stationCode"> <el-form-item label="关联车站:" prop="stationCode">
<el-select v-model="formLw.stationCode" placeholder="请选择" size="small"> <el-select v-model="formLw.stationCode" placeholder="请选择" size="small">
@ -242,11 +286,31 @@ export default {
client:'', client:'',
clientList: [] clientList: []
}, },
formTms: {
deviceCode: '',
roleCode:'',
client:'',
clientList: []
},
clientList: [], clientList: [],
pictureList: [ pictureList: [
{ label: '广播系统', value: 'paMain' }, { label: '广播系统', value: 'paMain' },
{ label: '乘客信息', value: 'pidsMain' } { 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:{ rulesIm:{
roleCode: [ roleCode: [
{ required: true, message: '请选择关联角色', trigger: 'change'} { required: true, message: '请选择关联角色', trigger: 'change'}
@ -331,6 +395,10 @@ export default {
this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:'', clientList: []}; this.formIscs = {deviceCode: '', picture: '', stationCode: '', roleCode:'', client:'', clientList: []};
const form = JSON.parse(resp.data.config); const form = JSON.parse(resp.data.config);
this.formIscs = Object.assign(this.formIscs, form); 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(()=> { }).catch(()=> {
this.$message.error('获取项目设备详情失败!'); this.$message.error('获取项目设备详情失败!');
@ -348,7 +416,7 @@ export default {
}).catch(() => { }).catch(() => {
this.$message.error('获取设备列表失败!'); 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 => { getDevicesByType(row.project, 'CW').then(res => {
if (res.data && res.data.length) { if (res.data && res.data.length) {
this.lwList = res.data; this.lwList = res.data;
@ -356,6 +424,14 @@ export default {
}).catch(() => { }).catch(() => {
this.$message.error('获取设备列表失败!'); 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=>{ getBackProjectConfigByCode(row.project).then(res=>{
const data = res.data; const data = res.data;
@ -435,6 +511,17 @@ export default {
self.$message.error(this.$t('tip.modifyTheFailure') + error.message); 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() { handleClose() {

View File

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