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

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

View File

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

View File

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

View File

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