代码调整

This commit is contained in:
joylink_cuiweidong 2021-08-18 18:16:56 +08:00
parent e0c073034a
commit 7999dedba1
2 changed files with 33 additions and 5 deletions

View File

@ -31,7 +31,8 @@
</template> </template>
<template v-else-if="!projectDevice"> <template v-else-if="!projectDevice">
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button> <el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
<el-button v-if="isDisable&&isAdmin" v-loading="pauseLoading" :type="simulationPause?'warning':'primary'" size="small" @click="startOrPause">{{ simulationPause?'开始':'暂停' }}</el-button> <!-- isDisable&& -->
<el-button v-if="isAdmin" v-loading="pauseLoading" :type="simulationPaused?'warning':'primary'" size="small" @click="startOrPause">{{ simulationPaused?'开始':'暂停' }}</el-button>
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button> <el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
</template> </template>
</template> </template>
@ -160,7 +161,7 @@ export default {
isAdmin() { isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05'); return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
}, },
simulationPause() { simulationPaused() {
return this.$store.state.socket.simulationPause; return this.$store.state.socket.simulationPause;
} }
}, },
@ -221,7 +222,7 @@ export default {
methods: { methods: {
startOrPause() { startOrPause() {
this.pauseLoading = true; this.pauseLoading = true;
if (this.simulationPause) { if (this.simulationPaused) {
simulationStart(this.group).then(resp => { simulationStart(this.group).then(resp => {
this.pauseLoading = false; this.pauseLoading = false;
}).catch(() => { }).catch(() => {

View File

@ -34,6 +34,7 @@
<template v-if="isAdmin && project != 'refereeJsxt' && $route.query.type !== 'ILW'"> <template v-if="isAdmin && project != 'refereeJsxt' && $route.query.type !== 'ILW'">
<!-- 按计划行车 --> <!-- 按计划行车 -->
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button> <el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button>
<el-button v-if="isAdministrator" v-loading="pauseLoading" :type="simulationPaused?'warning':'primary'" size="small" @click="startOrPause">{{ simulationPaused?'开始':'暂停' }}</el-button>
<el-button type="danger" size="small" @click="end">{{ $t('joinTraining.initialize') }}</el-button> <el-button type="danger" size="small" @click="end">{{ $t('joinTraining.initialize') }}</el-button>
</template> </template>
</template> </template>
@ -62,6 +63,7 @@ import { getPublishLessonListByMapId } from '@/api/jmap/lesson';
import { getPostByProjectCode } from '@/api/learn'; import { getPostByProjectCode } from '@/api/learn';
import { ProjectCode } from '@/scripts/ProjectConfig'; import { ProjectCode } from '@/scripts/ProjectConfig';
import ContectUs from '@/views/newMap/displayNew/dispatherContest/contectUs'; import ContectUs from '@/views/newMap/displayNew/dispatherContest/contectUs';
import { simulationPause, simulationStart } from '@/api/rtSimulation';
export default { export default {
name: 'MenuDemonJoint', name: 'MenuDemonJoint',
@ -113,6 +115,7 @@ export default {
return { return {
backLoading: false, backLoading: false,
chatShow: true, chatShow: true,
pauseLoading: false,
isGoback: false, isGoback: false,
noSimulationQrCodeList: NoSimulationQrCodeList, noSimulationQrCodeList: NoSimulationQrCodeList,
isShow3dmodel :false, isShow3dmodel :false,
@ -134,10 +137,10 @@ export default {
return (this.$store.state.training.prdType == '02' || this.isAdmin) && (!this.$route.query.projectDevice); return (this.$store.state.training.prdType == '02' || this.isAdmin) && (!this.$route.query.projectDevice);
}, },
isDISPATCHER() { isDISPATCHER() {
console.log("================================"); console.log('================================');
console.log(this.$store.state.training.prdType); console.log(this.$store.state.training.prdType);
return (this.$store.state.training.prdType == '01'||this.$store.state.training.prdType == '02' || this.isAdmin) && (!this.$route.query.projectDevice || this.project == 'sdy'); return (this.$store.state.training.prdType == '01' || this.$store.state.training.prdType == '02' || this.isAdmin) && (!this.$route.query.projectDevice || this.project == 'sdy');
}, },
isStationSupervisor() { isStationSupervisor() {
return this.userRole == 'STATION_SUPERVISOR' && (!this.$route.query.projectDevice || this.project == 'sdy'); return this.userRole == 'STATION_SUPERVISOR' && (!this.$route.query.projectDevice || this.project == 'sdy');
@ -191,6 +194,12 @@ export default {
}, },
statusIconShow() { statusIconShow() {
return (this.$route.query.lineCode == '11' || this.$route.query.lineCode == '10') && this.$store.state.training.prdType == '02'; return (this.$route.query.lineCode == '11' || this.$route.query.lineCode == '10') && this.$store.state.training.prdType == '02';
},
isAdministrator() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
simulationPaused() {
return this.$store.state.socket.simulationPause;
} }
}, },
watch: { watch: {
@ -255,6 +264,24 @@ export default {
}); });
}, },
methods: { 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('暂停失败,请稍后再试');
});
}
},
// Admin Instructor Dispatcher Attendant Audience Driver MAINTAINER // Admin Instructor Dispatcher Attendant Audience Driver MAINTAINER
addrolesList(list) { addrolesList(list) {
list.forEach(item => { list.forEach(item => {