西安三号线 按计划行车/添加列车 列车列表代码调整

This commit is contained in:
joylink_cuiweidong 2020-06-02 18:30:12 +08:00
parent dea961be7b
commit 4c38334d2c
4 changed files with 38 additions and 39 deletions

View File

@ -419,9 +419,7 @@ class Jlmap {
} else {
if (elem.deviceType === 'TRAIN') {
store.dispatch('map/updateTrainState', elem);
if (index >= list.length - 1) {
store.dispatch('map/setTrainListUpdate');
}
store.dispatch('map/setActiveTrainList', elem);
} else if (elem.deviceType === 'STAND') {
store.dispatch('map/updateStationStand', elem);
}

View File

@ -205,7 +205,8 @@ const map = {
updateCount: 0, // 绘图快捷修改标识
mousemove: 0, // 实训战场图移动标识
version: '', // 地图版本,
trainListUpdate:0, // 列车列表更新标识,
activeTrainList:{}, // 当前按计划行车的列车列表,
activeTrainListUpdate:0, // 当前按计划行车的列车列表更新标识
runPlanStatus:false, // 是否正处于按计划行车
showCentralizedStationCode: '', // 现地分集中站显示(集中站code)
showCentralizedStationNum: 0, // 现地分集中站显示判断
@ -719,8 +720,13 @@ const map = {
}
});
},
setTrainListUpdate:(state) => {
state.trainListUpdate++;
setActiveTrainList:(state, data) => {
state.activeTrainList[data.code] = data;
state.activeTrainListUpdate++;
},
resetActiveTrainList:(state, data) => {
state.activeTrainList = {};
state.activeTrainListUpdate = 0;
},
setDeleteCount: (state) => {
state.deleteCount++;
@ -973,8 +979,11 @@ const map = {
setDeleteCount: ({ commit }) => {
commit('setDeleteCount');
},
setTrainListUpdate: ({ commit }) => {
commit('setTrainListUpdate');
setActiveTrainList: ({ commit }, data) => {
commit('setActiveTrainList', data);
},
resetActiveTrainList: ({ commit }) => {
commit('resetActiveTrainList');
},
setUpdateCount: ({ commit }) => {
commit('setUpdateCount');

View File

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

View File

@ -69,30 +69,25 @@ export default {
}
},
watch:{
'$store.state.map.trainListUpdate': function (val) {
'$store.state.map.activeTrainListUpdate': function (val) {
const trainList = Object.values(this.$store.state.map.activeTrainList);
if (this.lineCode == '10' || this.lineCode == '11') {
this.topTrainList = this.$store.state.map.map.trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && !train.right;
this.topTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && !train.right && train.sectionCode;
});
this.bottomTrainList = this.$store.state.map.map.trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.right;
this.bottomTrainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.right && train.sectionCode;
});
} else {
this.trainList = this.$store.state.map.map.trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined;
this.trainList = trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined && train.sectionCode;
});
}
},
'$store.state.map.runPlanStatus': function (val) {
if (!val) {
if (this.lineCode == '10' || this.lineCode == '11') {
this.topTrainList = [];
this.bottomTrainList = [];
} else {
this.trainList = [];
}
this.$store.dispatch('map/resetActiveTrainList');
}
}
},
@ -114,11 +109,13 @@ export default {
this.$emit('setCenter', code);
},
covert(data) {
let min = (Math.abs(data) - Math.abs(data) % 60) / 60;
let seconds = Math.abs(data) % 60;
const hours = Math.floor(data / 3600);
let min = Math.floor((data % 3600) / 60);
let seconds = (data % 3600) % 60;
min = min > 9 ? min : '0' + min;
seconds = seconds > 9 ? seconds : '0' + seconds;
return data == 0 ? '00:00' : (data > 0 ? min + ':' + seconds + 'E' : min + ':' + seconds + 'L');
const time = hours + ':' + min + ':' + seconds;
return data == 0 ? '00:00:00' : (data > 0 ? time + 'E' : time + 'L');
}
}
};