竞赛结果弹窗代码调整

This commit is contained in:
joylink_cuiweidong 2020-10-15 17:47:13 +08:00
parent cd55c5b269
commit 653c01cec2
3 changed files with 284 additions and 6 deletions

View File

@ -75,6 +75,8 @@
<operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" /> <operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" />
<test-result ref="testResult" />
</div> </div>
</template> </template>
@ -106,6 +108,7 @@ import { launchFullscreen } from '@/utils/screen';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import { createSimulationNew } from '@/api/simulation'; import { createSimulationNew } from '@/api/simulation';
import OperationalStatistic from './operationalStatistic.vue'; import OperationalStatistic from './operationalStatistic.vue';
import TestResult from './testResult.vue';
import Vue from 'vue'; import Vue from 'vue';
export default { export default {
@ -119,6 +122,7 @@ export default {
TheoryExamSelect, TheoryExamSelect,
TheoryExam, TheoryExam,
OperationalStatistic, OperationalStatistic,
TestResult,
// TheoryQuiz, // TheoryQuiz,
// ThroryResult, // ThroryResult,
SelectRole SelectRole
@ -166,6 +170,7 @@ export default {
scriptMode: ScriptMode.TEACH, scriptMode: ScriptMode.TEACH,
mapLocation:{}, mapLocation:{},
playerList:[], playerList:[],
actionList:[],
currentPlayList:[], currentPlayList:[],
// formatUsedTime:'', // formatUsedTime:'',
formatScore:0, formatScore:0,
@ -449,11 +454,12 @@ export default {
// this.$refs.menuScript.initLoadPage(); // this.$refs.menuScript.initLoadPage();
// } // }
}, },
selectScript({playerList, mapLocation}) { selectScript({playerList, mapLocation, actionList}) {
this.changeScriptMode(this.scriptMode); this.changeScriptMode(this.scriptMode);
this.isScriptLoad = true; this.isScriptLoad = true;
this.playerList = playerList; this.playerList = playerList;
this.mapLocation = mapLocation; this.mapLocation = mapLocation;
this.actionList = actionList;
this.userRole = 'AUDIENCE'; this.userRole = 'AUDIENCE';
this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.$store.dispatch('training/setRoles', 'AUDIENCE');
}, },
@ -466,12 +472,17 @@ export default {
finishTraining() { finishTraining() {
this.isScriptRun = false; this.isScriptRun = false;
}, },
showResultData(data) {
this.$refs.testResult.doShow({data:data, actionList:this.actionList});
},
endTraining() { endTraining() {
competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{ competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{
this.isScriptRun = false; this.isScriptRun = false;
// if (this.scriptMode == ScriptMode.TEST) { // if (this.scriptMode == ScriptMode.TEST) {
this.formatScore = res.data; // this.formatScore = res.data;
this.$messageBox('得分:' + this.formatScore); // this.
this.showResultData(res.data);
// this.$messageBox('' + this.formatScore);
// } // }
// this.userRole = 'AUDIENCE'; // this.userRole = 'AUDIENCE';
// this.$store.dispatch('training/setRoles', 'AUDIENCE'); // this.$store.dispatch('training/setRoles', 'AUDIENCE');

View File

@ -120,6 +120,7 @@ export default {
const playerList = []; const playerList = [];
EventBus.$emit('clearRunSeries'); EventBus.$emit('clearRunSeries');
EventBus.$emit('loadScene'); EventBus.$emit('loadScene');
const actionList = {};
if (res.data.memberList && res.data.memberList.length > 0) { if (res.data.memberList && res.data.memberList.length > 0) {
this.form.type = ''; this.form.type = '';
res.data.memberList.sort((a, b) => { res.data.memberList.sort((a, b) => {
@ -128,6 +129,7 @@ export default {
this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id});
const activeMemberList = []; const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{ res.data.actionList.forEach((activeMember)=>{
actionList[activeMember.id] = activeMember;
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) { if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
activeMemberList.push(activeMember.memberId); activeMemberList.push(activeMember.memberId);
} }
@ -177,14 +179,14 @@ export default {
if (res.data.mapLocation) { if (res.data.mapLocation) {
this.mapLocation = res.data.mapLocation; this.mapLocation = res.data.mapLocation;
} }
this.confirm(playerList); this.confirm(playerList, actionList);
} }
} }
}, },
confirm(playerList) { confirm(playerList, actionList) {
// this.$store.dispatch('training/setScriptOperationType', this.operationType); // this.$store.dispatch('training/setScriptOperationType', this.operationType);
// operationType:ScriptMode[this.operationType] // operationType:ScriptMode[this.operationType]
this.$emit('selectScript', {playerList:playerList, mapLocation:this.mapLocation}); this.$emit('selectScript', {playerList:playerList, mapLocation:this.mapLocation, actionList:actionList});
this.doClose(); this.doClose();
}, },
objectSpanMethod({ row, column, rowIndex, columnIndex }) { objectSpanMethod({ row, column, rowIndex, columnIndex }) {

View File

@ -0,0 +1,265 @@
<template>
<el-dialog
title="竞赛结果详情"
:visible.sync="dialogShow"
top="50px"
width="800px"
:before-do-close="doClose"
class="OSResult"
:close-on-click-modal="false"
>
<div class="operationStatisticResult">
<div class="OSTcompleted">
<span>竞赛{{ completed?'已完成':'未完成' }}</span>
<span style="margin-left:20px;">竞赛总分{{ totalScore }} </span>
<span style="margin-left:20px;">用户得分{{ userScore }} </span>
</div>
<div class="OSTitle">关键步骤信息</div>
<el-table :data="commandPublishStatisticVO" border class="OSTTable3" height="400">
<el-table-column prop="actionId" label="步骤描述" width="200">
<template slot-scope="scope">
{{ covert(scope.row.actionId) }}
</template>
</el-table-column>
<el-table-column prop="keyWords" label="关键字" width="200">
<template slot-scope="scope">
<el-tag v-for="(tag,index) in scope.row.keyWords" :key="index" class="eachTag">{{ tag }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="timeOut" label="超时时间" width="100">
<template slot-scope="scope">
{{ scope.row.timeOut?scope.row.timeOut+'s':'' }}
</template>
</el-table-column>
<el-table-column prop="score" label="步骤总分" width="100" />
<el-table-column label="用户得分" width="100">
<template slot-scope="scope">
<div v-if="scope.row.keyWords">{{ scope.row.deductScore }}</div>
<div v-else>{{ scope.row.finalPointsDeducted }}</div>
</template>
</el-table-column>
</el-table>
<div class="OSTitle">运营统计信息</div>
<el-table :data="operationStaticItemVOs" border class="OSTTable">
<el-table-column prop="description" label="数据名称" width="200" />
<el-table-column label="正确答案" width="150">
<template slot-scope="scope">
<div v-if="scope.row.type=='Time'">{{ scope.row.time }}</div>
<div v-else-if="scope.row.type=='Non_Time'">{{ scope.row.standardAnswer }}</div>
</template>
</el-table-column>
<el-table-column label="用户填写" width="150">
<template slot-scope="scope">
<div v-if="scope.row.type=='Time'">{{ scope.row.timeFilledInByUser }}</div>
<div v-else-if="scope.row.type=='Non_Time'">{{ scope.row.userAnswer }}</div>
</template>
</el-table-column>
<el-table-column prop="finalPointsDeducted" label="扣分" />
</el-table>
<div class="OSTSignInfo">运营指标信息</div>
<div class="OSTSignInfoTips">晚点列车信息</div>
<el-table :data="finalLateStatistics" border class="OSTTable1">
<el-table-column prop="groupNumber" label="车组号" width="299" />
<el-table-column prop="dt" label="晚点时间" width="300">
<template slot-scope="scope">
{{ scope.row.dt }} s
</template>
</el-table-column>
</el-table>
<div class="OSTSignInfoTips">区间停车信息</div>
<el-table :data="finalStopInSectionStatistics" border class="OSTTable2">
<el-table-column prop="groupNumber" label="车组号" width="299" />
<el-table-column prop="duration" label="停车时长" width="300">
<template slot-scope="scope">
{{ scope.row.duration }} s
</template>
</el-table-column>
</el-table>
<div v-if="completed" class="OSTSignInfoTips">
运营指标总扣分{{ finalPointsDeducted4OperationIndex }}
</div>
<div v-else class="OSTSignInfoTips">
* 因竞赛未完成运营指标不得分
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import {covertOperate} from '@/views/newMap/displayNew/scriptDisplay/component/covertOperation';
export default {
name:'TestResult',
data() {
return {
dialogShow:false,
operationStaticItemVOs:[],
finalLateStatistics:[],
finalStopInSectionStatistics:[],
commandPublishStatisticVO:[],
completed:false,
totalScore:'',
userScore:'',
actionList:[]
};
},
methods:{
doShow({data, actionList}) {
this.dialogShow = true;
this.completed = data.completed;
this.operationStaticItemVOs = data.operationStatisticVO.itemVOS;
this.finalLateStatistics = data.operationIndexStatisticVO.finalLateStatistics;
this.finalStopInSectionStatistics = data.operationIndexStatisticVO.finalStopInSectionStatistics;
this.commandPublishStatisticVO = data.commandPublishStatisticVO;
this.actionList = actionList;
this.totalScore = data.totalScore;
this.userScore = data.userScore;
},
doClose() {
this.dialogShow = false;
},
covert(actionId) {
// return actionId;
const element = this.actionList[actionId];
// this.$store.state.training.memberData[memberId]
const member = this.$store.state.training.memberData[element.memberId];
let resultData = '';
if (element.type == 'Accept_Conversation_Invitation') {
resultData = member.label + '请接受会话邀请';
} else if (element.type == 'Conversation') {
resultData = member.label + '说:' + element.content;
} else if (element.type == 'Operation') {
resultData = covertOperate(element.operationType, element.operationParamMap);
resultData = resultData.replace('请', member.label);
// this.scriptTipMessage = '' + deviceName + '' + operateName.label + '';
} else if (element.type == 'Exit_Conversation') {
resultData = member.label + '结束当前会话';
} else if (element.type == 'Start_Conversation' ) {
const inviteMember = [];
// this.$emit('allowCreatCoversition');
if (element.communicationObject) {
if (element.communicationObject == 'ALL_STATION') {
inviteMember.push('所有车站');
} else if (element.communicationObject == 'ALL_TRAIN') {
inviteMember.push('所有司机');
}
} else {
element.conversationMemberIds.forEach(id=>{
if (element.memberId != id) {
inviteMember.push((this.memberList[id] || {label: ''}).label);
}
});
}
resultData = member.label + '创建会话,选择' + inviteMember.toString();
} else if (element.type == 'Command') {
const targetName = this.memberList[element.commandInitiateVO.targetMemberId];
const CommandList = {
Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车',
Drive_Through_The_Guide_Signal:'越引导信号行驶',
Drive_Through_The_Red_Light:'越红灯行驶',
Drive_In_Urm_Mode:'URM模式驾驶',
Set_Speed_Limit:'设置限速',
Open_Or_Close_Door:'开关门',
Switch_Hook_Lock: '道岔钩锁'
};
resultData = member.label + '对【' + targetName.label + '】下达【' + CommandList[element.commandInitiateVO.commandType] + '】指令';
} else if (element.type == 'Drive') {
if (element.targetSectionCode) {
const section = this.$store.getters['map/getDeviceByCode'](element.targetSectionCode);
if (section && section.name) {
resultData = member.label + '把车开到区段' + section.name;
}
}
}
return resultData;
}
}
};
</script>
<style lang="scss" scoped>
.operationStatisticResult{
height: 500px;
overflow: auto;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.OSTTable3{
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.OSTitle{
padding: 10px 5px;
font-size: 15px;
font-weight: bold;
}
.OSTTable{
width:600px;
}
.OSTTable1,.OSTTable2{
width:600px;
}
.OSTTable3{
width:702px;
}
.OSTcompleted{
padding: 5px 5px;
font-size: 15px;
}
.OSTSignInfo{
padding: 15px 5px 10px 5px;
font-size: 15px;
font-weight: bold;
}
.OSTSignInfoTips{
padding: 10px 5px;
font-size: 15px;
}
.eachTag{
margin-left:10px;
}
</style>
<style lang="scss">
.OSResult .el-dialog__body{
padding: 10px 20px;
}
.OSTTable3 .el-table__body-wrapper.is-scrolling-none {
&::-webkit-scrollbar{
width: 4px !important;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
</style>