代码调整

This commit is contained in:
joylink_cuiweidong 2023-02-13 15:54:45 +08:00
parent ab2a68865d
commit bd43b7c511
2 changed files with 56 additions and 2 deletions

View File

@ -88,6 +88,11 @@ export default {
] ]
}; };
}, },
computed:{
roleDeviceCode() {
return this.$store.state.training.roleDeviceCode;
}
},
watch: { watch: {
'$store.state.menuOperation.menuCount': function () { '$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
@ -100,7 +105,11 @@ export default {
methods: { methods: {
initMenu() { initMenu() {
// //
if (this.selected.code == this.roleDeviceCode) {
this.menu = [...this.menuNormal]; this.menu = [...this.menuNormal];
} else {
this.menu = [];
}
}, },
// //
handleTurnDirection() { handleTurnDirection() {

View File

@ -2,10 +2,21 @@
<div> <div>
<component :is="menus" :selected="selected" /> <component :is="menus" :selected="selected" />
<station-diagram ref="stationDiagram" @setSelected="setSelected" /> <station-diagram ref="stationDiagram" @setSelected="setSelected" />
<div class="changeDriver">
<el-select v-model="currentDriver" placeholder="请选择" style="width: 260px;" @change="changeTrain">
<el-option
v-for="item in trainList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</div> </div>
</template> </template>
<script> <script>
import StationDiagram from '../stationDiagram/index'; import StationDiagram from '../stationDiagram/index';
// import {covertMemberData} from '@/utils/simulation';
// import {mapGetters} from 'vuex'; // import {mapGetters} from 'vuex';
import { clearSubscribe, getTopic} from '@/utils/stomp'; import { clearSubscribe, getTopic} from '@/utils/stomp';
export default { export default {
@ -16,7 +27,8 @@ export default {
data() { data() {
return { return {
menus: null, menus: null,
selected: null selected: null,
currentDriver:''
}; };
}, },
computed: { computed: {
@ -28,6 +40,25 @@ export default {
}, },
mapDevice() { mapDevice() {
return this.$store.state.map.mapDevice; return this.$store.state.map.mapDevice;
},
trainList() {
const trainInList = [];
const activeTrainList = this.$store.state.map.activeTrainList;
let train;
activeTrainList.forEach(element => {
train = this.$store.getters['map/getDeviceByCode'](element);
// const nameList = train.nameFormat.split(':');
// let realName = '';
// nameList.forEach(name=>{
// if (name == 'targetCode') {
// realName += train.destinationCode;
// } else {
// realName += train[name] ? train[name] : '';
// }
// });
trainInList.push({value:train.code, label:'表号' + train.serviceNumber + '车次号' + train.tripNumber + '车组号' + train.groupNumber});
});
return trainInList;
} }
}, },
watch: { watch: {
@ -40,6 +71,10 @@ export default {
}, },
'$store.state.map.initJlmapLoadedCount': function (val) { '$store.state.map.initJlmapLoadedCount': function (val) {
this.handleDispatchWorkData(); this.handleDispatchWorkData();
},
'$store.state.training.roleDeviceCode':function (val) {
debugger;
this.currentDriver = val;
} }
}, },
beforeDestroy() { beforeDestroy() {
@ -59,7 +94,17 @@ export default {
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint); this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint);
}); });
},
changeTrain(code) {
this.$jlmap.setCenter(code);
} }
} }
}; };
</script> </script>
<style lang="scss">
.changeDriver{
position: absolute;
left: 42%;
top: 30px;
}
</style>