Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
5aefd0dea0
@ -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,9 @@
|
||||
<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.tractionPercent > 0, bg_r: trainInfo.tractionPercent < 0 }">
|
||||
{{ Math.abs(trainInfo.tractionPercent) }}%
|
||||
</td>
|
||||
<td>{{ trainInfo.mileage || '--' }}</td>
|
||||
<td>{{ trainInfo.nextStation }}</td>
|
||||
<td>{{ trainInfo.destination }}</td>
|
||||
@ -46,8 +48,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 +62,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
|
||||
>
|
||||
@ -97,7 +99,18 @@
|
||||
<td :class="{ bg_g: item }" v-for="(item, j) in v" :key="j">{{ item ? '' : '-- --' }}</td></template
|
||||
>
|
||||
<td v-if="i === 0" :rowspan="Object.keys(carInfo).length + 1">
|
||||
<img class="speedBg" :src="localStatic + '/jl3d/tms/PMS3.png'" />
|
||||
<div class="speedBg">
|
||||
<img :src="`${localStatic}/jl3d/tms/PMS3.png`" />
|
||||
<div
|
||||
id="accBar"
|
||||
:style="{
|
||||
transform: `scaleY(${Math.abs(trainInfo.tractionPercent) / 100})`,
|
||||
}"
|
||||
:class="{ bg_g: trainInfo.tractionPercent > 0, bg_r: trainInfo.tractionPercent < 0 }"
|
||||
></div>
|
||||
<div class="gap"></div>
|
||||
<div id="speedBar" :style="{ transform: `scaleY(${trainInfo.speed / 80})` }"></div>
|
||||
</div>
|
||||
<div>{{ trainInfo.speed }} km/h</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -109,6 +122,10 @@
|
||||
|
||||
<script>
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { creatSubscribe, clearSubscribe, getTopic } from '@/utils/stomp';
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
let timer = null;
|
||||
|
||||
export default {
|
||||
name: 'tmsPage',
|
||||
@ -118,33 +135,19 @@ export default {
|
||||
trainInfo: {
|
||||
voltage: 1600,
|
||||
current: 317,
|
||||
speed: 102,
|
||||
traction: 3,
|
||||
mileage: 0,
|
||||
nextStation: 'XX站',
|
||||
destination: 'YY站',
|
||||
speed: 0,
|
||||
tractionPercent: 0,
|
||||
mileage: '--',
|
||||
nextStation: '',
|
||||
destination: '',
|
||||
},
|
||||
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 +156,56 @@ 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 => {
|
||||
let res = JSON.parse(msg.body);
|
||||
console.log(res);
|
||||
if (!res) return;
|
||||
|
||||
if (res.current) this.trainInfo.current = res.current;
|
||||
if (res.voltage) this.trainInfo.voltage = res.voltage;
|
||||
if (res.speed) this.trainInfo.speed = res.speed.toFixed(2);
|
||||
if (res.tbLevelPercent) this.trainInfo.tractionPercent = res.tbLevelPercent;
|
||||
if (res.mileage) this.trainInfo.mileage = res.mileage;
|
||||
if (res.nextStation) this.trainInfo.nextStation = res.nextStation;
|
||||
if (res.destination) this.trainInfo.destination = res.destination;
|
||||
if (res.pressureOfBrakeCylinder)
|
||||
this.carInfo.制动缸压力 = Array(6).fill(res.pressureOfBrakeCylinder.toFixed(2));
|
||||
if (res.oneSideDoorOpened) this.carInfo['1侧门'] = res.oneSideDoorOpened;
|
||||
if (res.twoSideDoorOpened) this.carInfo['2侧门'] = res.twoSideDoorOpened;
|
||||
if (res.parkingBreakPressure) 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>
|
||||
|
||||
@ -163,9 +216,16 @@ export default {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.bg_g {
|
||||
background: #0f0;
|
||||
color: #000;
|
||||
}
|
||||
.bg_r {
|
||||
background: #f00;
|
||||
}
|
||||
#content {
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
width: 80%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: flex;
|
||||
color: #fff;
|
||||
@ -175,7 +235,7 @@ export default {
|
||||
align-items: center;
|
||||
table {
|
||||
width: 100%;
|
||||
font-size: 1rem;
|
||||
font-size: 1.4rem;
|
||||
text-align: center;
|
||||
border-collapse: collapse;
|
||||
td {
|
||||
@ -213,15 +273,30 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
.bg_g {
|
||||
background: #0f0;
|
||||
color: #000;
|
||||
}
|
||||
.bg_r {
|
||||
background: #f00;
|
||||
}
|
||||
.speedBg {
|
||||
height: 90%;
|
||||
padding: 2px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 10%;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
}
|
||||
.gap {
|
||||
width: 4%;
|
||||
}
|
||||
div {
|
||||
width: 23%;
|
||||
transform-origin: bottom;
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
#speedBar {
|
||||
background: #0ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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