tms页面数据
This commit is contained in:
parent
0b688dea64
commit
907a88c6ea
@ -33,7 +33,10 @@ export function getTopic(type, group, param) {
|
||||
break;
|
||||
case 'ISCSGATE':
|
||||
topic = `/queue/simulation/${group}/iscs/gate/${param.stationCode}`;
|
||||
break;
|
||||
break;
|
||||
case 'TMS':
|
||||
topic = `/queue/simulation/${group}/train/001/tms`
|
||||
break;
|
||||
case 'PIS_STAND':
|
||||
topic = `/queue/simulation/${group}/standPis/${param.standCode}`;
|
||||
break;
|
||||
|
@ -37,7 +37,7 @@ export function defaultCallback(Response) {
|
||||
handle(JSON.parse(Response.body));
|
||||
}
|
||||
function handle(data) {
|
||||
const msg = data.body;
|
||||
const msg = data.body;
|
||||
switch (data.type) {
|
||||
case 'Order_Pay_Result': // 订单支付结果消息
|
||||
store.dispatch('socket/setPayOrder', msg);
|
||||
|
@ -18,7 +18,7 @@
|
||||
<td>{{ trainInfo.voltage }}V</td>
|
||||
<td>{{ trainInfo.current }}A</td>
|
||||
<td>{{ trainInfo.speed }} km/h</td>
|
||||
<td>{{ trainInfo.traction }}%</td>
|
||||
<td :class="{ bg_g: trainInfo.traction > 0, bg_r: trainInfo.traction < 0 }">{{ trainInfo.traction }}%</td>
|
||||
<td>{{ trainInfo.mileage || '--' }}</td>
|
||||
<td>{{ trainInfo.nextStation }}</td>
|
||||
<td>{{ trainInfo.destination }}</td>
|
||||
@ -46,8 +46,8 @@
|
||||
<template v-else-if="k === '制动缸压力'">
|
||||
<td v-for="(item, j) in v" :key="j">
|
||||
<div class="multi">
|
||||
<div style="width: 50%">{{ item[0] }}</div>
|
||||
<div style="width: 50%">{{ item[1] }}</div>
|
||||
<div style="width: 50%">{{ item }}</div>
|
||||
<div style="width: 50%">{{ item }}</div>
|
||||
</div>
|
||||
</td>
|
||||
</template>
|
||||
@ -60,22 +60,22 @@
|
||||
</td></template
|
||||
>
|
||||
<template v-else-if="k === '1侧门'">
|
||||
<td v-for="(item, j) in v" :key="j">
|
||||
<td v-for="j in 6" :key="j">
|
||||
<div class="multi">
|
||||
<div :class="item[0] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 1 : 8 }}</div>
|
||||
<div :class="item[1] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 3 : 6 }}</div>
|
||||
<div :class="item[2] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 5 : 4 }}</div>
|
||||
<div :class="item[3] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 7 : 2 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 1 : 8 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 3 : 6 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 5 : 4 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 7 : 2 }}</div>
|
||||
</div>
|
||||
</td></template
|
||||
>
|
||||
<template v-else-if="k === '2侧门'">
|
||||
<td v-for="(item, j) in v" :key="j">
|
||||
<td v-for="j in 6" :key="j">
|
||||
<div class="multi">
|
||||
<div :class="item[0] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 2 : 7 }}</div>
|
||||
<div :class="item[1] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 4 : 5 }}</div>
|
||||
<div :class="item[2] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 6 : 3 }}</div>
|
||||
<div :class="item[3] ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 8 : 1 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 2 : 7 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 4 : 5 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 6 : 3 }}</div>
|
||||
<div :class="v ? 'bg_g' : 'bg_r'" style="width: 25%">{{ j < 3 ? 8 : 1 }}</div>
|
||||
</div>
|
||||
</td></template
|
||||
>
|
||||
@ -109,6 +109,11 @@
|
||||
|
||||
<script>
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { creatSubscribe, clearSubscribe, getTopic } from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { defaultCallback, stateCallback, diagramSimCallback } from '@/utils/subscribeCallback';
|
||||
|
||||
let timer = null;
|
||||
|
||||
export default {
|
||||
name: 'tmsPage',
|
||||
@ -120,31 +125,17 @@ export default {
|
||||
current: 317,
|
||||
speed: 102,
|
||||
traction: 3,
|
||||
mileage: 0,
|
||||
mileage: '--',
|
||||
nextStation: 'XX站',
|
||||
destination: 'YY站',
|
||||
},
|
||||
carInfo: {
|
||||
辅助状态: ['ON', '--', 'OFF', '--', '--', 'ON'],
|
||||
牵引系统状态: [0, 58, 47, 52, 50, 0],
|
||||
制动缸压力: [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]],
|
||||
制动缸压力: [0, 0, 0, 0, 0, 0],
|
||||
转向架切除: [[' ', ' '], [' ', ' '], [' ', ' '], [' ', ' '], [' ', ' '], [' ', ' ']],
|
||||
'1侧门': [
|
||||
[true, true, true, true],
|
||||
[true, false, true, true],
|
||||
[true, true, true, true],
|
||||
[true, true, false, true],
|
||||
[true, true, true, true],
|
||||
[true, true, true, true],
|
||||
],
|
||||
'2侧门': [
|
||||
[true, false, true, true],
|
||||
[true, true, true, true],
|
||||
[true, true, true, true],
|
||||
[true, true, false, true],
|
||||
[true, true, true, true],
|
||||
[true, true, true, true],
|
||||
],
|
||||
'1侧门': true,
|
||||
'2侧门': true,
|
||||
交流输出电压: [378, '--', '--', '--', '--', 378],
|
||||
空压机状态: ['--', '--', '', '', '--', '--'],
|
||||
停放制动施加状态: [7.85, 7.85, 7.85, 7.85, 7.85, 7.85],
|
||||
@ -153,6 +144,52 @@ export default {
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.group = this.$route.query.group;
|
||||
this.subscribe();
|
||||
this.setTractionWave(true);
|
||||
},
|
||||
unmounted() {
|
||||
this.unsubscribe();
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
subscribe() {
|
||||
const header = { group: this.group || '', 'X-Token': getToken() };
|
||||
creatSubscribe(getTopic('TMS', this.group), header, msg => {
|
||||
const res = JSON.parse(msg.body);
|
||||
this.trainInfo.current = res.current;
|
||||
this.trainInfo.voltage = res.voltage;
|
||||
this.trainInfo.speed = res.speed;
|
||||
this.trainInfo.traction = res.tbLevelPercent;
|
||||
this.trainInfo.mileage = res.mileage;
|
||||
this.trainInfo.nextStation = res.nextStation;
|
||||
this.trainInfo.destination = res.destination;
|
||||
this.carInfo.制动缸压力 = Array(6).fill(res.pressureOfBrakeCylinder);
|
||||
this.carInfo['1侧门'] = res.oneSideDoorOpened;
|
||||
this.carInfo['2侧门'] = res.twoSideDoorOpened;
|
||||
this.carInfo.停放制动施加状态 = Array(6).fill(res.parkingBreakPressure);
|
||||
this.setTractionWave(res.traction);
|
||||
});
|
||||
},
|
||||
unsubscribe() {
|
||||
clearSubscribe(getTopic('TMS', this.group));
|
||||
},
|
||||
setTractionWave(flag) {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
if (flag) {
|
||||
timer = setInterval(() => {
|
||||
this.carInfo.牵引系统状态 = Array(6)
|
||||
.fill(true)
|
||||
.map(b => (b ? (Math.random() * 10 + 46).toFixed() : '--'));
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -145,7 +145,7 @@ export default {
|
||||
const mapClientList = mapClientMap ? mapClientMap[this.$route.query.simType] : [];
|
||||
if (!mapClientList.length) {
|
||||
this.$store.dispatch('app/animationsClose');
|
||||
this.$messageBox('为获取到客户端数据,请查验地图数据!');
|
||||
this.$messageBox('未获取到客户端数据,请查验地图数据!');
|
||||
}
|
||||
mapClientList.forEach(client => {
|
||||
if (clientIdList && clientIdList.length) {
|
||||
|
Loading…
Reference in New Issue
Block a user