剧本编制 切换角色 过滤掉不在线的司机

This commit is contained in:
joylink_cuiweidong 2020-07-09 15:09:18 +08:00
parent 9e71ca967f
commit 763d04d630
2 changed files with 38 additions and 6 deletions

View File

@ -223,6 +223,7 @@ const map = {
mousemove: 0, // 实训战场图移动标识
version: '', // 地图版本,
activeTrainListUpdate:0, // 当前按计划行车的列车列表更新标识
activeTrainListChange:0, // 当前按计划行车的列车列表变化标识只对列车的groupNumber进行了检测
activeTrainList:[], // 当前按计划行车的列车列表
runPlanStatus:false, // 是否正处于按计划行车
showCentralizedStationCode: '', // 现地分集中站显示(集中站code)
@ -853,10 +854,15 @@ const map = {
let isExist = false;
state.activeTrainList.forEach(elem => {
if (elem == data.code) {
isExist = true;
if (data.dispose) {
state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1);
state.activeTrainListChange += 1;
} else {
isExist = true;
}
}
});
if (!isExist) { state.activeTrainList.push(data.code); }
if (!isExist) { state.activeTrainList.push(data.code); state.activeTrainListChange += 1; }
}
},

View File

@ -65,6 +65,7 @@ export default {
autoSaveScript: null,
isSavingScript: false,
mapLocation:null,
allMemberList:[],
memberList:[],
size: {
width: 300,
@ -91,8 +92,12 @@ export default {
'$store.state.scriptRecord.simulationPause': function(val) {
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
},
'$store.state.map.runPlanStatus':function (val) {
this.$refs.getAction.loadInitData();
// '$store.state.map.runPlanStatus':function (val) {
// // this.$refs.getAction.loadInitData();
// this.changeRunPlanStatus();
// },
'$store.state.map.activeTrainListChange':function (val) {
this.changeRunPlanStatus();
}
},
beforeDestroy() {
@ -106,18 +111,39 @@ export default {
this.backDisabled = response.data.bgSet;
this.mapLocation = response.data.mapLocation;
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
if (response.data.bgSet) { this.$store.dispatch('map/setRunPlanStatus', true); }
// if (response.data.bgSet) { this.$store.dispatch('map/setRunPlanStatus', true); }
});
},
methods:{
initData() {
getSimulationMemberList(this.group).then(resp => {
const lastData = JSON.stringify(resp.data);
this.memberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
this.allMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
this.changeRunPlanStatus();
}).catch(error => {
this.$message(error.message);
});
},
changeRunPlanStatus() {
debugger;
this.memberList = [];
if (this.$store.state.map.runPlanStatus) {
const activeList = this.$store.state.map.activeTrainList;
this.allMemberList.forEach(allmember=>{
if (allmember.type == '司机') {
if (activeList.length > 0 && activeList.includes(allmember.deviceCode)) {
this.memberList.push(allmember);
}
} else {
this.memberList.push(allmember);
}
});
} else {
this.memberList = this.allMemberList.filter(member=>{
return member.type != '司机';
});
}
},
minisize() {
if (this.isShow) {
this.isShow = false;