Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
7388fc707f
@ -247,3 +247,10 @@ export function endTrainingStep(group, stepId) {
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
/** 编制剧本的时候加载背景 */
|
||||
export function loadTrainingBg(group, trainingId) {
|
||||
return request({
|
||||
url: `/api/training2Simulation/${group}/draw/${trainingId}`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
@ -40,9 +40,10 @@ export function getTrainingStepList(trainingId) {
|
||||
});
|
||||
}
|
||||
/** 修改实训所有步骤 */
|
||||
export function updateTrainingStep(id, data) {
|
||||
export function updateTrainingStep(group, trainingId, data) {
|
||||
console.log(group, trainingId, '*******');
|
||||
return request({
|
||||
url: `/api/v2/draft/training/${id}/step/update`,
|
||||
url: `/api/v2/draft/training/${group}/${trainingId}/step/update`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
|
@ -43,7 +43,6 @@ class Options {
|
||||
}
|
||||
|
||||
update(payload) {
|
||||
console.log(payload, '*****---------');
|
||||
if (Number.isFinite(payload.dx)) {
|
||||
this.offsetX -= payload.dx;
|
||||
}
|
||||
|
@ -383,7 +383,8 @@ export default {
|
||||
// S引导总锁按钮点击
|
||||
guideLockLeftButtonDown() {
|
||||
const operate = {
|
||||
operation: this.Station.stationMasterLock.leftButton.operation
|
||||
operation: this.Station.stationMasterLock.leftButton.operation,
|
||||
userOperationType: 'rightClick'
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
@ -399,7 +400,8 @@ export default {
|
||||
// X引导总锁按钮点击
|
||||
guideLockRightButtonDown() {
|
||||
const operate = {
|
||||
operation: this.Station.stationMasterLock.rightButton.operation
|
||||
operation: this.Station.stationMasterLock.rightButton.operation,
|
||||
userOperationType: 'rightClick'
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
@ -416,7 +418,8 @@ export default {
|
||||
this.clearOperate();
|
||||
if (operation != this.Command.cancel.clearMbm.operation) {
|
||||
const operate = {
|
||||
operation: operation
|
||||
operation: operation,
|
||||
userOperationType: 'leftClick'
|
||||
};
|
||||
// 以下 会弹出密码框 (总人解,区故解) 铅封按钮
|
||||
const operationList = [this.Signal.humanTrainRoute.button.operation, this.Section.fault.button.operation, this.Section.defectiveShunting.button.operation,
|
||||
@ -478,7 +481,8 @@ export default {
|
||||
// 排列进路 OR 信号重开操作
|
||||
arrangementRouteOperation(deviceList) {
|
||||
const operate = {
|
||||
operation: this.Signal.arrangementRoute.button.operation
|
||||
operation: this.Signal.arrangementRoute.button.operation,
|
||||
userOperationType: 'rightClick'
|
||||
};
|
||||
if (!this.routeDataMap) { this.handleRouteDataMap(); }
|
||||
|
||||
@ -536,6 +540,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.$store.state.menuOperation.buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE,
|
||||
param: {
|
||||
signalCode: model._type === 'Signal' ? model.code : model.signalCode
|
||||
@ -555,6 +560,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.Signal.guide.button.operation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE,
|
||||
param: {signalCode: model.signalCode}
|
||||
};
|
||||
@ -574,6 +580,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.$store.state.menuOperation.buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
val: model.code,
|
||||
cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE
|
||||
};
|
||||
@ -591,6 +598,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.$store.state.menuOperation.buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: this.cmdType,
|
||||
param: { switchCode: model.code}
|
||||
};
|
||||
@ -622,6 +630,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: '',
|
||||
param: {}
|
||||
};
|
||||
@ -651,6 +660,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.guideLockRightFlag ? this.Switch.guideLock.rightButton : this.Switch.guideLock.leftButton,
|
||||
userOperationType: 'rightClick',
|
||||
nextCmdType: CMD.Switch.CMD_SWITCH_MASTER_LOCK,
|
||||
param: {signalCode: model.signalCode}
|
||||
};
|
||||
@ -669,6 +679,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.$store.state.menuOperation.buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK,
|
||||
param: {sectionCode: model.code}
|
||||
};
|
||||
@ -680,6 +691,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.$store.state.menuOperation.buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: CMD.Signal.CMD_SIGNAL_TURN_ON,
|
||||
param: {signalCode: model.code}
|
||||
};
|
||||
@ -691,6 +703,7 @@ export default {
|
||||
over: true,
|
||||
code: model.code,
|
||||
operation: this.$store.state.menuOperation.buttonOperation,
|
||||
userOperationType: 'rightClick',
|
||||
cmdType: CMD.Signal.CMD_SIGNAL_TURN_OFF,
|
||||
param: {signalCode: model.signalCode}
|
||||
};
|
||||
@ -771,6 +784,7 @@ export default {
|
||||
name:'总辅助',
|
||||
operation:this.CTCCommand.assistPressMainAssist.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_MAIN_ASSIST,
|
||||
userOperationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode,
|
||||
@ -782,6 +796,7 @@ export default {
|
||||
name:'改方',
|
||||
operation:this.CTCCommand.assistPressDownTurnDirection.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_DOWN_TURN_DIRECTION,
|
||||
operationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode,
|
||||
@ -794,6 +809,7 @@ export default {
|
||||
// this.CTCCommand.assistPressDownTurnDirection.menu.operation
|
||||
operation:this.CTCCommand.assistPressReceiveAssist.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_RECEIVE_ASSIST,
|
||||
userOperationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode
|
||||
@ -804,6 +820,7 @@ export default {
|
||||
name:'发辅助',
|
||||
operation:this.CTCCommand.assistPressDeliverAssist.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_DELIVER_ASSIST,
|
||||
userOperationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode
|
||||
@ -814,6 +831,7 @@ export default {
|
||||
name:'事故',
|
||||
operation:this.CTCCommand.assistPressAccident.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_ACCIDENT,
|
||||
userOperationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode
|
||||
@ -826,6 +844,7 @@ export default {
|
||||
'OCCLUSION':{
|
||||
operation:this.CTCCommand.assistPressBlock.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_BLOCK,
|
||||
userOperationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode
|
||||
@ -835,6 +854,7 @@ export default {
|
||||
'RECOVERY':{
|
||||
operation:this.CTCCommand.assistPressRestore.menu.operation,
|
||||
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_RESTORE,
|
||||
userOperationType: 'rightClick',
|
||||
param:{
|
||||
labelEnum:model.labelEnum,
|
||||
stationCode:model.stationCode
|
||||
@ -847,7 +867,8 @@ export default {
|
||||
operation: noPasswordModelTypeMap[model.type].operation,
|
||||
code: model.code,
|
||||
param: noPasswordModelTypeMap[model.type].param,
|
||||
cmdType : noPasswordModelTypeMap[model.type].nextCmdType
|
||||
cmdType : noPasswordModelTypeMap[model.type].nextCmdType,
|
||||
userOperationType: 'rightClick'
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
@ -864,7 +885,8 @@ export default {
|
||||
const operate = {
|
||||
operation: modelTypeMap[model.type].operation,
|
||||
code: model.code,
|
||||
param: modelTypeMap[model.type].param
|
||||
param: modelTypeMap[model.type].param,
|
||||
userOperationType: 'rightClick'
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
|
@ -290,6 +290,9 @@ function handle(state, data) {
|
||||
case 'Simulation_Training_Step_Tip':
|
||||
state.trainingStepTip = msg;
|
||||
break;
|
||||
case 'Simulation_Training_Finish':
|
||||
state.trainingOverCount++;
|
||||
break;
|
||||
//
|
||||
// // 大铁项目 调度台 运行图信息 初始化消息
|
||||
// case 'SIMULATION_RAILWAY_RUN_PLAN_INIT':
|
||||
@ -477,7 +480,8 @@ const socket = {
|
||||
railwaySimulationRunplanSendChange:0, // 大铁项目 调度台 发布 行车计划变化
|
||||
voiceBroadcastMsgs: [], // 语音播报信息
|
||||
voiceBroadcastChange: 0, // 语音播报信息变化
|
||||
trainingStepTip: '' // 新实训推送消息
|
||||
trainingStepTip: '', // 新实训推送消息
|
||||
trainingOverCount: 0 // 新实训结束计数器
|
||||
// railwaySimulationRpMsg:{}, // 大铁项目 调度台 调度台
|
||||
// railwaySimulationRpChange:0 // 大铁项目 调度台 运行图信息变化
|
||||
},
|
||||
@ -588,6 +592,9 @@ const socket = {
|
||||
},
|
||||
clearTrainingStepTip: (state) => {
|
||||
state.trainingStepTip = '';
|
||||
},
|
||||
clearTrainingOverCount: (state) => {
|
||||
state.trainingOverCount = 0;
|
||||
}
|
||||
},
|
||||
|
||||
@ -694,6 +701,9 @@ const socket = {
|
||||
},
|
||||
clearTrainingStepTip: ({ commit }) => {
|
||||
commit('clearTrainingStepTip');
|
||||
},
|
||||
clearTrainingOverCount: ({ commit }) => {
|
||||
commit('clearTrainingOverCount');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ import deviceType from '../../jmapNew/constant/deviceType';
|
||||
import LangStorage from '@/utils/lang';
|
||||
import Handler from '@/scripts/cmdPlugin/Handler';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import store from '@/store/index';
|
||||
|
||||
/**
|
||||
* 实训状态数据
|
||||
@ -454,6 +455,7 @@ const training = {
|
||||
rtn && rtn.valid && commit('next');
|
||||
}
|
||||
}
|
||||
store.dispatch('trainingNew/setTrainingOperate', operate);
|
||||
resolve(rtn);
|
||||
}).catch(error => {
|
||||
// console.error(error);
|
||||
|
@ -3,7 +3,10 @@ const training = {
|
||||
state: {
|
||||
teachMode: '', // 实训模式
|
||||
trainingDetail: null, // 实训详情
|
||||
trainingSwitch: false // 实训开始结束标志
|
||||
trainingSwitch: false, // 实训开始结束标志
|
||||
trainingOperate: null,
|
||||
stepOrder: 1,
|
||||
operateOrder: 0
|
||||
},
|
||||
getters: {
|
||||
teachMode: (state) => {
|
||||
@ -14,6 +17,12 @@ const training = {
|
||||
},
|
||||
trainingSwitch: (state) => {
|
||||
return state.trainingSwitch;
|
||||
},
|
||||
trainingOperate: (state) => {
|
||||
return state.trainingOperate;
|
||||
},
|
||||
stepOrder: (state) => {
|
||||
return state.stepOrder;
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
@ -25,6 +34,21 @@ const training = {
|
||||
},
|
||||
setTrainingSwitch: (state, flag) => {
|
||||
state.trainingSwitch = flag;
|
||||
},
|
||||
setTrainingOperate: (state, trainingOperate) => {
|
||||
state.trainingOperate = trainingOperate;
|
||||
},
|
||||
stepOrderIncrease: (state) => {
|
||||
state.stepOrder++;
|
||||
},
|
||||
clearStepOrder: (state) => {
|
||||
state.stepOrder = 1;
|
||||
},
|
||||
operateOrderIncrease: (state) => {
|
||||
state.operateOrder++;
|
||||
},
|
||||
clearOperateOrder: (state) => {
|
||||
state.operateOrder = 0;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@ -39,7 +63,23 @@ const training = {
|
||||
},
|
||||
trainingEnd: ({commit}) => {
|
||||
commit('setTrainingSwitch', false);
|
||||
},
|
||||
setTrainingOperate: ({commit, state}, trainingOperate) => {
|
||||
commit('setTrainingOperate', trainingOperate);
|
||||
},
|
||||
stepOrderIncrease: ({commit}) => {
|
||||
commit('stepOrderIncrease');
|
||||
},
|
||||
clearStepOrder: ({commit}) => {
|
||||
commit('clearStepOrder');
|
||||
},
|
||||
operateOrderIncrease: ({commit}) => {
|
||||
commit('operateOrderIncrease');
|
||||
},
|
||||
clearOperateOrder: ({commit}) => {
|
||||
commit('clearOperateOrder');
|
||||
}
|
||||
}
|
||||
};
|
||||
export default training;
|
||||
|
||||
|
@ -24,14 +24,14 @@ export function handlerUrl(data) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// const data = null;
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.233/rtss-server';
|
||||
// BASE_API = 'http://114.116.51.125/jlcloud';
|
||||
// BASE_API = 'http://192.168.8.152:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
|
||||
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
|
||||
BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
|
||||
|
@ -1,14 +1,15 @@
|
||||
<template>
|
||||
<div class="train">
|
||||
<div v-show="maskOpen" class="trainMask" />
|
||||
<jlmap-visual ref="jlmapVisual" />
|
||||
<component :is="menus" :selected="selected" />
|
||||
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" @onMenu="onContextmenu" />
|
||||
<menu-demon ref="menuDemon" />
|
||||
<voice-chat-box v-if="$route.query.lineCode == '19'" ref="chatbox" :group="group" :user-role="userRole" />
|
||||
<chat-box v-else ref="chatbox" :group="group" :user-role="userRole" />
|
||||
<training-tip ref="trainingTip" />
|
||||
<div class="trainBack">
|
||||
<el-button-group>
|
||||
<el-button @click="nextStep">下一步</el-button>
|
||||
<!-- <el-button @click="nextStep">下一步</el-button>-->
|
||||
<el-button v-if="!trainingSwitch && trainingDetail" type="success" @click="handlerStart">开始</el-button>
|
||||
<el-button v-if="trainingSwitch" type="danger" @click="handlerEnd">结束</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
@ -27,6 +28,9 @@ import chatBox from '@/views/newMap/chatView/chatBox.vue';
|
||||
import VoiceChatBox from '@/views/newMap/chatView/voiceChatBox.vue';
|
||||
import MenuDemon from './demonMenu.vue';
|
||||
import TrainingTip from './trainingTip';
|
||||
import deviceType from '@/jmapNew/constant/deviceType.js';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import { getDeviceMenuByDeviceType, MouseEvent } from '@/scripts/ConstDic';
|
||||
export default {
|
||||
name: 'TrainingDesign',
|
||||
components: {
|
||||
@ -48,7 +52,8 @@ export default {
|
||||
offsetBottom: 0,
|
||||
trainingObj: null,
|
||||
starting: false,
|
||||
stepId: 1
|
||||
selected: null,
|
||||
menus: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -107,11 +112,27 @@ export default {
|
||||
},
|
||||
'$store.state.socket.simulationOver':function(val) {
|
||||
this.backOut();
|
||||
},
|
||||
'$store.state.trainingNew.trainingOperate':function(val) {
|
||||
if (this.trainingSwitch && val) {
|
||||
const stepList = JSON.parse(this.trainingDetail.stepJson);
|
||||
const step = stepList.find(item => item.id == this.$store.state.trainingNew.stepOrder );
|
||||
const operateIndex = step.operations.findIndex(item => item.id == this.$store.state.trainingNew.operateOrder);
|
||||
this.checkOperation(val, step.operations[operateIndex], step.operations.length === (operateIndex + 1 ));
|
||||
}
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function () {
|
||||
const lineCode = this.$jlmap.lineCode;
|
||||
if (lineCode) {
|
||||
this.menus = this.$theme.loadMenuComponent(lineCode);
|
||||
// this.$store.commit('training/notifyGetCommandDefinition', lineCode);
|
||||
}
|
||||
}
|
||||
},
|
||||
async beforeDestroy() {
|
||||
await this.$store.dispatch('map/mapClear');
|
||||
this.$store.dispatch('training/setPrdType', '');
|
||||
this.$store.dispatch('socket/clearTrainingOverCount');
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('training/setPrdType', '01');
|
||||
@ -127,6 +148,38 @@ export default {
|
||||
loadMapDataById(this.mapId, 'preview');
|
||||
}
|
||||
},
|
||||
checkOperation(now, data, stepOver) {
|
||||
let flag = true;
|
||||
if (now.cmdType || data.operationType) {
|
||||
const cmd = now.cmdType ? now.cmdType.value : '';
|
||||
flag = (cmd === data.operationType) && flag;
|
||||
console.log(flag, '1111111111');
|
||||
}
|
||||
if (now.code || data.deviceCode) {
|
||||
flag = (now.code === data.deviceCode) && flag;
|
||||
console.log(flag, '2222222222');
|
||||
}
|
||||
if (now.operation || data.domId) {
|
||||
flag = (now.operation === data.domId) && flag;
|
||||
console.log(flag, '33333333333');
|
||||
}
|
||||
if (now.userOperationType || data.userOperationType) {
|
||||
flag = (now.userOperationType === data.userOperationType) && flag;
|
||||
console.log(flag, '4444444444');
|
||||
}
|
||||
for (const param in data.params) {
|
||||
flag = (now.params[param] === data.params[param]) && flag;
|
||||
console.log(flag, '5555555555');
|
||||
}
|
||||
console.log(now, data, stepOver, flag);
|
||||
if (flag && stepOver) {
|
||||
this.nextStep();
|
||||
} else if (flag) {
|
||||
this.$store.dispatch('trainingNew/operateOrderIncrease');
|
||||
} else {
|
||||
console.error('校验失败;');
|
||||
}
|
||||
},
|
||||
overallTranslation(flag) {
|
||||
const panel = document.getElementById('leftSlider');
|
||||
if (flag) {
|
||||
@ -164,7 +217,6 @@ export default {
|
||||
this.clearSubscribe();
|
||||
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
|
||||
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
|
||||
// await this.$store.dispatch('training/setHasSubscribed');
|
||||
},
|
||||
clearSubscribe() {
|
||||
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
|
||||
@ -177,19 +229,159 @@ export default {
|
||||
});
|
||||
},
|
||||
nextStep() {
|
||||
endTrainingStep(this.group, this.stepId).then(resp => {
|
||||
this.stepId++;
|
||||
endTrainingStep(this.group, this.$store.state.trainingNew.stepOrder).then(resp => {
|
||||
this.$store.dispatch('trainingNew/clearOperateOrder');
|
||||
this.$store.dispatch('trainingNew/stepOrderIncrease');
|
||||
}).catch(() => {
|
||||
this.$message.error('进入下一步实训失败!');
|
||||
});
|
||||
},
|
||||
handlerEnd() {
|
||||
endTraining(this.group).then(() => {
|
||||
this.$store.dispatch('trainingNew/trainingEnd');
|
||||
this.$store.dispatch('socket/clearTrainingStepTip');
|
||||
this.$store.dispatch('socket/setTrainingDetail', null);
|
||||
this.stepId = 1;
|
||||
this.$store.dispatch('trainingNew/clearStepOrder');
|
||||
this.$store.dispatch('trainingNew/setTrainingDetail', null);
|
||||
}).catch(() => {
|
||||
this.$message.error('结束实训失败!');
|
||||
});
|
||||
},
|
||||
clickEvent(em) {
|
||||
this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
var device = { _type: em.deviceType, _code: em.deviceCode, _event: MouseEvent.Left };
|
||||
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (em.deviceType === 'StationStand' && lineCode === '01') {
|
||||
const menu = getDeviceMenuByDeviceType(device._type) || [];
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: { x: em.clientX, y: em.clientY }, menu: menu });
|
||||
}
|
||||
|
||||
if (em.deviceCode) {
|
||||
device = this.getDeviceByEm(em);
|
||||
}
|
||||
this.selected = { ...device, _event: MouseEvent.Left };
|
||||
this.$store.dispatch('menuOperation/setSelected', {device: this.selected, subType: em.subType});
|
||||
this.$store.dispatch('menuOperation/setLeftClickCount');
|
||||
if (this.$route.query.lineCode == '07') {
|
||||
this.$store.dispatch('menuOperation/setMenuChange', {device: device, subType: em.subType});
|
||||
}
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
if (this.$store.state.map.selectDevice && this.$store.state.map.selectDevice.flag && device._type) {
|
||||
if (device._type.toUpperCase() == this.$store.state.map.selectDevice.type.toUpperCase()) {
|
||||
EventBus.$emit('selectDevice', device);
|
||||
} else {
|
||||
const name = this.typeObj[this.$store.state.map.selectDevice.type];
|
||||
const info = '选择的设备类型不正确' + (name ? `,请选择${name}类型` : '');
|
||||
this.$message.info(info);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
onContextmenu(em) {
|
||||
var menu = null;
|
||||
var device = null;
|
||||
const point = { x: em.clientX, y: em.clientY };
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (em.subType === 'TrainWindow') {
|
||||
if (lineCode != '06') {
|
||||
device = { _type: deviceType.TrainWindow, code: em.deviceCode, _event: MouseEvent.Right };
|
||||
this.$store.dispatch('map/setTrainWindowShow', true);
|
||||
}
|
||||
} else if (em.subType == 'button' && em.deviceType == 'Station') { // 宁波一号线右键显示控制模式
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', {device:equipment, subType: em.subType});
|
||||
menu = getDeviceMenuByDeviceType('StationControl');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType == 'light' && em.deviceType == 'Station') { // 宁波一号线右键显示强制点灯
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
menu = getDeviceMenuByDeviceType('StationLight');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType == 'preReset' && em.deviceType == 'Station') { // 宁波一号线右键显示计轴复位
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
menu = getDeviceMenuByDeviceType('StationPreReset');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType == 'enabled' && em.deviceType == 'Switch') {
|
||||
menu = getDeviceMenuByDeviceType('Enabled');
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.subType === 'enabled' && em.deviceType === 'Signal') {
|
||||
menu = getDeviceMenuByDeviceType('Enabled');
|
||||
const equipment = this.getDeviceByEm(em);
|
||||
this.$store.dispatch('menuOperation/setSelected', { device: equipment, subType: em.subType });
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu});
|
||||
device = this.getDeviceByEm(em);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
return;
|
||||
} else if (em.deviceCode && !this.isScreen) {
|
||||
device = this.getDeviceByEm(em);
|
||||
}
|
||||
if (device) {
|
||||
device = this.getSelectedByLineCode(device);
|
||||
this.selected = { ...device, _event: MouseEvent.Right};
|
||||
if (!this.buttonOperation) {
|
||||
this.$store.dispatch('menuOperation/setSelected', {device: this.selected, subType: em.subType});
|
||||
if (!this.checkShouldPop(device)) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: null });
|
||||
} else {
|
||||
if (em.deviceType === 'StationStand' && lineCode === '01') {
|
||||
return;
|
||||
}
|
||||
menu = getDeviceMenuByDeviceType(device._type);
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
}
|
||||
} else if (this.$route.query.ctc) {
|
||||
this.$store.dispatch('menuOperation/setSelected', {device: this.selected, subType: em.subType});
|
||||
menu = getDeviceMenuByDeviceType(device._type);
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
}
|
||||
} else {
|
||||
menu = getDeviceMenuByDeviceType('Cancel');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: menu });
|
||||
}
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
},
|
||||
// 获取设备数据
|
||||
getDeviceByEm(em) {
|
||||
var device = this.$store.getters['map/getDeviceByCode'](em.deviceCode) || null;
|
||||
if (device) {
|
||||
device._viewVal = em.val;
|
||||
}
|
||||
return device;
|
||||
},
|
||||
// 根据皮肤类型转换激活的菜单类型
|
||||
getSelectedByLineCode(device) {
|
||||
const switchSectionIsWitchLineCodeList = ['03'];
|
||||
const lineCode = this.$store.getters['map/lineCode'];
|
||||
if (switchSectionIsWitchLineCodeList.includes(lineCode) && device._type == deviceType.Section) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](device._code);
|
||||
if (section) {
|
||||
device = this.$store.getters['map/getDeviceByCode'](section.relSwitchCode);
|
||||
}
|
||||
}
|
||||
// 过滤道岔相关区段变成道岔model
|
||||
if (device._type == 'Section' && device.type == '03') {
|
||||
device = this.$store.getters['map/getDeviceByCode'](device.switch.code);
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -14,6 +14,9 @@ export default {
|
||||
watch: {
|
||||
'$store.state.socket.trainingStepTip': function(val) {
|
||||
this.trainingTipMessage = val;
|
||||
},
|
||||
'$store.state.socket.trainingOverCount': function(val) {
|
||||
this.trainingTipMessage = '实训完成,请点击结束按钮。';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -7,18 +7,21 @@
|
||||
</el-button-group>
|
||||
</div>
|
||||
<TrainingList ref="trainingList" @updateDetails="updateDetails" />
|
||||
<EditDetails ref="editDetails" v-dialogDrag :edit-data="editData" />
|
||||
<EditDetails ref="editDetails" v-dialogDrag :edit-data="editData" @openEditOperate="openEditOperate" />
|
||||
<edit-operate ref="editOperate" v-dialogDrag @backStepList="backStepList" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import TrainingList from './trainingList.vue';
|
||||
import EditDetails from './editDetails.vue';
|
||||
import EditOperate from './editOperate.vue';
|
||||
|
||||
export default {
|
||||
name:'DemonMenu',
|
||||
components:{
|
||||
TrainingList,
|
||||
EditDetails
|
||||
EditDetails,
|
||||
EditOperate
|
||||
},
|
||||
props:{
|
||||
},
|
||||
@ -57,6 +60,14 @@ export default {
|
||||
updateDetails(data) {
|
||||
this.editData = data;
|
||||
this.$refs.editDetails.doShow(data);
|
||||
},
|
||||
openEditOperate(data) {
|
||||
console.log(data, '***');
|
||||
this.$refs.editOperate.doShow(data);
|
||||
},
|
||||
backStepList(data) {
|
||||
this.$refs.editDetails.setOperations(data);
|
||||
this.$refs.editDetails.minisize();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,8 +90,7 @@ export default {
|
||||
{
|
||||
title: this.$t('trainingManage.operateCondition'),
|
||||
prop: 'operations',
|
||||
type: 'basic',
|
||||
edit: true
|
||||
type: 'basic'
|
||||
},
|
||||
{
|
||||
title: this.$t('trainingManage.completionCondition'),
|
||||
@ -102,8 +101,13 @@ export default {
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '100',
|
||||
width: '200',
|
||||
buttons: [
|
||||
{
|
||||
name: '编辑步骤',
|
||||
type: 'primary',
|
||||
handleClick: this.handleEditOperate
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
type: 'danger',
|
||||
@ -174,6 +178,13 @@ export default {
|
||||
};
|
||||
this.queryList.data.push(obj);
|
||||
},
|
||||
setOperations(data) {
|
||||
this.queryList.data.forEach(item => {
|
||||
if (item.id === data.id) {
|
||||
item.operations = data.operations;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
console.log('删除', index, row);
|
||||
this.$confirm('确定删除该条步骤数据?', '警告', {
|
||||
@ -184,6 +195,10 @@ export default {
|
||||
this.queryList.data.splice(index, 1);
|
||||
}).catch(e => {});
|
||||
},
|
||||
handleEditOperate(index, row) {
|
||||
this.$emit('openEditOperate', row);
|
||||
this.doClose();
|
||||
},
|
||||
minisize() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
@ -203,7 +218,7 @@ export default {
|
||||
delete obj.isEdit;
|
||||
list.push(obj);
|
||||
});
|
||||
updateTrainingStep(this.editData.id, list).then(res => {
|
||||
updateTrainingStep(this.group, this.editData.id, list).then(res => {
|
||||
console.log('保存步骤成功!', res);
|
||||
this.$message.success('保存步骤成功!');
|
||||
// this.doClose();
|
||||
|
145
src/views/trainingManage/editOperate.vue
Normal file
145
src/views/trainingManage/editOperate.vue
Normal file
@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="editContentTab">
|
||||
<div v-if="dialogVisible" class="editContentTabLable" @click="minisize">
|
||||
<span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="500" :modal="false" :close-on-click-modal="false" :show-close="false" center style="margin-left: 200px">
|
||||
<el-row style="font-size: 16px;padding: 5px;">
|
||||
<el-col :span="4">步骤描述:</el-col>
|
||||
<el-col :span="20">{{ stepDetail.description }}</el-col>
|
||||
</el-row>
|
||||
<el-row style="font-size: 16px;padding: 5px;overflow: hidden;word-wrap: break-word;">
|
||||
<el-col :span="4">操作详情:</el-col>
|
||||
<el-col :span="20">
|
||||
<!-- <div v-for="item in stepDetail.operations" :key="item">
|
||||
<div>{{ item }}</div>
|
||||
</div>-->
|
||||
<template v-for="(item, index) in stepDetail.operations">
|
||||
<div :key="index">
|
||||
<el-tag closable @close="deleteOperation(index)">
|
||||
{{ covertString(item) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="small" type="success" @click="backStepList">返回步骤列表</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'EditOperate',
|
||||
data() {
|
||||
return {
|
||||
title: '编辑步骤',
|
||||
dialogVisible: false,
|
||||
dialogWidth: 500,
|
||||
stepDetail: {
|
||||
id: '',
|
||||
description: '',
|
||||
operations: []
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.trainingNew.trainingOperate': function (val) {
|
||||
if (val && this.dialogVisible) {
|
||||
const data = {
|
||||
deviceCode: val.code || '',
|
||||
userOperationType: val.userOperationType || '',
|
||||
domId: val.operation || '',
|
||||
operationType: val.cmdType ? val.cmdType.value : '',
|
||||
params: val.params || {},
|
||||
t: 'C'
|
||||
};
|
||||
console.log(data, '********');
|
||||
this.stepDetail.operations.push(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow(data) {
|
||||
if (data) {
|
||||
this.stepDetail.id = data.id;
|
||||
this.stepDetail.description = data.description;
|
||||
this.stepDetail.operations = data.operations || [];
|
||||
this.dialogVisible = true;
|
||||
}
|
||||
},
|
||||
minisize() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
deleteOperation(index) {
|
||||
this.stepDetail.operations.splice(index, 1);
|
||||
},
|
||||
backStepList() {
|
||||
this.stepDetail = {
|
||||
id: '',
|
||||
description: '',
|
||||
operations: []
|
||||
};
|
||||
this.$emit('backStepList', this.stepDetail);
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
covertString(data) {
|
||||
// const datate = {
|
||||
// deviceCode: '',
|
||||
// userOperationType: '',
|
||||
// domId: '',
|
||||
// operationType: '',
|
||||
// params: ''
|
||||
// };
|
||||
const userOperationTypeMap = {
|
||||
rightClick: '右键点击',
|
||||
leftClick: '左键点击',
|
||||
chooseValue: '选择',
|
||||
fillValue: '填写'
|
||||
};
|
||||
if (userOperationTypeMap[data.userOperationType]) {
|
||||
return userOperationTypeMap[data.userOperationType] + data.domId;
|
||||
} else {
|
||||
return data.domId;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/ .el-dialog__wrapper {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
top: auto;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
overflow: visible !important;
|
||||
}
|
||||
/deep/ .el-dialog--center{
|
||||
width: 600px;
|
||||
}
|
||||
.editContentTab{
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
right: 12px;
|
||||
top: calc(45% + 100px);
|
||||
}
|
||||
.editContentTabLable{
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
border-radius: 5px 0px 0px 5px ;
|
||||
padding: 5px 0px;
|
||||
width: 23px;
|
||||
text-align: center;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
cursor: pointer;
|
||||
top:-28px;
|
||||
}
|
||||
</style>
|
@ -13,7 +13,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTrainingList} from '@/api/trainingManage';
|
||||
import { getTrainingList } from '@/api/trainingManage';
|
||||
import { loadTrainingBg } from '@/api/jmap/training';
|
||||
import Cookies from 'js-cookie';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Create from './create.vue';
|
||||
@ -155,8 +156,12 @@ export default {
|
||||
},
|
||||
drawUp(index, row) {
|
||||
console.log('编辑', index, row);
|
||||
this.$emit('updateDetails', row);
|
||||
this.doClose();
|
||||
loadTrainingBg(this.$route.query.group, row.id).then(resp => {
|
||||
this.$emit('updateDetails', row);
|
||||
this.doClose();
|
||||
}).catch(() => {
|
||||
this.$message.error('加载草稿实训背景失败!');
|
||||
});
|
||||
},
|
||||
handleModify(index, row) {
|
||||
console.log('修改', index, row);
|
||||
|
Loading…
Reference in New Issue
Block a user