实训调整

This commit is contained in:
fan 2022-11-09 14:47:42 +08:00
parent 42592522bb
commit 64c58f511b
15 changed files with 385 additions and 656 deletions

View File

@ -234,10 +234,11 @@ export function startTraining(group, params) {
});
}
/** 结束实训 */
export function endTraining(group) {
export function endTraining(group, data) {
return request({
url: `/api/training2Simulation/${group}/finish`,
method: 'put'
method: 'put',
data
});
}
/** 实训完成步骤 */

View File

@ -443,9 +443,6 @@ class Jlmap {
const pictureDevice = store.getters['map/getPictureDeviceByCode'](item);
device._pictureHide = pictureDevice ? pictureDevice.pictureHide : false;
this.$painter.updatePicture(device);
if (device.code === 'X97979') {
console.log(pictureDevice, 'pictureDevice', this.mapDevice[device.code]);
}
try {
if (device._type === deviceType.Section && device.type === '03') {
this.mapDevice[device.switch.code]._pictureHide = pictureDevice ? pictureDevice.pictureHide : false;

View File

@ -1,6 +1,5 @@
import store from '@/store/index';
import { copyAssign } from '@/utils/index';
import { Notification } from 'element-ui';
function handleSockInfo(state, msg, type) {
switch (type) {
@ -27,311 +26,6 @@ function handleSimulationStateMsg(state, type) {
break;
}
}
// function handle(state, data) {
// // console.log(data, 'socket订阅');
// const msg = data.body;
// const path = window.location.href;
// const search = window.location.search;
// if (((path.includes('/display/demon') && search.includes('project=bjd')) || path.includes('/planSchedule/window')) && !state.isFirst) { state.isFirst = true; }
// switch (data.type) {
// case 'Order_Pay_Result': // 订单支付结果消息
// state.payOrder = msg;
// break;
// case 'Simulation_DeviceStatus': // 仿真-设备状态消息
// state.equipmentStatus = msg;
// break;
// case 'Simulation_User': // 仿真-进出仿真消息
// handleSimulationUserinfo(state, msg); // 用户进出仿真消息
// break;
// case 'Simulation_Script_Action_Tip': // 剧本提示消息
// handleSimulationScriptTipInfo(state, msg); // 剧本提示消息
// break;
// case 'Simulation_Script_Action_Finish':
// state.simulationScriptTipFinish++; // 剧本某一部操作完成提示
// break;
// case 'Simulation_Script_Action_Error':
// state.simulationScriptTipError++; // 剧本某一部操作执行错误
// break;
// case 'Simulation_Over': // 用户退出仿真推送消息
// state.simulationOver++; // 用户退出仿真推送消息
// break;
// case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息
// state.scriptAction = msg;
// break;
// case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息
// state.autoFaultTrigger++;
// break;
// case 'Simulation_RunFact': // 仿真-列车实际到 发车站消息
// if (!Array.isArray(msg)) {
// state.trainStationList = [msg];
// } else {
// state.trainStationList = msg;
// }
// break;
// case 'Simulation_Error': // 仿真-异常消息
// state.simulationError += 1;
// break;
// case 'Simulation_RunAsPlan_Start': // 仿真-仿真开始按计划行车消息
// state.simulationStart = msg;
// break;
// case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车
// state.simulationReset += 1;
// break;
// case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令)
// handleSimulationInfo(state, msg);
// break;
// case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新
// handleSimulationInfo(state, {id: msg.id, message: msg, messageType: 'MESSAGE'});
// break;
// case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个)
// handlePushMsgQueue(state, msg);
// break;
// case 'Simulation_Invite': // 综合演练-仿真邀请消息
// state.simulationInvite = msg;
// break;
// case 'Be_Logged_Out': // 重复登录被登出
// state.beLogoutCount++;
// state.loggedOutMsg = msg;
// break;
// case 'Simulation_Run_Plan_Reload': // 运行图变更
// state.runPlanReloadCount++;
// break;
// case 'Simulation_Control_Pause': // 暂停中
// store.dispatch('scriptRecord/updateSimulationPause', msg);
// break;
// case 'BROADCAST': // 升级通知消息
// Notification.warning({
// title: msg.title,
// center: true,
// message: msg.message,
// position: 'bottom-right',
// showClose: msg.showClose,
// duration: 0
// });
// break;
// case 'Simulation_Member':
// state.memberChangeCount++;
// break;
// case 'Simulation_Time_Sync':
// state.simulationTimeSync = msg;
// break;
// case 'Simulation_IbpStatus':
// state.simulationIbpStatus = msg;
// break;
// case 'Simulation_Competition_Practice_Finish':
// state.competitionPracticeFinish++;
// break;
// case 'Simulation_Alarm':
// state.simulationAlarmInfo = msg;
// break;
// case 'STATION_PFI_NUM':
// state.stationPfiNum = msg;
// break;
// case 'STAND_PFI':
// state.standPfiNum = msg;
// break;
// case 'TRAIN_PFI_NUM':
// state.trainPfiNum = msg;
// break;
// case 'TRAIN_PFI_BL':
// state.trainPfiBL = msg;
// break;
// case 'LPF_STRATEGY_RECOMMEND':
// state.LPFstrategy = msg;
// break;
// case 'Simulation_Scenes_Reload':
// if (msg) {
// store.dispatch('training/start');
// } else {
// store.dispatch('training/over');
// }
// state.trainingReloadCount++;
// break;
// case 'Simulation_PslStatus':
// state.simulationPslStatus = msg;
// break;
// // 运行图加线/抽线/变化推送消息
// case 'Simulation_Trip_Plan_Change':
// state.simulationPlanChange = msg;
// break;
// // 占线板信息
// case 'Simulation_RailCtcStatus':
// state.railCtcStatusMsg = msg;
// break;
// // 大铁项目 ctc 运行图初始化信息
// // case 'SIMULATION_CTC_RUN_PLAN_INIT':
// // msg.forEach(element => {
// // const tripNumberDe = element.departRunPlan && element.departRunPlan.tripNumber;
// // const tripNumberAr = element.arriveRunPlan && element.arriveRunPlan.tripNumber;
// // if (tripNumberDe) { parseInt(tripNumberDe[tripNumberDe.length - 1]) % 2 == 0 ? element.departRunPlan.up = tripNumberDe : element.departRunPlan.down = tripNumberDe; }
// // if (tripNumberAr) { parseInt(tripNumberAr[tripNumberAr.length - 1]) % 2 == 0 ? element.arriveRunPlan.up = tripNumberAr : element.arriveRunPlan.down = tripNumberAr; }
// // const code = element.stationCode + '' + element.code;
// // state.railCtcRunplanInitMsg[code] = element;
// // });
// // break;
// // 大铁项目 ctc 运行图改变信息
// case 'SIMULATION_CTC_RUN_PLAN_CHANGE':
// state.voiceBroadcastMsgs = [];
// msg.forEach(element => {
// const tripNumberDe = element.departRunPlan && element.departRunPlan.tripNumber;
// const tripNumberAr = element.arriveRunPlan && element.arriveRunPlan.tripNumber;
// if (tripNumberDe) {
// element.departRunPlan.up = '';
// element.departRunPlan.down = '';
// parseInt(tripNumberDe[tripNumberDe.length - 1]) % 2 == 0 ? element.departRunPlan.up = tripNumberDe : element.departRunPlan.down = tripNumberDe;
// }
// if (tripNumberAr) {
// element.arriveRunPlan.up = '';
// element.arriveRunPlan.down = '';
// parseInt(tripNumberAr[tripNumberAr.length - 1]) % 2 == 0 ? element.arriveRunPlan.up = tripNumberAr : element.arriveRunPlan.down = tripNumberAr;
// }
// const code = element.stationCode + '' + element.code;
// if (store.state.training.roleDeviceCode === element.stationCode && element.arriveRunPlan && element.arriveRunPlan.adjacentMessage === '1') {
// state.voiceBroadcastMsgs.push(element.stationCode + '' + element.code);
// }
// state.railCtcRunplanInitMsg[code] = copyAssign(state.railCtcRunplanInitMsg[code] || {}, element);
// });
// if (state.voiceBroadcastMsgs.length) {
// state.voiceBroadcastChange++;
// }
// state.railCtcRunplanChange++;
// break;
// // 大铁项目 ctc 调度发布行车计划 给车站下发消息
// case 'SIMULATION_RAILWAY_RUN_PLAN_SEND':
// msg.forEach(each=>{
// state.railwaySimulationRunplanSendMap[each.stationCode] = each;
// });
// state.railwaySimulationRunplanSendChange++;
// break;
// // 大铁项目 ctc 车务管理端 初始化消息
// case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT':
// state.railCtcStationManageRpMsg = {};
// msg.forEach(element => {
// const code = element.stationCode + '' + element.tripNumber;
// state.railCtcStationManageRpMsg[code] = element;
// });
// // state.railCtcStationManageRpChange++;
// break;
// // 大铁项目 ctc 车务管理端 修改/增加消息
// case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE':
// msg.forEach(element => {
// const code = element.stationCode + '' + element.tripNumber;
// state.railCtcStationManageRpMsg[code] = copyAssign(state.railCtcStationManageRpMsg[code] || {}, element);
// });
// state.railCtcStationManageRpChange++;
// break;
// // 大铁项目 ctc 车务管理端 移除消息
// case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE':
// msg.forEach(element => {
// const code = element.stationCode + '' + element.tripNumber;
// delete state.railCtcStationManageRpMsg[code];
// });
// state.railCtcStationManageRpChange++;
// break;
// // 调度命令信息
// case 'SIMULATION_RAIL_CTC_DIS_COMMAND_ADD':
// state.dispatchCommandMsg = msg;
// break;
// // 调度命令状态
// case 'SIMULATION_RAIL_CTC_DIS_COMMAND_SYNC':
// state.dispatchCommandState = msg;
// console.log('调度命令状态', msg);
// break;
// // 车站发送计划信息
// case 'SIMULATION_CTC_RUN_PLAN_CONFIRM_SEND':
// state.changedCtcRunplanMap = msg;
// break;
// case 'SIMULATION_RAIL_TICKET':
// state.ticketInfo = msg;
// break;
// // // 实训提示消息
// // case 'Simulation_Training_Step_Tip':
// // state.trainingStepTip = msg;
// // break;
// case 'Simulation_Training_Finish':
// state.trainingOverCount++;
// break;
// case 'YJDDZH_TRAIN_POSITION':
// state.whTrainInfo = msg;
// break;
// case 'Simulation_Training_Step_Finish':
// state.trainingStepFinishCount++;
// break;
// case 'SIMULATION_WORK_PARAM':
// state.simulationWorkParam = msg;
// break;
// //
// // // 大铁项目 调度台 运行图信息 初始化消息
// // case 'SIMULATION_RAILWAY_RUN_PLAN_INIT':
// // state.railwaySimulationRpMsg = {};
// // msg.forEach(element => {
// // const code = element.stationCode + '' + element.runPlanCode;
// // state.railwaySimulationRpMsg[code] = element;
// // });
// // break;
// // // 大铁项目 调度台 运行图信息 修改/增加消息
// // case 'SIMULATION_RAILWAY_RUN_PLAN_CHANGE':
// // msg.forEach(element => {
// // const code = element.stationCode + '' + element.runPlanCode;
// // state.railwaySimulationRpMsg[code] = copyAssign(state.railwaySimulationRpMsg[code] || {}, element);
// // });
// // state.railwaySimulationRpChange++;
// // break;
// // // 大铁项目 调度台 运行图信息 移除消息
// // case 'SIMULATION_RAILWAY_RUN_PLAN_REMOVE':
// // msg.forEach(element => {
// // const code = element.stationCode + '' + element.runPlanCode;
// // delete state.railwaySimulationRpMsg[code];
// // });
// // state.railwaySimulationRpChange++;
// // break;
// }
// }
// 仿真内部聊天
function handleSimulationInfo(state, data) {
switch (data.messageType) {
case 'INVITE':
state.inviteSimulationConversation = data;
break;
case 'CONNECT':
state.acceptConversionInvite = data;
break;
case 'OVER':
state.overConversation = data;
break;
case 'MESSAGE':
state.conversationInfo = data;
break;
case 'CREATE':
state.createConversation = data;
break;
case 'EXIT':
state.exitConversation = data;
break;
}
}
// 剧本提示
function handleSimulationScriptTipInfo(state, data) {
state.simulationScriptTip = data;
}
function handleSimulationUserinfo(state, data) {
state.simulationRoleList = (data instanceof Array) ? data : [data];
}
// (旧版可能在用,新版地图不用这个)
function handlePushMsgQueue(state, msg) {
if (msg instanceof Array) {
state.msgQueue.concat(msg);
} else {
state.msgQueue.push(msg);
}
if (!state.msgHead) {
state.msgHead = state.msgQueue[0];
}
}
const socket = {
namespaced: true,
@ -407,7 +101,6 @@ const socket = {
railwaySimulationRunplanSendChange:0, // 大铁项目 调度台 发布 行车计划变化
voiceBroadcastMsgs: [], // 语音播报信息
voiceBroadcastChange: 0, // 语音播报信息变化
trainingStepTip: '', // 新实训推送消息
trainingOverCount: 0, // 新实训结束计数器
trainingReloadCount: 0,
whTrainInfo: null,
@ -535,9 +228,6 @@ const socket = {
state.railCtcRunplanInitMsg[code] = element;
});
},
clearTrainingStepTip: (state) => {
state.trainingStepTip = '';
},
clearTrainingOverCount: (state) => {
state.trainingOverCount = 0;
},
@ -691,9 +381,6 @@ const socket = {
setTicketInfo: (state, data) => {
state.ticketInfo = data;
},
setTrainingStepTip: (state, data) => {
state.trainingStepTip = data;
},
trainingOverCountIncrease: (state) => {
state.trainingOverCount++;
},
@ -801,9 +488,6 @@ const socket = {
initRailCtcRunplanInitMsg:({ commit }, list) => {
commit('initRailCtcRunplanInitMsg', list);
},
clearTrainingStepTip: ({ commit }) => {
commit('clearTrainingStepTip');
},
clearTrainingOverCount: ({ commit }) => {
commit('clearTrainingOverCount');
},
@ -924,9 +608,6 @@ const socket = {
setTicketInfo: ({ commit }, data) => {
commit('setTicketInfo', data);
},
setTrainingStepTip: ({ commit }, data) => {
commit('setTrainingStepTip', data);
},
trainingOverCountIncrease: ({ commit }) => {
commit('trainingOverCountIncrease');
},

View File

@ -14,9 +14,8 @@ const training = {
sceneOperate: null,
stepOrder: 0,
operateOrder: 0,
// stepOverCount: 0,
trainingScore: '',
operateErrMsg: ''
operateErrMsg: '',
trainingStepTip: ''
},
getters: {
teachMode: (state) => {
@ -34,9 +33,6 @@ const training = {
stepOrder: (state) => {
return state.stepOrder;
},
trainingScore: (state) => {
return state.trainingScore;
},
sceneOperate: (state) => {
return state.sceneOperate;
}
@ -80,14 +76,17 @@ const training = {
clearStepOverCount: (state) => {
state.clearStepOverCount = 0;
},
setTrainingScore: (state, score) => {
state.trainingScore = score;
},
setSceneOperate: (state, sceneOperate) => {
state.sceneOperate = sceneOperate;
},
setOperateErrMsg: (state, msg) => {
state.operateErrMsg = msg;
},
clearTrainingStepTip: (state) => {
state.trainingStepTip = '';
},
setTrainingStepTip: (state, data) => {
state.trainingStepTip = data;
}
},
actions: {
@ -126,9 +125,6 @@ const training = {
clearStepOverCount: ({commit}) => {
commit('clearStepOverCount');
},
setTrainingScore: ({commit}, score) => {
commit('setTrainingScore', score);
},
setSceneOperate: ({commit}, sceneOperate) => {
commit('setSceneOperate', sceneOperate);
},
@ -160,6 +156,12 @@ const training = {
}
return result;
}
},
clearTrainingStepTip: ({ commit }) => {
commit('clearTrainingStepTip');
},
setTrainingStepTip: ({ commit }, data) => {
commit('setTrainingStepTip', data);
}
}
};

View File

@ -174,10 +174,6 @@ function handle(data) {
case 'SIMULATION_RAIL_TICKET':
store.dispatch('socket/setTicketInfo', msg);
break;
// // 实训提示消息
// case 'Simulation_Training_Step_Tip':
// store.dispatch('socket/setTrainingStepTip', msg);
// break;
case 'Simulation_Training_Finish':
store.dispatch('socket/trainingOverCountIncrease');
break;

View File

@ -146,7 +146,7 @@ export default {
handlerEnd() {
endTraining(this.group).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/clearOperateOrder');
this.$store.dispatch('trainingNew/setTrainingScore', resp.data);

View File

@ -38,7 +38,7 @@ export default {
}
},
watch: {
'$store.state.socket.trainingStepTip': function(val) {
'$store.state.trainingNew.trainingStepTip': function(val) {
if (val && this.trainingDetail.type === 'SINGLE') {
const member = this.$store.state.training.memberData[val.memberId];
this.$nextTick(function() {
@ -74,7 +74,7 @@ export default {
if (steps && steps.length) {
const step = steps[stepOrder - 1];
const distance = 5;
this.tip = this.$store.state.socket.trainingStepTip.content;
this.tip = this.$store.state.trainingNew.trainingStepTip.content;
if (step && step.tipPosition && step.tipPosition.deviceCode) {
const position = this.getShapeTipPoint(step.tipPosition);
if (position) {

View File

@ -144,7 +144,7 @@ export default {
handlerEnd() {
endTraining(this.group).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/setTrainingScore', resp.data);
}).catch(() => {

View File

@ -21,7 +21,7 @@ export default {
}
},
watch: {
'$store.state.socket.trainingStepTip': function(val) {
'$store.state.trainingNew.trainingStepTip': function(val) {
if (val && this.trainingDetail.type === 'SCENE') {
const member = this.$store.state.training.memberData[val.memberId];
this.$nextTick(function() {

View File

@ -57,6 +57,7 @@
<training-menu v-if="hasTraining" ref="trainingMenu" :offset-bottom="offsetBottom" />
<TrainingDesign v-if="trainingDesignShow" ref="trainingDesign" />
<voice-chat-box v-if="hasVoice" :group="group" />
<design-training-menu v-if="trainingDesign && trainingDetail" ref="trainingMenu" :offset-bottom="offsetBottom" />
</div>
</template>
<script>
@ -78,7 +79,6 @@ import RegisterBook from '../registerBook/index';
import TrainTicket from '../trainTicket/index';
import DrawSelect from '@/jmapNew/theme/datie_01/menus/dialog/drawSelect';
import LineBoard from '../displayCity/lineBoard';
// TrainingMode
import { ScriptMode } from '@/scripts/ConstDic';
import TheoryExamSelect from './theoryExamSelect';
import TheoryExam from './theoryExam';
@ -94,16 +94,13 @@ import TrainingPositionTip from './trainingList/trainingPositionTip.vue';
import TrainingMenu from './trainingList/trainingMenu';
import TrainingDesign from '@/views/trainingManage/index.vue';
import VoiceChatBox from './voiceChatBox/index';
import DesignTrainingMenu from './trainingList/designTrainingMenu';
export default {
name: 'SimulationMenu',
components: {
// ChatBox,
// voiceChatBox,
// QrCode,
SetTime,
ModifyTime,
// DistributeDraft,
FlowData,
RegisterBook,
TrainTicket,
@ -115,7 +112,6 @@ export default {
Scheduling,
SchedulingView,
RunPlanView,
// Equipment,
SelectExam,
ExamPanel,
ContectUs,
@ -125,8 +121,8 @@ export default {
TrainingPositionTip,
TrainingMenu,
TrainingDesign,
VoiceChatBox
// StatusIcon
VoiceChatBox,
DesignTrainingMenu
},
props: {
mode: {
@ -447,7 +443,8 @@ export default {
RAIL_CTC: '10'
},
hasVoice: false,
hasTraining: false
hasTraining: false,
trainingDesign: false
};
},
computed: {
@ -502,7 +499,6 @@ export default {
'$store.state.map.mapDataLoadedCount': function (val) { //
if (this.trainingId) {
getPublishTrainingDetail(this.trainingId).then(detailResp=>{
// this.training = res.data;
if (detailResp.data.mapLocationJson) {
const mapLocation = JSON.parse(detailResp.data.mapLocationJson);
this.$jlmap.updateTransform(parseInt(mapLocation.scale), {x:mapLocation.x, y:mapLocation.y});
@ -538,6 +534,7 @@ export default {
});
this.hasVoice = val.hasVoice;
this.hasTraining = val.hasTraining;
this.trainingDesign = val.trainingDesign;
this.menuList = [...this.allMenuList];
}
},

View File

@ -0,0 +1,326 @@
<template>
<!-- v-drag 拖拽 调整宽高 -->
<div v-quickMenuDrag class="reminder-drag" :style="{bottom: offsetBottom + 'px'}">
<div ref="drapBox" class="reminder-box">
<div class="tip-title">
<div>
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
<i v-show="!isShrink && !trainingSwitch && trainingDetail" class="icon el-icon-video-play" @click="handlerStart" />
<i v-show="!isShrink && trainingSwitch" class="icon el-icon-switch-button" @click="handlerEnd" />
</div>
<p style="color: #fff;">
<span>{{ trainingDetail.name }}</span>
</p>
</div>
<div v-if="isShrink" class="reminder-box-content">
<div class="zhezhao" />
<div ref="dragBody" class="tip-body-box">
<div class="tip-body">
<el-scrollbar wrap-class="scrollbar-wrapper">
<p class="list-item">
<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">
<el-radio-group v-model="demoMode" :disabled="trainingSwitch" class="mode" size="small" @change="changeMode">
<el-radio :label="TrainingMode.TEACH" border>{{ $t('display.lesson.teachingMode') }}</el-radio>
<el-radio :label="TrainingMode.PRACTICE" border>{{ $t('display.lesson.practiceMode') }}</el-radio>
<el-radio :label="TrainingMode.TEST" border>{{ $t('display.lesson.testMode') }}</el-radio>
</el-radio-group>
</span>
</p>
<p class="list-item">
<span class="list-label" style="vertical-align: top;"> {{ $t('display.training.trainingInstructions') }}</span>
<span class="list-elem elem-span">{{ trainingDetail.description }}</span>
</p>
<p class="list-item">
<span class="list-label">操作按钮</span>
<span class="list-elem">
<el-button v-if="!trainingSwitch && trainingDetail" size="small" type="success" @click="handlerStart">开始</el-button>
<el-button v-if="trainingSwitch" size="small" type="danger" @click="handlerEnd">结束</el-button>
</span>
</p>
</el-scrollbar>
</div>
<div class="drag-right" />
<div class="drag-left" />
<div class="drag-bottom" />
<div class="drag-top" />
</div>
</div>
</div>
<scene-play-role ref="scenePlayRole" @startTraining="startTraining" />
</div>
</template>
<script>
import { ScriptMode } from '@/scripts/ConstDic';
import { clearSimulation } from '@/api/simulation';
import { startTraining, endTraining } from '@/api/jmap/training';
import ScenePlayRole from './scenePlayRole';
export default {
name: 'TipTrainingDetail',
components: {
ScenePlayRole
},
props: {
offsetBottom: {
type: Number,
required: true
}
},
data() {
return {
isShrink: true,
showSumbit: false,
demoMode: ScriptMode.TEACH,
TrainingMode: ScriptMode,
scoreList: [],
trainingScore: 0
};
},
computed: {
trainingSwitch() {
return this.$store.state.trainingNew.trainingSwitch;
},
trainingDetail() {
return this.$store.state.trainingNew.trainingDetail;
},
group() {
return this.$route.query.group;
},
teachMode() {
return this.$store.state.trainingNew.teachMode;
}
},
watch: {
'$store.state.trainingNew.stepOrder': function(val) {
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
const scoringRule = JSON.parse(this.$store.state.trainingNew.trainingDetail.scoringRuleJson);
const rule = scoringRule.find(rule => rule.memberId == this.playerId);
if (rule[val - 1]) {
this.scoreList.push(rule[val - 1]);
this.scoreList.reduce((previousValue, currentValue) => previousValue + currentValue, this.trainingScore);
}
if (val >= 1 && val < stepList.length) {
const msg = {content:stepList[val].description, memberId:stepList[val].memberId};
this.$store.dispatch('trainingNew/setTrainingStepTip', msg);
} else {
this.$store.dispatch('trainingNew/setTrainingStepTip', null);
val && this.$store.dispatch('socket/trainingOverCountIncrease');
}
}
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.showSumbit = false;
},
shrink() {
if (this.isShrink) {
this.isShrink = false;
} else {
this.isShrink = true;
this.$nextTick(()=>{
const dragDom = document.querySelector('.reminder-drag').style.bottom;
if (document.body.clientHeight - 300 - parseInt(dragDom.replace('px', '')) < 0) {
document.querySelector('.reminder-drag').style.bottom = `${document.body.clientHeight - 300}px`;
}
});
}
},
changeMode(val) {
this.demoMode = val;
this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode);
},
handlerStart() {
if (this.trainingDetail.type === 'SCENE') {
this.$refs.scenePlayRole.doShow();
} else {
this.startTraining();
}
},
startTraining() {
this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode);
startTraining(this.group, {mode: this.demoMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
this.playerId = stepList[0].memberId;
const msg = {content:stepList[0].description, memberId:stepList[0].memberId};
this.$store.dispatch('trainingNew/setTrainingStepTip', msg);
}).catch(() => {
this.$message.error('开始实训失败!');
});
},
handlerEnd() {
endTraining(this.group).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('trainingNew/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/clearOperateOrder');
}).catch(() => {
this.$message.error('结束实训失败!');
});
},
back() {
if (this.group) {
clearSimulation(this.group);
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.tip-body-box {
height: 260px;
position: absolute;
left: 0;
top: 0;
width: 100%;
}
.reminder-drag{
position: absolute;
bottom: 0px;
left: 15px;
z-index: 10;
}
.elem-span{
display:inline-block;width:77%;line-height:26px;margin-top:-4px;
}
.zhezhao{
width: 100%;
height: 100%;
filter: blur(8px);
background: rgba(255,255,255,0.9);
position:absolute;
}
.reminder-box-content{
width: 500px;
height: 260px;
left: 0;
top: 0;
z-index: 2;
background: rgba(255,255,255,0.8);
position: relative;
}
.reminder-box {
border-radius: 5px;
overflow: hidden;
z-index: 10;
font-size: 18px;
.tip-title {
width: 500px;
overflow: hidden;
height: 40px;
display: flex;
align-items: center;
flex-direction: row-reverse;
background-color: rgba(64, 158, 255,1);
border-radius: 5px 5px 0 0;
justify-content: space-between;
padding: 0 10px;
}
.drag-right,
.drag-left {
width: 10px;
cursor: e-resize;
background-color: yellow;
height: 100%;
position: absolute;
right: 0;
top: 0;
opacity: 0;
}
.drag-left {
left: 0;
}
.drag-bottom {
position: absolute;
bottom: 0;
width: 100%;
height: 10px;
cursor: s-resize;
background-color: yellow;
opacity: 0;
}
.drag-top {
position: absolute;
top: -45px;
left: 0;
width: 100%;
height: 10px;
cursor: s-resize;
background-color: yellow;
opacity: 0;
}
.tip-body {
height: 260px;
padding: 10px;
.list-label {
width: 105px;
}
}
.tip-foot {
width: 100%;
position: absolute;
right: 0px;
bottom: 0px;
background-color: #fff;
padding: 10px 0 10px 10px;
.foot-detail {
height: 100%;
float: right;
margin-top: 9px;
padding-right: 15px;
}
.foot-submit {
float: right;
margin-top: 9px;
padding-right: 15px;
}
}
.icon {
float: right;
margin-right: 10px;
cursor: pointer;
background-color: #f3f3f3;
border-radius: 50%;
}
/deep/ {
.el-tree-node__content {
margin-bottom: 4px;
}
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
background-color: #d6e5f7;
}
}
}
</style>

View File

@ -1,235 +0,0 @@
<template>
<el-dialog v-dialogDrag title="实训" :visible.sync="dialogVisible" width="1000px" :before-close="doClose" center>
<div>
<el-card class="box-card">
<div style="margin-bottom: 10px;font-size: 16px;">{{ `当前实训名称:${training.name || ''}` }}</div>
<div style="font-size: 16px;">{{ `当前实训描述:${training.description || ''}` }}</div>
</el-card>
<el-tabs v-model="activeName">
<el-tab-pane label="单操实训" name="first">
<QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-tab-pane>
<el-tab-pane label="场景实训" name="second">
<QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryListScene" />
</el-tab-pane>
</el-tabs>
</div>
</el-dialog>
</template>
<script>
import { getPublishSingleList, getPublishTrainingDetail, loadPublishTraining, getPublishScenesList } from '@/api/jmap/training';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
export default {
name: 'TrainingList',
components:{
},
props: {},
data() {
return {
dialogVisible: false,
activeName: 'first',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
training: {},
queryForm: {
labelWidth: '100px',
reset: true,
show:false
},
prdTypeMap: {
DISPATCHER: '02',
STATION_SUPERVISOR: '01',
STATION_ASSISTANT: '01',
DEPOT_DISPATCHER: '09',
DRIVER: '04',
RAIL_CTC: '10'
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
height: 500,
columns: [
{
title: this.$t('trainingManage.name'),
prop: 'name'
},
{
title: this.$t('trainingManage.description'),
prop: 'description'
},
{
title: this.$t('trainingManage.type'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('trainingManage.labelJson'),
prop: 'labelJson'
},
{
type: 'button',
title: this.$t('trainingManage.operate'),
width: '150',
buttons: [
{
name: '加载',
handleClick: this.loadScript,
type: 'primary',
showControl:(row) => { return row.id; }
}
]
}
]
},
queryListScene: {
query: this.queryFunctionScene,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
height: 500,
columns: [
{
title: this.$t('trainingManage.name'),
prop: 'name'
},
{
title: this.$t('trainingManage.description'),
prop: 'description'
},
{
title: this.$t('trainingManage.type'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('trainingManage.labelJson'),
prop: 'labelJson'
},
{
type: 'button',
title: this.$t('trainingManage.operate'),
width: '150',
buttons: [
{
name: '加载',
handleClick: this.loadScript,
type: 'primary',
showControl:(row) => { return row.id; }
}
]
}
]
}
};
},
computed: {
group() {
return this.$route.query.group;
},
mapId() {
return this.$route.query.mapId;
},
teachMode() {
return this.$store.state.trainingNew.teachMode;
},
trainingSwitch() {
return this.$store.state.trainingNew.trainingSwitch;
}
},
methods: {
queryFunction() {
return getPublishSingleList(this.mapId);
},
queryFunctionScene() {
return getPublishScenesList(this.mapId);
},
doShow() {
this.getListData();
this.dialogVisible = true;
},
doClose() {
this.dialogVisible = false;
},
async loadScript(index, data) {
if (this.trainingSwitch) {
this.$message.error('请先结束当前实训后再加载新的实训!');
return;
}
try {
const detailResp = await getPublishTrainingDetail(data.id);
this.training = detailResp.data;
if (detailResp.data.mapLocationJson) {
const mapLocation = JSON.parse(detailResp.data.mapLocationJson);
this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y});
}
if (detailResp.data.playerIdJson) {
const playerId = JSON.parse(detailResp.data.playerIdJson)[0];
if (playerId) {
const member = this.$store.state.training.memberData[playerId];
this.$store.dispatch('training/setPrdType', this.prdTypeMap[member.type]);
this.$store.dispatch('training/setRoles', member.type);
}
}
this.$store.dispatch('trainingNew/setTrainingDetail', detailResp.data);
this.$store.dispatch('trainingNew/setTrainingScore', '');
await loadPublishTraining(this.group, data.id, {mode: this.teachMode});
this.$message.success('加载实训成功!');
} catch (e) {
this.$message.error('加载实训失败!');
}
},
covertData(row) {
const releaseReview = ConstConfig.ConstSelect.trainingType;
const lastData = Object.assign({}, row);
if (Cookies.get('user_lang') == 'en') {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.type == rolename) {
lastData.type = element.enlabel;
}
});
} else {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.type == rolename) {
lastData.type = element.label;
}
});
}
return lastData.type;
},
getListData() {
this.$refs.queryListPage && this.$refs.queryListPage.commitQuery();
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{
padding: 10px 25px 10px 25px;
}
.box-card{
padding: 10px;
font-size: 14px;
}
.trainingHeader {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 5px;
.flexNull {
flex: 1;
}
}
</style>

View File

@ -78,8 +78,6 @@ import { clearSimulation } from '@/api/simulation';
import { startTraining, endTraining } from '@/api/jmap/training';
import ScenePlayRole from './scenePlayRole';
import { getPublishSingleList, getPublishTrainingDetail, loadPublishTraining, getPublishScenesList } from '@/api/jmap/training';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
export default {
name: 'TipTrainingDetail',
components: {
@ -99,6 +97,7 @@ export default {
TrainingMode: ScriptMode,
activeName: 'first',
showMenu: false,
scoreList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -109,14 +108,6 @@ export default {
reset: true,
show:false
},
prdTypeMap: {
DISPATCHER: '02',
STATION_SUPERVISOR: '01',
STATION_ASSISTANT: '01',
DEPOT_DISPATCHER: '09',
DRIVER: '04',
RAIL_CTC: '10'
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
@ -132,13 +123,6 @@ export default {
title: this.$t('trainingManage.description'),
prop: 'description'
},
{
title: this.$t('trainingManage.type'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('trainingManage.labelJson'),
prop: 'labelJson'
@ -172,13 +156,6 @@ export default {
title: this.$t('trainingManage.description'),
prop: 'description'
},
{
title: this.$t('trainingManage.type'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('trainingManage.labelJson'),
prop: 'labelJson'
@ -196,16 +173,15 @@ export default {
]
}
]
}
},
playerId: '',
trainingScore: 0
};
},
computed: {
trainingSwitch() {
return this.$store.state.trainingNew.trainingSwitch;
},
trainingScore() {
return this.$store.state.trainingNew.trainingScore;
},
trainingDetail() {
return this.$store.state.trainingNew.trainingDetail;
},
@ -222,14 +198,21 @@ export default {
watch: {
'$store.state.trainingNew.stepOrder': function(val) {
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
const scoringRule = JSON.parse(this.$store.state.trainingNew.trainingDetail.scoringRuleJson);
const rule = scoringRule.find(rule => rule.memberId == this.playerId);
if (rule.details && stepList[val - 1]) {
const scoreRule = rule.details.find(item => item.elementId == stepList[val - 1].id );
this.scoreList.push(scoreRule);
this.trainingScore += scoreRule.score;
console.log(this.scoreList, this.trainingScore, rule, scoreRule, stepList[val - 1].id, scoreRule.score, scoreRule.elementId);
}
if (val >= 1 && val < stepList.length) {
const msg = {content:stepList[val].description, memberId:stepList[val].memberId};
this.$store.dispatch('socket/setTrainingStepTip', msg);
this.$store.dispatch('trainingNew/setTrainingStepTip', msg);
} else {
this.$store.dispatch('socket/setTrainingStepTip', null);
this.$store.dispatch('trainingNew/setTrainingStepTip', null);
val && this.$store.dispatch('socket/trainingOverCountIncrease');
}
// operateOrder;
}
},
mounted() {
@ -270,21 +253,21 @@ export default {
this.$store.dispatch('trainingNew/changeTeachMode', this.demoMode);
startTraining(this.group, {mode: this.demoMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
this.$store.dispatch('trainingNew/setTrainingScore', '');
const stepList = JSON.parse(this.$store.state.trainingNew.trainingDetail.stepJson);
const msg = {content:stepList[0].description, memberId:stepList[0].memberId};
this.$store.dispatch('socket/setTrainingStepTip', msg);
this.$store.dispatch('trainingNew/setTrainingStepTip', msg);
}).catch(() => {
this.$message.error('开始实训失败!');
});
},
handlerEnd() {
endTraining(this.group).then((resp) => {
endTraining(this.group, { scoreList: this.scoreList }).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/clearOperateOrder');
this.$store.dispatch('trainingNew/setTrainingScore', resp.data);
this.scoreList = [];
this.trainingScore = 0;
}).catch(() => {
this.$message.error('结束实训失败!');
});
@ -312,41 +295,22 @@ export default {
const mapLocation = JSON.parse(detailResp.data.mapLocationJson);
this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y});
}
this.playerId = '';
if (detailResp.data.playerIdJson) {
const playerId = JSON.parse(detailResp.data.playerIdJson)[0];
if (playerId) {
const member = this.$store.state.training.memberData[playerId];
this.$store.dispatch('training/setPrdType', this.prdTypeMap[member.type]);
this.$store.dispatch('training/setRoles', member.type);
}
this.playerId = JSON.parse(detailResp.data.playerIdJson)[0];
// if (playerId) {
// const member = this.$store.state.training.memberData[playerId];
// this.$store.dispatch('training/setPrdType', this.prdTypeMap[member.type]);
// this.$store.dispatch('training/setRoles', member.type);
// }
}
this.showMenu = true;
this.$store.dispatch('trainingNew/setTrainingDetail', detailResp.data);
this.$store.dispatch('trainingNew/setTrainingScore', '');
await loadPublishTraining(this.group, data.id, {mode: this.teachMode});
this.$message.success('加载实训成功!');
} catch (e) {
this.$message.error('加载实训失败!');
}
},
covertData(row) {
const releaseReview = ConstConfig.ConstSelect.trainingType;
const lastData = Object.assign({}, row);
if (Cookies.get('user_lang') == 'en') {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.type == rolename) {
lastData.type = element.enlabel;
}
});
} else {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.type == rolename) {
lastData.type = element.label;
}
});
}
return lastData.type;
}
}
};

View File

@ -38,7 +38,7 @@ export default {
}
},
watch: {
'$store.state.socket.trainingStepTip': function(val) {
'$store.state.trainingNew.trainingStepTip': function(val) {
if (val && this.trainingDetail.type === 'SINGLE') {
const member = this.$store.state.training.memberData[val.memberId];
this.$nextTick(function() {
@ -83,7 +83,7 @@ export default {
if (steps && steps.length) {
const step = steps[stepOrder];
const distance = 5;
this.tip = this.$store.state.socket.trainingStepTip ? this.$store.state.socket.trainingStepTip.content : '';
this.tip = this.$store.state.trainingNew.trainingStepTip ? this.$store.state.trainingNew.trainingStepTip.content : '';
if (step && step.tipPosition && step.tipPosition.deviceCode) {
const position = this.getShapeTipPoint(step.tipPosition);
if (position) {

View File

@ -21,7 +21,7 @@ export default {
}
},
watch: {
'$store.state.socket.trainingStepTip': function(val) {
'$store.state.trainingNew.trainingStepTip': function(val) {
if (val && this.trainingDetail.type === 'SCENE') {
const member = this.$store.state.training.memberData[val.memberId];
this.$nextTick(function() {