实训调整

This commit is contained in:
fan 2020-04-07 14:40:24 +08:00
parent 6498f68295
commit 6667adca07
6 changed files with 45 additions and 59 deletions

View File

@ -134,18 +134,9 @@ export default {
}, },
'$store.state.training.prdType': function (val) { '$store.state.training.prdType': function (val) {
if (val == '01' && this.centralizedStationList1.length) { if (val == '01' && this.centralizedStationList1.length) {
this.switchShowStation(this.centralizedStationList1[0].code); this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationList1[0].code);
} else { } else {
this.switchShowStation(''); this.$store.dispatch('map/setShowCentralizedStationCode', '');
}
},
'$store.state.training.offsetStationCode': function(code) {
if (code) {
const sectionModel = this.$store.getters['map/getDeviceByCode'](code);
if (sectionModel._type == 'Section' || sectionModel._type == 'Switch' || sectionModel._type == 'Signal') {
const stationModel = this.$store.getters['map/getDeviceByCode'](sectionModel.stationCode);
this.switchShowStation(stationModel.code);
}
} }
} }
}, },
@ -176,20 +167,12 @@ export default {
this.stationCode = centralizedStationList[0].code; this.stationCode = centralizedStationList[0].code;
} }
if (this.$store.state.training.prdType == '01') { if (this.$store.state.training.prdType == '01') {
this.switchShowStation(this.stationCode); this.$store.dispatch('map/setShowCentralizedStationCode', this.stationCode);
} }
}, },
switchShowStation(stationCode) { switchShowStation(stationCode) {
this.stationCode = stationCode; this.stationCode = stationCode;
const nameList = Object.keys(this.$store.state.map.map); this.$store.dispatch('map/setShowCentralizedStationCode', stationCode);
let list = [];
nameList.forEach(item => {
if (item !== 'skinVO') {
list = [...list, ...this.$store.state.map.map[item]];
}
});
this.$jlmap.updateShowStation(list, stationCode);
this.$jlmap.setCenter(stationCode);
}, },
undeveloped() { undeveloped() {
this.doClose(); this.doClose();

View File

@ -203,7 +203,8 @@ const map = {
mousemove: 0, // 实训战场图移动标识 mousemove: 0, // 实训战场图移动标识
version: '', // 地图版本, version: '', // 地图版本,
trainListUpdate:0, // 列车列表更新标识, trainListUpdate:0, // 列车列表更新标识,
runPlanStatus:false // 是否正处于按计划行车 runPlanStatus:false, // 是否正处于按计划行车
showCentralizedStationCode: '' // 现地分集中站显示(集中站code)
}, },
getters: { getters: {
@ -714,6 +715,9 @@ const map = {
}, },
setRunPlanStatus:(state, runPlanStatus) => { setRunPlanStatus:(state, runPlanStatus) => {
state.runPlanStatus = runPlanStatus; state.runPlanStatus = runPlanStatus;
},
setShowCentralizedStationCode: (state, stationCode) => {
state.showCentralizedStationCode = stationCode;
} }
}, },
@ -880,6 +884,9 @@ const map = {
}, },
setRunPlanStatus:({commit}, runPlanStatus) => { setRunPlanStatus:({commit}, runPlanStatus) => {
commit('setRunPlanStatus', runPlanStatus); commit('setRunPlanStatus', runPlanStatus);
},
setShowCentralizedStationCode: ({commit}, stationCode) => {
commit('setShowCentralizedStationCode', stationCode);
} }
} }
}; };

View File

@ -148,7 +148,7 @@ export default {
group: '', group: '',
showStation: '', showStation: '',
stationList: [], stationList: [],
showSelectStation: false, showSelectStation: false, // select
prdTypeMap: { prdTypeMap: {
'01': '01', // => '01': '01', // =>
'02': '02', // => '02': '02', // =>
@ -234,7 +234,7 @@ export default {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`); this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
}); });
} }
this.$refs.mapCanvas && this.$refs.mapCanvas.setShowStation(this.showStation); this.switchStationMode(this.showStation);
}, },
'$store.state.map.mousemove': function (val) { '$store.state.map.mousemove': function (val) {
this.mousemove(); this.mousemove();
@ -261,32 +261,6 @@ export default {
'$store.state.map.map': function (val) { '$store.state.map.map': function (val) {
this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01'; this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01';
this.showSelectStation && this.setStationList(val); this.showSelectStation && this.setStationList(val);
},
'$store.state.training.offsetStationCode': function(code) {
if (code) {
this.setCenter(code);
}
if (code && this.showSelectStation) {
const deviceModel = this.$store.getters['map/getDeviceByCode'](code);
if (deviceModel._type == 'Section' || deviceModel._type == 'Switch' || deviceModel._type == 'Signal' || deviceModel._type == 'Switch') {
const stationModel = this.$store.getters['map/getDeviceByCode'](deviceModel.stationCode);
this.switchStationMode(stationModel.code, true);
} else if (deviceModel._type === 'Station') {
let stationModel = '';
if (deviceModel.centralized) {
stationModel = deviceModel;
} else {
this.$store.state.map.map.stationList || [].forEach(item => {
item.chargeStationCodeList || [].forEach(it => {
if (it === deviceModel.code) {
stationModel = item;
}
});
});
}
this.switchStationMode(stationModel.code, true);
}
}
} }
}, },
async created() { async created() {
@ -612,9 +586,9 @@ export default {
panel.setAttribute('style', ''); panel.setAttribute('style', '');
} }
}, },
switchStationMode(val, isTraining) { switchStationMode(val) {
this.showStation = val; this.showStation = val;
this.$refs.mapCanvas && this.$refs.mapCanvas.setShowStation(this.showStation, isTraining); this.$store.dispatch('map/setShowCentralizedStationCode', this.showStation);
}, },
setStationList(val) { setStationList(val) {
this.stationList = []; this.stationList = [];

View File

@ -69,7 +69,8 @@ export default {
concentrationStationList: [], concentrationStationList: [],
showMode: '03', showMode: '03',
localStationShow: false, localStationShow: false,
previewOrMapDraw: false previewOrMapDraw: false,
trainingSetStation: false //
}; };
}, },
computed: { computed: {
@ -135,6 +136,33 @@ export default {
}, },
'$store.state.training.prdType': function (val) { '$store.state.training.prdType': function (val) {
this.changePrdType(val); this.changePrdType(val);
},
'$store.state.map.showCentralizedStationCode': function (val) {
this.setShowStation(val);
},
'$store.state.training.offsetStationCode': function(code) {
if (code && this.localStationShow && this.$store.state.training.prdType === '01') {
const deviceModel = this.$store.getters['map/getDeviceByCode'](code);
if (deviceModel._type == 'Section' || deviceModel._type == 'Switch' || deviceModel._type == 'Signal' || deviceModel._type == 'Switch') {
const stationModel = this.$store.getters['map/getDeviceByCode'](deviceModel.stationCode);
this.setShowStation(stationModel.code, true);
} else if (deviceModel._type === 'Station') {
let stationModel = '';
if (deviceModel.centralized) {
stationModel = deviceModel;
} else {
this.$store.state.map.map.stationList || [].forEach(item => {
item.chargeStationCodeList || [].forEach(it => {
if (it === deviceModel.code) {
stationModel = item;
}
});
});
}
this.setShowStation(stationModel.code, true);
}
this.setCenter(code);
}
} }
}, },
created() { created() {

View File

@ -165,9 +165,6 @@ export default {
mapViewLoaded(loading) { mapViewLoaded(loading) {
this.$refs.jlmapVisual && this.$refs.jlmapVisual.mapViewLoaded(loading); this.$refs.jlmapVisual && this.$refs.jlmapVisual.mapViewLoaded(loading);
}, },
setShowStation(stationCode, isTraining) {
this.$refs.jlmapVisual && this.$refs.jlmapVisual.setShowStation(stationCode, isTraining);
},
setCenter(code) { setCenter(code) {
this.$refs.jlmapVisual && this.$refs.jlmapVisual.setCenter(code); this.$refs.jlmapVisual && this.$refs.jlmapVisual.setCenter(code);
} }

View File

@ -111,9 +111,6 @@ export default {
clearSubscribe() { clearSubscribe() {
clearSubscribe(`${displayTopic}\/${this.group}`); clearSubscribe(`${displayTopic}\/${this.group}`);
}, },
setShowStation(stationCode, isTraining) {
this.$refs.mapCommon && this.$refs.mapCommon.setShowStation(stationCode, isTraining);
},
setCenter(code) { setCenter(code) {
this.$refs.mapCommon && this.$refs.mapCommon.setCenter(code); this.$refs.mapCommon && this.$refs.mapCommon.setCenter(code);
}, },