剧本预览添加 倍速功能

This commit is contained in:
joylink_cuiweidong 2022-08-01 15:27:51 +08:00
parent 5b75682471
commit 67bedb3245

View File

@ -17,6 +17,14 @@
</div> </div>
<!-- 右上角按钮列表 --> <!-- 右上角按钮列表 -->
<div class="schema" :style="{top: offset+'px'}"> <div class="schema" :style="{top: offset+'px'}">
<el-select v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-option
v-for="item in speedList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<template v-if="!dataError"> <template v-if="!dataError">
<el-button-group> <el-button-group>
<el-button size="small" :disabled="viewDisabled || isscriptRun" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button> <el-button size="small" :disabled="viewDisabled || isscriptRun" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
@ -67,6 +75,7 @@ import { Notification } from 'element-ui';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import TrainTicket from '@/views/newMap/trainTicket/index.vue'; import TrainTicket from '@/views/newMap/trainTicket/index.vue';
import RegisterBook from '@/views/newMap/registerBook/index.vue'; import RegisterBook from '@/views/newMap/registerBook/index.vue';
import { timesSpeedPlayback } from '@/api/rtSimulation';
export default { export default {
name:'ScriptButtonGroup', name:'ScriptButtonGroup',
components:{ components:{
@ -103,6 +112,7 @@ export default {
activeTrainList:[], activeTrainList:[],
isscriptRun:false, // isscriptRun:false, //
scriptMode: ScriptMode.TEACH, scriptMode: ScriptMode.TEACH,
speed: 1,
planRunning:false planRunning:false
}; };
}, },
@ -131,8 +141,31 @@ export default {
scriptModeList() { scriptModeList() {
return ScriptMode; return ScriptMode;
}, },
isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
mapId() { mapId() {
return this.$route.query.mapId; return this.$route.query.mapId;
},
speedList() {
return this.isAdmin ? [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' },
{ value: 6, label: '6倍速' },
{ value: 7, label: '7倍速' },
{ value: 8, label: '8倍速' },
{ value: 9, label: '9倍速' },
{ value: 10, label: '10倍速' }
] : [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' }
];
} }
}, },
watch:{ watch:{
@ -148,6 +181,9 @@ export default {
}, },
'$store.state.runPlan.loadRunPlanCount': function () { '$store.state.runPlan.loadRunPlanCount': function () {
this.viewDisabled = false; this.viewDisabled = false;
},
'$store.state.socket.simulationSpeed': function (val) {
this.speed = val;
} }
}, },
async mounted() { async mounted() {
@ -195,6 +231,13 @@ export default {
changeShowMap() { changeShowMap() {
this.$emit('changeShowMap', false); this.$emit('changeShowMap', false);
}, },
speedChange(val) {
timesSpeedPlayback(this.$route.query.group, val).then(resp => {
this.$message.success(`设置${val}倍速成功!`);
}).catch(e => {
this.$message.error('设置倍速失败!');
});
},
// //
async initLoadData() { async initLoadData() {
this.changeScriptMode(this.scriptMode); this.changeScriptMode(this.scriptMode);