竞赛系统 实操题目录制代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-27 14:45:32 +08:00
parent eaa18f3539
commit 53c8c13405
4 changed files with 248 additions and 2 deletions

View File

@ -133,8 +133,14 @@ export default {
},
doRecord(index, row) {
// row.id
let raceInfo;
this.raceList.forEach(each=>{
if (each.id == row.raceId) {
raceInfo = each;
}
});
practiceRecordNotify(83).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang, lineCode:this.$route.query.lineCode};
const query = { mapId: raceInfo.mapId, group: resp.data, scriptId: row.id, lineCode:raceInfo.lineCode};
this.$router.push({ path: `${UrlConfig.practiceDisplayNew}/practice`, query });
launchFullscreen();
}).catch(error => {

View File

@ -52,6 +52,20 @@
<menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :group="group" :data-error="dataError" />
<menu-practice
v-if="isPractice"
ref="menuPractice"
:group="group"
:offset="offset"
:offset-bottom="offsetBottom"
:show-station="showStation"
:station-list="stationList"
:show-select-station="showSelectStation"
:data-error="dataError"
@switchMode="switchMode"
@switchStationMode="switchStationMode"
/>
<menu-train-list v-if="isDemon" @setCenter="setCenter" />
<menu-schema
@ -96,6 +110,7 @@ import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import MenuScript from '@/views/newMap/displayNew/menuScript';
import MenuPractice from '@/views/newMap/displayNew/menuPractice';
import Scheduling from './demon/scheduling';
import { mapGetters } from 'vuex';
import { getTrainingStepsDetailNew, getTrainingDetailNew } from '@/api/jmap/training';
@ -128,6 +143,7 @@ export default {
MenuSchema,
MenuSystemTime,
MenuTrainList,
MenuPractice,
// Jl3dSimulation,
Jl3dDrive,
Jl3dDevice,
@ -223,6 +239,9 @@ export default {
isScript() {
return this.mode === 'script';
},
isPractice() {
return this.mode === 'practice';
},
isScreen() {
return this.model === 'dp';
},
@ -426,6 +445,8 @@ export default {
await this.initLoadDemonData();
} else if (this.isScript) {
await this.initLoadTaskData();
} else if (this.isPractice) {
await this.initPracticeData();
} else {
await this.initLoadLessonOrExamData();
}
@ -481,6 +502,18 @@ export default {
this.endViewLoading();
}
},
//
async initPracticeData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.switchMode('01');
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
//
async selectQuest(row, id, mapLocation, roleName) {
try {

View File

@ -0,0 +1,206 @@
<template>
<div class="menuPractice">
<div class="practice-schema" :style="{top: offset+'px'}">
<el-select v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-select v-if="showSelectStation&&swch=='01'" v-model="showStationContent" style="width: 100px;" size="small" @change="switchStationModeInfo">
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
<div class="practice-bottom" :style="{bottom: offsetBottom + 'px'}">
<el-button-group>
<!-- v-if="!isScriptCommand" -->
<!-- v-if="!isScriptCommand" -->
<el-button type="success" :disabled="isDisable || dataError" @click="selectBeginTime">按计划行车</el-button>
<el-button type="danger" :disabled="!isDisable" @click="end">退出计划</el-button>
<el-button type="primary" @click="back">返回</el-button>
</el-button-group>
</div>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
</div>
</template>
<script>
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import { Notification } from 'element-ui';
export default {
name: 'MenuPractice',
components:{
SetTime
},
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
},
offsetBottom: {
type: Number,
required: true
},
dataError: {
type: Boolean,
default() {
return false;
}
},
showSelectStation: {
type: Boolean,
default() {
return false;
}
},
showStation: {
type: String,
default() {
return '';
}
},
stationList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
isDisable: false,
swch: '01',
showStationContent:'',
swchList: [
{ value: '01', name: '现地' },
{ value: '02', name: '行调' }
]
};
},
watch:{
'showStation':function(val) {
this.showStationContent = this.showStation;
}
},
methods:{
back() {
this.$store.dispatch('training/over').then(() => {
history.go(-1);
Notification.closeAll();
});
},
selectBeginTime() {
this.$refs.setTime.doShow();
},
start(model) {
this.isDisable = true;
const data = {
time: model.initTime
// loadNumber:this.trainList.length
};
// const data = {
// time: model.initTime
// };
// if (this.$route.query.prdType === '04') {
// data.loadNumber = model.loadNum;
// }
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('map/setRunPlanStatus', true);
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('map/setShowCentralizedStationNum');
});
}).catch((error) => {
this.isDisable = false;
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') {
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5003') {
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5004') {
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5000') {
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4000') {
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4001') {
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4002') {
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4003') {
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4004') {
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
}
});
},
switchMode(swch) {
this.$emit('switchMode', swch);
this.switchModeInner(swch);
},
switchModeInner(swch) {
let showMode = '03';
if (swch == '01') {
showMode = '03';
} else if (swch == '02') {
showMode = '02';
}
const nameList = Object.keys(this.$store.state.map.map || {});
let list = [];
nameList.forEach(item => {
if (item !== 'skinVO') {
const data = this.$store.state.map.map[item];
if (data && data.constructor === Array) {
list = [...list, ...data];
}
}
});
this.$jlmap.updateShowMode(list, showMode);
if (swch == '02') {
this.switchStationMode('');
} else {
this.switchStationMode(null);
}
},
switchStationModeInfo(val) {
this.showStationContent = val;
this.$emit('switchStationMode', val);
},
switchStationMode(val) {
this.$emit('switchStationMode', val);
},
end() {
this.isDisable = false;
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/setRunPlanStatus', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.isDisable = true;
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
}
}
};
</script>
<style lang="scss" scoped>
.practice-schema {
z-index: 9;
display: inline;
position: absolute;
right: 15px;
}
.practice-bottom {
position: absolute;
float: right;
right: 15px;
bottom: 15px;
}
</style>

View File

@ -47,7 +47,8 @@ export default {
return this.$route.params.mode == 'demon' ||
this.$route.params.mode == 'dp' ||
this.$route.params.mode == 'plan' ||
this.$route.params.mode == 'script' ||
this.$route.params.mode == 'script' ||
this.$route.params.mode == 'practice' ||
!this.$route.params.mode;
},
pause() {