实训调整

This commit is contained in:
fan 2022-11-29 15:08:40 +08:00
parent b71e2d959b
commit 2e195abb8f
8 changed files with 100 additions and 50 deletions

View File

@ -130,7 +130,7 @@ export default {
label: this.$t('menu.menuSignal.cancelInterlockAutoTrigger'),
handler: this.cancelAutoTrigger,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO_TRIGGER,
isDisabled: signal => signal.ciControl !== 0,
isDisabled: signal => signal.ciControl !== 1,
isShow: (signal, work) => work === 'localWork'
},
{

View File

@ -67,6 +67,9 @@ export default {
mode() {
return this.$route.params.mode;
},
simType() {
return this.$route.query.simType;
},
//
project() {
return getSessionStorage('project');
@ -89,9 +92,7 @@ export default {
async mounted() {
this.setWindowSize();
this.group = this.$route.query.group;
if (!this.isLesson && !this.isExam) {
this.initLoadData();
}
},
beforeDestroy() {
this.$store.dispatch('socket/clearTrainingOverCount');
@ -114,7 +115,9 @@ export default {
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
this.$store.dispatch('training/setDomConfig', resp.data.paramVO && resp.data.paramVO.domConfig ? resp.data.paramVO.domConfig : {});
loadMapDataById(this.mapId, 'simulation');
if (this.simType === 'METRO') {
this.loadRunPlan();
}
} else {
this.endViewLoading();
this.$messageBox('此地图数据正在维护中,无法运行!');

View File

@ -38,7 +38,7 @@ export default {
}
},
watch: {
'$store.state.socket.runPlanReloadCount': function (val) {
'$store.state.socket.runPlanReloadCount': function () {
getSimulationInfoNew(this.group).then(res => {
this.$store.dispatch('runPlan/setRunPlanInfo', res.data.runPlan);
loadRunPlanData(this.group);
@ -48,9 +48,6 @@ export default {
beforeDestroy() {
this.$store.dispatch('runPlan/setPlanData', []);
},
mounted() {
// this.menus = this.$theme.loadPlanComponent(this.$route.query.lineCode);
},
methods: {
doShow() {
this.show = true;
@ -72,8 +69,8 @@ export default {
user-select: none;
position: absolute;
z-index: 38;
top: 0px;
right: 0px;
top: 0;
right: 0;
background: white;
}
</style>

View File

@ -312,7 +312,7 @@ export default {
description: this.editData.description,
labelJson: this.editData.label,
type: this.editData.type,
client: this.$store.state.map.picture
client: this.editData.type === 'SINGLE' ? this.$store.state.map.picture : ''
};
await updateTraining(trainingData);
await updateTrainingStep(this.group, this.editData.id, list);

View File

@ -22,10 +22,6 @@
<span class="list-label">{{ $t('display.training.trainingName') }}</span>
<span class="list-elem">{{ trainingDetail.name }}</span>
</p>
<p v-if="demoMode === TrainingMode.TEST" class="list-item">
<span class="list-label">{{ $t('display.lesson.score') }}</span>
<span class="list-elem">{{ trainingScore }}</span>
</p>
<p class="list-item">
<span class="list-label">实训模式</span>
<span class="list-elem">
@ -57,6 +53,7 @@
</div>
</div>
<scene-play-role ref="scenePlayRole" @startTraining="startTraining" />
<test-result ref="testResult" />
</div>
</template>
@ -64,11 +61,13 @@
import { ScriptMode } from '@/scripts/ConstDic';
import { startTraining, endTraining } from '@/api/jmap/training';
import ScenePlayRole from './scenePlayRole';
import TestResult from './testResult';
export default {
name: 'TipTrainingDetail',
components: {
ScenePlayRole
ScenePlayRole,
TestResult
},
props: {
offsetBottom: {
@ -81,8 +80,7 @@ export default {
isShrink: true,
showSumbit: false,
demoMode: ScriptMode.TEACH,
TrainingMode: ScriptMode,
trainingScore: 0
TrainingMode: ScriptMode
};
},
computed: {
@ -99,16 +97,6 @@ export default {
return this.$store.state.trainingNew.teachMode;
}
},
watch: {
'$store.state.trainingNew.scoreList': function(val) {
if (val && val.length) {
this.trainingScore = 0;
val.forEach(scoreItem => {
this.trainingScore += scoreItem.score;
});
}
}
},
mounted() {
this.loadInitData();
},
@ -146,16 +134,19 @@ export default {
this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode);
startTraining(this.group, {mode: this.demoMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
this.trainingScore = 0;
}).catch(() => {
this.$message.error('开始实训失败!');
});
},
handlerEnd() {
const scoreList = this.$store.state.trainingNew.scoreList;
if (this.demoMode === ScriptMode.TEST) {
const scoringRules = this.$store.state.trainingNew.scoringRules;
const scoringRule = scoringRules.find(rule => rule.memberId == this.$store.state.training.myMemberId);
this.$refs.testResult.doShow(scoreList, this.$store.state.trainingNew.stepList, scoringRule.details);
}
endTraining(this.group, scoreList).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.trainingScore = 0;
}).catch(() => {
this.$message.error('结束实训失败!');
});

View File

@ -0,0 +1,68 @@
<template>
<el-dialog
title="测试成绩"
:visible.sync="dialogVisible"
width="30%"
append-to-body
show-summary
:before-close="handleClose"
>
<el-table :data="scoringRuleList" border style="width: 100%">
<el-table-column prop="elementId" label="步骤">
<template slot-scope="scope">
<span>
{{ handleStepInfo(scope.row.elementId) }}
</span>
</template>
</el-table-column>
<el-table-column prop="score" label="总分" width="100" />
<el-table-column label="得分" width="100">
<template slot-scope="scope">
<span>
{{ handleTotalScore(scope.row.elementId) }}
</span>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'TestResult',
data() {
return {
dialogVisible: false,
scoreList: [],
stepList: [],
scoringRuleList: []
};
},
methods: {
handleClose() {
this.dialogVisible = false;
},
doShow(scoreList, stepList, scoringRuleList) {
this.scoreList = scoreList;
this.stepList = stepList;
this.scoringRuleList = scoringRuleList;
this.dialogVisible = true;
},
handleStepInfo(stepId) {
const stepInfo = this.stepList.find(step => stepId == step.id);
return stepInfo ? stepInfo.description : '';
},
handleTotalScore(stepId) {
const rule = this.scoringRuleList.find(item => stepId == item.elementId);
return rule ? rule.score : '';
}
}
};
</script>
<style scoped>
</style>

View File

@ -24,10 +24,6 @@
<span class="list-label">{{ $t('display.training.trainingName') }}</span>
<span class="list-elem">{{ trainingDetail.name }}</span>
</p>
<p v-if="demoMode === TrainingMode.TEST" class="list-item">
<span class="list-label">{{ $t('display.lesson.score') }}</span>
<span class="list-elem">{{ trainingScore }}</span>
</p>
<p class="list-item">
<span class="list-label">实训模式</span>
<span class="list-elem">
@ -69,6 +65,7 @@
</div>
</div>
<scene-play-role ref="scenePlayRole" @startTraining="startTraining" />
<test-result ref="testResult" />
</div>
</template>
@ -76,10 +73,12 @@
import { ScriptMode } from '@/scripts/ConstDic';
import { startTraining, endTraining } from '@/api/jmap/training';
import ScenePlayRole from './scenePlayRole';
import TestResult from './testResult';
import { getPublishSingleList, getPublishTrainingDetail, loadPublishTraining, getPublishScenesList } from '@/api/jmap/training';
export default {
name: 'TipTrainingDetail',
components: {
TestResult,
ScenePlayRole
},
props: {
@ -172,8 +171,7 @@ export default {
}
]
},
playerId: '',
trainingScore: 0
playerId: ''
};
},
computed: {
@ -193,16 +191,6 @@ export default {
return this.$route.query.mapId;
}
},
watch: {
'$store.state.trainingNew.scoreList': function(val) {
if (val && val.length) {
this.trainingScore = 0;
val.forEach(scoreItem => {
this.trainingScore += scoreItem.score;
});
}
}
},
mounted() {
this.loadInitData();
},
@ -241,16 +229,19 @@ export default {
this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode);
startTraining(this.group, {mode: this.demoMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
this.trainingScore = 0;
}).catch(() => {
this.$message.error('开始实训失败!');
});
},
handlerEnd() {
const scoreList = this.$store.state.trainingNew.scoreList;
if (this.demoMode === ScriptMode.TEST) {
const scoringRules = this.$store.state.trainingNew.scoringRules;
const scoringRule = scoringRules.find(rule => rule.memberId == this.$store.state.training.myMemberId);
this.$refs.testResult.doShow(scoreList, this.$store.state.trainingNew.stepList, scoringRule.details);
}
endTraining(this.group, scoreList).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.trainingScore = 0;
}).catch(() => {
this.$message.error('结束实训失败!');
});

View File

@ -79,7 +79,7 @@ export default {
queryForm: {
labelWidth: '80px',
reset: true,
leftSpan: 18,
leftSpan: 16,
queryObject: {
name: {
type: 'text',