北交大 客流站场仿真页面 订阅顺序调整 图例调整

This commit is contained in:
joylink_cuiweidong 2020-11-20 17:37:17 +08:00
parent e98baa752d
commit c32dc326c4
4 changed files with 76 additions and 20 deletions

View File

@ -47,12 +47,12 @@ class EMouse extends Group {
direction = this.device.model.right != 1; direction = this.device.model.right != 1;
} }
if (LangStorage.getLang() == 'en') { if (LangStorage.getLang() == 'en') {
text = ` The planned train: ${trainType} \n Table No.: ${this.device.model.serviceNumber} \n Train Trip No.: ${this.device.model.tripNumber}\n Destination: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n Train No.: ${this.device.model.groupNumber}\n Early or late: ${destinationText}\n Direction: ${direction ? 'up' : 'down'}\n Crew No.: \n Start Station: \n Terminal Station: \n Occupied Track: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n Current Station: \n Train-ground communication: normal \n Operation Speed level: 4 \n Detained: ${this.device.model.hold ? 'Detained' : 'Normal'}\n \n 跳停状态: ${this.device.model.jump ? 'Skip to continue moving' : 'Normal'}Stationary: ${!this.device.model.stop ? 'No' : 'Yes'}\n Blocked: No \n Speed: ${this.device.model.speed || 0} km/h \n Authorized Distance: ${this.device.model.maLen || 0} m`; text = ` The planned train: ${trainType} \n Table No.: ${this.device.model.serviceNumber} \n Train Trip No.: ${this.device.model.tripNumber}\n Destination: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n Train No.: ${this.device.model.groupNumber}\n Early or late: ${destinationText}\n Direction: ${direction ? 'up' : 'down'}\n Crew No.: \n Start Station: \n Terminal Station: \n Occupied Track: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n Current Station: \n Train-ground communication: normal \n Operation Speed level: 4 \n Detained: ${this.device.model.hold ? 'Detained' : 'Normal'}\n \n 跳停状态: ${this.device.model.jump ? 'Skip to continue moving' : 'Normal'}Stationary: ${!this.device.model.stop ? 'No' : 'Yes'}\n Blocked: No \n Speed: ${this.device.model.speed || 0} km/h \n Authorized Distance: ${this.device.model.maLen || 0} m\nNumber of people: ${this.device.model.num ? this.device.model.num : 0}`;
} else { } else {
if (Vue.prototype.$jlmap.lineCode == '11' || Vue.prototype.$jlmap.lineCode == '10') { if (Vue.prototype.$jlmap.lineCode == '11' || Vue.prototype.$jlmap.lineCode == '10') {
text = `列车类型: ${trainType}\n\0\0\0\0源:人工标记\n\0\0号: ${this.device.model.groupNumber}\n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0点: ${destinationText}\n运行方向: ${direction ? '上行' : '下行'}\nATP报告方向: ${direction ? '上行' : '下行'}\n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: \n车次通信: 通信车\n运行时间: \n停站时间: \n扣车状态: ${ this.device.model.hold ? '扣车' : '正常'}\n车载扣车: 不执行\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'}\n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车状态: ${this.device.model.runLevel || 'CTC'}\n最高信号系统控制: CTC\n驾驶模式: ${this.device.model.driveMode}模式\n最高ATP模式: AM\nATP1状态: 激活\nATP2状态: 备用\n速度: ${this.device.model.speed || 0} km/h\n车门状态: ${this.device.model.speed ? '关闭' : direction ? '左开右关' : '左关右开'}\n制动状态: 无紧急制动\n停车保证: 可保证停车\n站台无法进入: 否\n前方站台停车点: 中间\n折法策略: \n折返状态: \n屏蔽门开门许可: 是\n运营里程: 无效\n总重量: 196T\n车长: 11860cm\n列车编组: 1`; text = `列车类型: ${trainType}\n\0\0\0\0源:人工标记\n\0\0号: ${this.device.model.groupNumber}\n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0点: ${destinationText}\n运行方向: ${direction ? '上行' : '下行'}\nATP报告方向: ${direction ? '上行' : '下行'}\n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: \n车次通信: 通信车\n运行时间: \n停站时间: \n扣车状态: ${ this.device.model.hold ? '扣车' : '正常'}\n车载扣车: 不执行\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'}\n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车状态: ${this.device.model.runLevel || 'CTC'}\n最高信号系统控制: CTC\n驾驶模式: ${this.device.model.driveMode}模式\n最高ATP模式: AM\nATP1状态: 激活\nATP2状态: 备用\n速度: ${this.device.model.speed || 0} km/h\n车门状态: ${this.device.model.speed ? '关闭' : direction ? '左开右关' : '左关右开'}\n制动状态: 无紧急制动\n停车保证: 可保证停车\n站台无法进入: 否\n前方站台停车点: 中间\n折法策略: \n折返状态: \n屏蔽门开门许可: 是\n运营里程: 无效\n总重量: 196T\n车长: 11860cm\n列车编组: 1`;
} else { } else {
text = `列车类型: ${trainType} \n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0号: ${this.device.model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${direction ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.model.hold ? '扣车' : '正常'}\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'} \n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m`; text = `列车类型: ${trainType} \n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0号: ${this.device.model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${direction ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? (this.device.model.sectionModel.parentName ? this.device.model.sectionModel.parentName : this.device.model.sectionModel.name) : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${this.device.model.hold ? '扣车' : '正常'}\n跳停状态: ${this.device.model.jump ? '跳停' : '正常'} \n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m${this.device.model.num ? '\n车内人数: ' + this.device.model.num : ''}`;
} }
} }
const trainTip = this.device.style.Train.common.trainTip; const trainTip = this.device.style.Train.common.trainTip;

View File

@ -84,6 +84,7 @@ export default class Train extends Group {
hold:model.hold, hold:model.hold,
jump:model.jump, jump:model.jump,
stop:model.stop, stop:model.stop,
num:model.num,
dt: model.dt, dt: model.dt,
driveMode: model.driveMode, driveMode: model.driveMode,
model: model model: model
@ -381,11 +382,11 @@ export default class Train extends Group {
if (num) { if (num) {
// && num > 0 // && num > 0
const passagerNum = parseInt(num); const passagerNum = parseInt(num);
if (passagerNum < 40) { if (passagerNum < 100) {
this.trainB && this.trainB.setTrainColor('#29a909'); this.trainB && this.trainB.setTrainColor('#29a909');
this.trainL && this.trainL.setColor('#29a909'); this.trainL && this.trainL.setColor('#29a909');
this.trainR && this.trainR.setColor('#29a909'); this.trainR && this.trainR.setColor('#29a909');
} else if (passagerNum < 80 && passagerNum >= 40) { } else if (passagerNum < 200 && passagerNum >= 100) {
this.trainB && this.trainB.setTrainColor('#ffa500'); this.trainB && this.trainB.setTrainColor('#ffa500');
this.trainL && this.trainL.setColor('#ffa500'); this.trainL && this.trainL.setColor('#ffa500');
this.trainR && this.trainR.setColor('#ffa500'); this.trainR && this.trainR.setColor('#ffa500');

View File

@ -5,6 +5,7 @@ function handle(state, data) {
// console.log(data, 'socket订阅'); // console.log(data, 'socket订阅');
const msg = data.body; const msg = data.body;
const path = window.location.href; const path = window.location.href;
if (path.includes('/practiceDisplay') && !state.isFirst) { state.isFirst = true; }
switch (data.type) { switch (data.type) {
case 'Order_Pay_Result': // 订单支付结果消息 case 'Order_Pay_Result': // 订单支付结果消息
state.payOrder = msg; state.payOrder = msg;
@ -298,6 +299,7 @@ const socket = {
standPfiNum:null, // 站台客流人数信息 standPfiNum:null, // 站台客流人数信息
trainPfiNum:null, // 列车客流当前人数信息 trainPfiNum:null, // 列车客流当前人数信息
trainPfiBL:null, // 列车客流乘降人数信息 trainPfiBL:null, // 列车客流乘降人数信息
isFirst:false, // 第一次是否已经订阅
competitionPracticeFinish:0, // 竞赛场景结束标识 competitionPracticeFinish:0, // 竞赛场景结束标识
simulationAlarmInfo: []// 仿真报警信息 simulationAlarmInfo: []// 仿真报警信息
}, },
@ -359,6 +361,14 @@ const socket = {
}, },
setAssistantSubscribe:(state, assistantIsSubscribe)=>{ setAssistantSubscribe:(state, assistantIsSubscribe)=>{
state.assistantIsSubscribe = assistantIsSubscribe; state.assistantIsSubscribe = assistantIsSubscribe;
},
resetTrainPassagerNum:(state, assistantIsSubscribe)=>{
state.standPfiNum = null;
state.trainPfiNum = null;
state.trainPfiBL = null;
},
setIsFirst:(state, isFirst)=>{
state.isFirst = isFirst;
} }
}, },
@ -424,6 +434,12 @@ const socket = {
}, },
setAssistantSubscribe:({ commit }, msg) => { setAssistantSubscribe:({ commit }, msg) => {
commit('setAssistantSubscribe', msg); commit('setAssistantSubscribe', msg);
},
resetTrainPassagerNum:({ commit }) => {
commit('resetTrainPassagerNum');
},
setIsFirst:({ commit }, isFirst) => {
commit('setIsFirst', isFirst);
} }
} }
}; };

View File

@ -9,18 +9,35 @@
</div> </div>
<menu-system-time ref="menuSystemTime" :offset="15" :group="group" /> <menu-system-time ref="menuSystemTime" :offset="15" :group="group" />
<div class="trainExample"> <div class="trainExample">
<div class="trainExampleName">列车/车站 颜色图例</div> <div class="trainExampleL">
<div class="eachTrainExample"> <div class="trainExampleName">车站 颜色图例</div>
<span class="smallExample" /> <div class="eachTrainExample">
<span class="eachTrainExampleName">0 ~ 40</span> <span class="smallExample" />
<span class="eachTrainExampleName">0 ~ 40</span>
</div>
<div class="eachTrainExample">
<span class="mediumExample" />
<span class="eachTrainExampleName">40 ~ 80</span>
</div>
<div class="eachTrainExample">
<span class="bigExample" />
<span class="eachTrainExampleName">80及以上</span>
</div>
</div> </div>
<div class="eachTrainExample"> <div class="trainExampleR">
<span class="mediumExample" /> <div class="trainExampleName">列车 颜色图例</div>
<span class="eachTrainExampleName">40 ~ 80</span> <div class="eachTrainExample">
</div> <span class="smallExample" />
<div class="eachTrainExample"> <span class="eachTrainExampleName">0 ~ 100</span>
<span class="bigExample" /> </div>
<span class="eachTrainExampleName">80及以上</span> <div class="eachTrainExample">
<span class="mediumExample" />
<span class="eachTrainExampleName">100 ~ 200</span>
</div>
<div class="eachTrainExample">
<span class="bigExample" />
<span class="eachTrainExampleName">200及以上</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -92,18 +109,27 @@ export default {
this.$store.dispatch('training/updateMapState', stationNumList); this.$store.dispatch('training/updateMapState', stationNumList);
}, },
'$store.state.socket.trainPfiNum':function(val) { '$store.state.socket.trainPfiNum':function(val) {
const trainNumList = val; const trainNumList = this.$store.state.socket.trainPfiNum;
trainNumList.forEach(stationNum=>{ trainNumList.forEach(stationNum=>{
stationNum.deviceType = 'TRAIN'; stationNum.deviceType = 'TRAIN';
console.log(stationNum.num, 'inital');
}); });
this.$store.dispatch('training/updateMapState', trainNumList); this.$store.dispatch('training/updateMapState', trainNumList);
}, },
'$store.state.socket.trainPfiBL':function(val) { '$store.state.socket.trainPfiBL':function(val) {
const device = this.$store.getters['map/getDeviceByCode'](val.code); const trainNum = this.$store.state.socket.trainPfiBL;
const trainNum = val; const device = this.$store.getters['map/getDeviceByCode'](trainNum.code);
trainNum.deviceType = 'TRAIN'; trainNum.deviceType = 'TRAIN';
// console.log(trainNum, device, device.num, trainNum.in, trainNum.out, 'changed');
trainNum.num = device.num + trainNum.in - trainNum.out; trainNum.num = device.num + trainNum.in - trainNum.out;
// console.log(trainNum.num, 'changeder');
this.$store.dispatch('training/updateMapState', [trainNum]); this.$store.dispatch('training/updateMapState', [trainNum]);
},
'$store.state.socket.isFirst':function(val) {
if (val) {
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${jl3dTopic}\/${this.$route.query.group}`, header);
}
} }
}, },
beforeDestroy() { beforeDestroy() {
@ -111,6 +137,8 @@ export default {
if (this.group) { if (this.group) {
clearSimulation(this.group); clearSimulation(this.group);
this.clearSubscribe(); this.clearSubscribe();
this.$store.dispatch('socket/resetTrainPassagerNum');
this.$store.dispatch('socket/setIsFirst', false);
} }
}, },
mounted() { mounted() {
@ -153,8 +181,12 @@ export default {
async subscribe() { async subscribe() {
this.clearSubscribe(); this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() }; const header = { group: this.group || '', 'X-Token': getToken() };
// creatSubscribe(`${jl3dTopic}\/${this.$route.query.group}`, header);
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
creatSubscribe(`${jl3dTopic}\/${this.$route.query.group}`, header); // setTimeout(()=>{
// }, 500);
// });
await this.$store.dispatch('training/setHasSubscribed'); await this.$store.dispatch('training/setHasSubscribed');
}, },
clearSubscribe() { clearSubscribe() {
@ -190,7 +222,7 @@ export default {
} }
.trainExample{ .trainExample{
position: absolute; position: absolute;
width: 260px; width: 360px;
padding: 10px; padding: 10px;
left: 20px; left: 20px;
top: 20px; top: 20px;
@ -214,4 +246,11 @@ export default {
.smallExample{background: #29a909;} .smallExample{background: #29a909;}
.mediumExample{background: #ffa500;} .mediumExample{background: #ffa500;}
.bigExample{background: #F00;} .bigExample{background: #F00;}
.trainExampleL{
float: left;
display: inline-block;
margin-right: 35px;
margin-left: 10px;
}
.trainExampleR{display: inline-block;}
</style> </style>