tms订阅调整

This commit is contained in:
joylink_fanyuhong 2024-06-28 14:04:27 +08:00
parent 0c4c5bebb0
commit 364bd1e539
2 changed files with 15 additions and 5 deletions

View File

@ -35,7 +35,7 @@ export function getTopic(type, group, param) {
topic = `/queue/simulation/${group}/iscs/gate/${param.stationCode}`; topic = `/queue/simulation/${group}/iscs/gate/${param.stationCode}`;
break; break;
case 'TMS': case 'TMS':
topic = `/queue/simulation/${group}/train/001/tms`; topic = `/queue/simulation/${group}/train/${param.groupNumber}/tms`;
break; break;
case 'PIS_STAND': case 'PIS_STAND':
topic = `/queue/simulation/${group}/standPis/${param.standCode}`; topic = `/queue/simulation/${group}/standPis/${param.standCode}`;

View File

@ -8,7 +8,7 @@
<td>网压</td> <td>网压</td>
<td>网流</td> <td>网流</td>
<td>速度</td> <td>速度</td>
<td>牵引/制动级位</td> <td>牵引/制动级位111</td>
<td>里程标</td> <td>里程标</td>
<td>下一站</td> <td>下一站</td>
<td>目的站</td> <td>目的站</td>
@ -143,7 +143,7 @@
</div> </div>
</td></template </td></template
> >
<template v-else-if="k === '交流输出电压'"> <template v-else-if="k === '交流输出电压111'">
<td v-for="(item, j) in v" :key="j"> <td v-for="(item, j) in v" :key="j">
{{ item }} {{ item }}
</td></template </td></template
@ -230,6 +230,7 @@ export default {
data() { data() {
return { return {
localStatic: JL3D_LOCAL_STATIC, localStatic: JL3D_LOCAL_STATIC,
groupNumber: '001',
trainInfo: { trainInfo: {
voltage: 1600, voltage: 1600,
current: 317, current: 317,
@ -261,6 +262,14 @@ export default {
} }
}; };
}, },
watch: {
'$store.state.training.roleDeviceCode': function (val) {
if(val) {
this.unsubscribe();
this.subscribe();
}
}
},
mounted() { mounted() {
this.group = this.$route.query.group; this.group = this.$route.query.group;
this.subscribe(); this.subscribe();
@ -275,7 +284,8 @@ export default {
methods: { methods: {
subscribe() { subscribe() {
const header = { group: this.group || "", "X-Token": getToken() }; const header = { group: this.group || "", "X-Token": getToken() };
creatSubscribe(getTopic("TMS", this.group), header, msg => { this.groupNumber = this.$store.state.training.roleDeviceCode
creatSubscribe(getTopic("TMS", this.group, { groupNumber: this.groupNumber }), header, msg => {
let res = JSON.parse(msg.body); let res = JSON.parse(msg.body);
console.log(res); console.log(res);
console.log(res.parkingBreakPressure); console.log(res.parkingBreakPressure);
@ -315,7 +325,7 @@ export default {
}); });
}, },
unsubscribe() { unsubscribe() {
clearSubscribe(getTopic("TMS", this.group)); clearSubscribe(getTopic("TMS", this.group, { groupNumber: this.groupNumber }));
}, },
setTractionWave(flag) { setTractionWave(flag) {
if (timer) { if (timer) {