仿真右侧列车显示代码调整

This commit is contained in:
joylink_cuiweidong 2020-06-17 15:31:15 +08:00
parent 283206e55d
commit 556d7fa109
4 changed files with 67 additions and 41 deletions

View File

@ -40,6 +40,7 @@ class Jlmap {
// 显示集中站
this.stationCode = '';
this.isUpdateShowTrainList = false;
}
// 初始化属性有鼠标事件 缩放等
@ -421,8 +422,9 @@ class Jlmap {
}
} else {
if (elem.deviceType === 'TRAIN') {
store.dispatch('map/updateTrainState', elem);
store.dispatch('map/setActiveTrainList', elem);
this.isUpdateShowTrainList = true;
store.dispatch('map/updateTrainList', elem);
// store.dispatch('map/updateTrainState', elem);
} else if (elem.deviceType === 'STAND') {
store.dispatch('map/updateStationStand', elem);
}
@ -436,6 +438,10 @@ class Jlmap {
}
}
});
if (this.isUpdateShowTrainList) {
store.dispatch('map/setActiveTrainList');
this.isUpdateShowTrainList = false;
}
this.handleRouteSignalStatus(signalDeviceList);
// 状态后处理
this.postHandle(list || []);

View File

@ -205,7 +205,6 @@ const map = {
updateCount: 0, // 绘图快捷修改标识
mousemove: 0, // 实训战场图移动标识
version: '', // 地图版本,
activeTrainList:{}, // 当前按计划行车的列车列表,
activeTrainListUpdate:0, // 当前按计划行车的列车列表更新标识
runPlanStatus:false, // 是否正处于按计划行车
showCentralizedStationCode: '', // 现地分集中站显示(集中站code)
@ -727,12 +726,10 @@ const map = {
}
});
},
setActiveTrainList:(state, data) => {
state.activeTrainList[data.code] = data;
setActiveTrainList:(state) => {
state.activeTrainListUpdate++;
},
resetActiveTrainList:(state, data) => {
state.activeTrainList = {};
resetActiveTrainList:(state) => {
state.activeTrainListUpdate = 0;
},
setDeleteCount: (state) => {
@ -790,11 +787,11 @@ const map = {
updateAutoReentryState: (state, status) => {
state.autoReentryData[status.code] = deepAssign(state.autoReentryData[status.code], status);
},
updateTrainState:(state, status) =>{
if (state.map.trainList) {
state.map.trainList[parseInt(status.code) - 1] = deepAssign(state.map.trainList[parseInt(status.code) - 1] || {}, status);
}
},
// updateTrainState:(state, status) =>{
// if (state.map.trainList) {
// state.map.trainList[parseInt(status.code) - 1] = deepAssign(state.map.trainList[parseInt(status.code) - 1] || {}, status);
// }
// },
updateStationStand: (state, status) => {
const holdIndex = state.holdStandList.indexOf(status.code);
const jumpIndex = state.jumpStandList.indexOf(status.code);
@ -832,6 +829,14 @@ const map = {
state.flankProtectList.splice(index, 1);
}
});
},
updateTrainList: (state, data)=>{
const trainList = state.map.trainList;
trainList.forEach(elem => {
if (elem.code == data.code) {
elem = deepAssign(elem || {}, data);
}
});
}
},
@ -876,9 +881,9 @@ const map = {
updateAutoReentryState: ({ commit }, status) => {
commit('updateAutoReentryState', status);
},
updateTrainState:({ commit }, status) => {
commit('updateTrainState', status);
},
// updateTrainState:({ commit }, status) => {
// commit('updateTrainState', status);
// },
updateStationStand: ({ commit }, status) => {
commit('updateStationStand', status);
},
@ -906,6 +911,11 @@ const map = {
}
},
// 更新列车信息
updateTrainList:({ commit }, train) => {
commit('updateTrainList', train);
},
setMapDataIdList: ({ state }, data) => {
state.mapIdList[`mapDate_${data.mapId}`] = data.mapData;
},
@ -993,8 +1003,8 @@ const map = {
setDeleteCount: ({ commit }) => {
commit('setDeleteCount');
},
setActiveTrainList: ({ commit }, data) => {
commit('setActiveTrainList', data);
setActiveTrainList: ({ commit }) => {
commit('setActiveTrainList');
},
resetActiveTrainList: ({ commit }) => {
commit('resetActiveTrainList');

View File

@ -70,20 +70,25 @@ export default {
},
watch:{
'$store.state.map.activeTrainListUpdate': function (val) {
const trainList = Object.values(this.$store.state.map.activeTrainList);
if (this.lineCode == '10' || this.lineCode == '11') {
this.topTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && !train.right && train.sectionCode;
});
this.bottomTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.right && train.sectionCode;
});
if (val) {
const trainList = this.$store.state.map.map.trainList;
if (this.lineCode == '10' || this.lineCode == '11') {
this.topTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && !train.right && train.sectionCode;
});
this.bottomTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.right && train.sectionCode;
});
} else {
this.trainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.sectionCode;
});
}
} else {
this.trainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.sectionCode;
});
this.topTrainList = [];
this.bottomTrainList = [];
this.trainList = [];
}
},
'$store.state.map.runPlanStatus': function (val) {
if (!val) {

View File

@ -70,20 +70,25 @@ export default {
},
watch:{
'$store.state.map.activeTrainListUpdate': function (val) {
const trainList = Object.values(this.$store.state.map.activeTrainList);
if (this.lineCode == '10' || this.lineCode == '11') {
this.topTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && !train.right && train.sectionCode;
});
this.bottomTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.right && train.sectionCode;
});
if (val) {
const trainList = this.$store.state.map.map.trainList;
if (this.lineCode == '10' || this.lineCode == '11') {
this.topTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && !train.right && train.sectionCode;
});
this.bottomTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.right && train.sectionCode;
});
} else {
this.trainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.sectionCode;
});
}
} else {
this.trainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.sectionCode;
});
this.topTrainList = [];
this.bottomTrainList = [];
this.trainList = [];
}
},
'$store.state.map.runPlanStatus': function (val) {
if (!val) {