代码调整

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: {
'$store.state.menuOperation.menuCount': function () {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
@ -100,7 +105,11 @@ export default {
methods: {
initMenu() {
//
this.menu = [...this.menuNormal];
if (this.selected.code == this.roleDeviceCode) {
this.menu = [...this.menuNormal];
} else {
this.menu = [];
}
},
//
handleTurnDirection() {

View File

@ -2,10 +2,21 @@
<div>
<component :is="menus" :selected="selected" />
<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>
</template>
<script>
import StationDiagram from '../stationDiagram/index';
// import {covertMemberData} from '@/utils/simulation';
// import {mapGetters} from 'vuex';
import { clearSubscribe, getTopic} from '@/utils/stomp';
export default {
@ -16,7 +27,8 @@ export default {
data() {
return {
menus: null,
selected: null
selected: null,
currentDriver:''
};
},
computed: {
@ -28,6 +40,25 @@ export default {
},
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: {
@ -40,6 +71,10 @@ export default {
},
'$store.state.map.initJlmapLoadedCount': function (val) {
this.handleDispatchWorkData();
},
'$store.state.training.roleDeviceCode':function (val) {
debugger;
this.currentDriver = val;
}
},
beforeDestroy() {
@ -59,7 +94,17 @@ export default {
this.$nextTick(()=>{
this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint);
});
},
changeTrain(code) {
this.$jlmap.setCenter(code);
}
}
};
</script>
<style lang="scss">
.changeDriver{
position: absolute;
left: 42%;
top: 30px;
}
</style>