增加 仿真 开始/暂停 组件

This commit is contained in:
joylink_cuiweidong 2022-09-26 15:58:20 +08:00
parent 4238abdeb5
commit 47bdeed516
3 changed files with 62 additions and 2 deletions

View File

@ -4,6 +4,7 @@
<!-- v-show="!specialDispatch" -->
<map-system-draft ref="mapCanvas" @back="back" />
</transition>
<simulation-control ref="simulationControl" />
<simulation-menu ref="simulationMenu" :mode="mode" />
<!-- 可切换的终端类型 -->
<terminal-list ref="terminalList" />
@ -20,6 +21,7 @@ import { clearSimulation, getSimulationInfoNew} from '@/api/simulation';
import { destroySimulation, getSimulationInfoByGroup } from '@/api/rtSimulation';
import { loadMapDataById } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
import SimulationControl from './simulationControl.vue';
// clearSimulation,
// ranAsPlan, exitRunPlan
export default {
@ -27,7 +29,8 @@ export default {
components: {
MapSystemDraft,
SimulationMenu,
TerminalList
TerminalList,
SimulationControl
},
data() {
return {

View File

@ -0,0 +1,57 @@
<template>
<div class="simulationControlAll">
<el-button class="controlButton" :loading="pauseLoading" circle :class="simulationPaused?'el-icon-video-play':'el-icon-video-pause'" @click="startOrPause" />
</div>
</template>
<script>
import { simulationPause, simulationStart } from '@/api/rtSimulation';
export default {
name:'SimulationControl',
data() {
return {
pauseLoading:false,
group:''
};
},
computed: {
simulationPaused() {
return this.$store.state.socket.simulationPause;
}
},
mounted() {
this.group = this.$route.query.group;
},
methods:{
startOrPause() {
this.pauseLoading = true;
if (this.simulationPaused) {
simulationStart(this.group).then(resp => {
this.pauseLoading = false;
}).catch(() => {
this.pauseLoading = false;
this.$messageBox('开始失败,请稍后再试');
});
} else {
simulationPause(this.group).then(resp => {
this.pauseLoading = false;
}).catch(() => {
this.pauseLoading = false;
this.$messageBox('暂停失败,请稍后再试');
});
}
}
}
};
</script>
<style lang="scss" scoped>
.simulationControlAll{
position: absolute;
bottom: 10px;
right: 78px;
}
.controlButton{
font-size: 28px;
padding: 3px;
background: #fff;
}
</style>

View File

@ -860,7 +860,7 @@ export default {
<style lang="scss" scoped>
.allSimulationMenu{
position: absolute;
width: 200px;
// width: 200px;
height: 200px;
right: 0px;
bottom: 0px;