This commit is contained in:
joylink_cuiweidong 2022-08-31 10:56:00 +08:00
commit abec73d06c
7 changed files with 114 additions and 41 deletions

View File

@ -384,7 +384,7 @@ export default {
guideLockLeftButtonDown() {
const operate = {
operation: this.Station.stationMasterLock.leftButton.operation,
userOperationType: 'rightClick'
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
@ -401,7 +401,7 @@ export default {
guideLockRightButtonDown() {
const operate = {
operation: this.Station.stationMasterLock.rightButton.operation,
userOperationType: 'rightClick'
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
@ -482,7 +482,7 @@ export default {
arrangementRouteOperation(deviceList) {
const operate = {
operation: this.Signal.arrangementRoute.button.operation,
userOperationType: 'rightClick'
userOperationType: 'leftClick'
};
if (!this.routeDataMap) { this.handleRouteDataMap(); }
@ -540,7 +540,7 @@ export default {
over: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE,
param: {
signalCode: model._type === 'Signal' ? model.code : model.signalCode
@ -560,7 +560,7 @@ export default {
over: true,
code: model.code,
operation: this.Signal.guide.button.operation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE,
param: {signalCode: model.signalCode}
};
@ -580,7 +580,7 @@ export default {
over: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
val: model.code,
cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE
};
@ -598,7 +598,7 @@ export default {
over: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: this.cmdType,
param: { switchCode: model.code}
};
@ -630,7 +630,7 @@ export default {
over: true,
code: model.code,
operation: buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: '',
param: {}
};
@ -660,7 +660,7 @@ export default {
over: true,
code: model.code,
operation: this.guideLockRightFlag ? this.Switch.guideLock.rightButton : this.Switch.guideLock.leftButton,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
nextCmdType: CMD.Switch.CMD_SWITCH_MASTER_LOCK,
param: {signalCode: model.signalCode}
};
@ -679,7 +679,7 @@ export default {
over: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK,
param: {sectionCode: model.code}
};
@ -691,7 +691,7 @@ export default {
over: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: CMD.Signal.CMD_SIGNAL_TURN_ON,
param: {signalCode: model.code}
};
@ -703,7 +703,7 @@ export default {
over: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
cmdType: CMD.Signal.CMD_SIGNAL_TURN_OFF,
param: {signalCode: model.signalCode}
};
@ -784,7 +784,7 @@ export default {
name:'总辅助',
operation:this.CTCCommand.assistPressMainAssist.menu.operation,
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_MAIN_ASSIST,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode,
@ -796,7 +796,7 @@ export default {
name:'改方',
operation:this.CTCCommand.assistPressDownTurnDirection.menu.operation,
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_DOWN_TURN_DIRECTION,
operationType: 'rightClick',
operationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode,
@ -809,7 +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',
userOperationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode
@ -820,7 +820,7 @@ export default {
name:'发辅助',
operation:this.CTCCommand.assistPressDeliverAssist.menu.operation,
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_DELIVER_ASSIST,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode
@ -831,7 +831,7 @@ export default {
name:'事故',
operation:this.CTCCommand.assistPressAccident.menu.operation,
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_ACCIDENT,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode
@ -844,7 +844,7 @@ export default {
'OCCLUSION':{
operation:this.CTCCommand.assistPressBlock.menu.operation,
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_BLOCK,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode
@ -854,7 +854,7 @@ export default {
'RECOVERY':{
operation:this.CTCCommand.assistPressRestore.menu.operation,
nextCmdType:CMD.CTC.CTC_ASSIST_PRESS_RESTORE,
userOperationType: 'rightClick',
userOperationType: 'leftClick',
param:{
labelEnum:model.labelEnum,
stationCode:model.stationCode
@ -868,7 +868,7 @@ export default {
code: model.code,
param: noPasswordModelTypeMap[model.type].param,
cmdType : noPasswordModelTypeMap[model.type].nextCmdType,
userOperationType: 'rightClick'
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
@ -886,7 +886,7 @@ export default {
operation: modelTypeMap[model.type].operation,
code: model.code,
param: modelTypeMap[model.type].param,
userOperationType: 'rightClick'
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {

View File

@ -467,7 +467,7 @@ const training = {
rtn && rtn.valid && commit('next');
}
}
store.dispatch('trainingNew/setTrainingOperate');
store.dispatch('trainingNew/setTrainingOperate', operate);
resolve(rtn);
}
}).catch(error => {

View File

@ -5,6 +5,7 @@ const training = {
trainingDetail: null, // 实训详情
trainingSwitch: false, // 实训开始结束标志
trainingOperate: null,
simulationPause: false, // 实训 暂停判断
stepOrder: 1,
operateOrder: 0,
stepOverCount: 0
@ -51,6 +52,9 @@ const training = {
operateOrderIncrease: (state) => {
state.operateOrder++;
},
setSimulationPause: (state, value) => {
state.simulationPause = value;
},
clearOperateOrder: (state) => {
state.operateOrder = 0;
},
@ -86,6 +90,9 @@ const training = {
operateOrderIncrease: ({commit}) => {
commit('operateOrderIncrease');
},
setSimulationPause: ({commit}, simulationPause) => {
commit('setSimulationPause', simulationPause);
},
clearOperateOrder: ({commit}) => {
commit('clearOperateOrder');
},

View File

@ -3,21 +3,26 @@
<menu-demon ref="menuDemon" />
<training-jlmap refs="trainingJlmap" />
<training-tip ref="trainingTip" />
<el-button size="small" class="fault-button" :type="faultMode ? '':'primary' " @click="changeOperateMode()">{{ faultMode?'切换到普通模式':'切换到故障模式' }}</el-button>
<div class="trainBack">
<el-button-group>
<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>
<el-button type="danger" size="small" @click="init">初始化</el-button>
<el-button v-if="!isPause" size="small" type="primary" @click="pauseScript">暂停</el-button>
<el-button v-else size="small" type="primary" @click="executePlayScript">恢复</el-button>
<el-button v-if="!trainingSwitch && trainingDetail" type="success" size="small" @click="handlerStart">开始</el-button>
<el-button v-if="trainingSwitch" type="danger" size="small" @click="handlerEnd">结束</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { clearSimulation } from '@/api/simulation';
import { clearSimulation, executeScriptNew, simulationPause, exitRunPlan } from '@/api/simulation';
import { startTraining, endTraining, endTrainingStep } from '@/api/jmap/training';
import TrainingJlmap from './trainingJlmap';
import MenuDemon from '@/views/trainingManage/demonMenu.vue';
import TrainingTip from './trainingTip';
import { OperateMode } from '@/scripts/ConstDic';
export default {
name: 'TrainingDesign',
@ -28,7 +33,8 @@ export default {
},
data() {
return {
groupModel: ''
groupModel: '',
faultMode: false
};
},
computed: {
@ -52,6 +58,9 @@ export default {
},
trainingDetail() {
return this.$store.state.trainingNew.trainingDetail;
},
isPause() {
return this.$store.state.trainingNew.simulationPause;
}
},
watch: {
@ -62,12 +71,56 @@ export default {
beforeDestroy() {
this.$store.dispatch('socket/clearTrainingOverCount');
this.$store.dispatch('trainingNew/clearStepOverCount');
this.handlerEnd();
this.$store.dispatch('trainingNew/setTrainingDetail', null);
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/clearOperateOrder');
this.$store.dispatch('trainingNew/changeTeachMode', '');
},
mounted() {
this.groupModel = this.$route.query.group;
},
methods: {
changeOperateMode() {
this.faultMode = !this.faultMode;
let mode = OperateMode.NORMAL;
if (this.faultMode) {
mode = OperateMode.FAULT;
}
this.$store.dispatch('training/changeOperateMode', { mode: mode });
},
init() {
this.loading = true;
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/setTrainWindowShow', false);
this.$store.dispatch('map/initSimulationButton');
});
});
setTimeout(() => {
this.loading = false;
}, 1500);
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
},
pauseScript() {
simulationPause(this.group).then(resp => {
this.$store.dispatch('trainingNew/setSimulationPause', true);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.pauseFail'));
});
},
executePlayScript() {
executeScriptNew(this.group).then(resp => {
this.$store.dispatch('trainingNew/setSimulationPause', false);
}).catch(() => {
this.$messageBox(this.$t('scriptRecord.recoverFail'));
});
},
async back() {
if (this.$route.query.group) {
await clearSimulation(this.$route.query.group);
@ -90,11 +143,12 @@ export default {
});
},
handlerEnd() {
endTraining(this.groupModel).then(() => {
endTraining(this.group).then(() => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/changeTeachMode', '');
this.$store.dispatch('trainingNew/setSimulationPause', false);
}).catch(() => {
this.$message.error('结束实训失败!');
});
@ -125,4 +179,9 @@ export default {
bottom: 15px;
z-index: 19;
}
.fault-button{
position: absolute;
top: 15px;
right: 32px;
}
</style>

View File

@ -71,6 +71,11 @@ export default {
async beforeDestroy() {
this.$store.dispatch('socket/clearTrainingOverCount');
this.$store.dispatch('trainingNew/clearStepOverCount');
this.$store.dispatch('trainingNew/setTrainingDetail', null);
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/clearOperateOrder');
this.$store.dispatch('trainingNew/changeTeachMode', '');
},
mounted() {
},
@ -108,7 +113,6 @@ export default {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
// this.$store.dispatch('trainingNew/setTrainingDetail', null);
}).catch(() => {
this.$message.error('结束实训失败!');
});

View File

@ -189,11 +189,9 @@ export default {
this.tableData.push(obj);
},
setOperations(data) {
this.tableData.forEach(item => {
if (item.id === data.id) {
item.operations = data.operations;
}
});
if (data) {
this.tableData[data.index].operations = data.stepDetail.operations;
}
},
handleDelete(index, row) {
console.log('删除', index, row);
@ -217,7 +215,7 @@ export default {
}).catch(() => { this.$message.error('调整角色失败!'); });
}
// assignUsersPlayRoles
this.$emit('openEditOperate', row);
this.$emit('openEditOperate', { index: index, data: row });
this.doClose();
},
minisize() {

View File

@ -40,6 +40,7 @@ export default {
title: '编辑操作',
dialogVisible: false,
dialogWidth: 500,
dataIndex: 0,
stepDetail: {
id: '',
description: '',
@ -65,9 +66,12 @@ export default {
methods: {
doShow(data) {
if (data) {
this.stepDetail.id = data.id;
this.stepDetail.description = data.description;
this.stepDetail.operations = data.operations || [];
// this.stepDetail = data;
// console.log(this.stepDetail, 'stepDetail');
this.stepDetail.id = data.data.id;
this.stepDetail.description = data.data.description;
this.stepDetail.operations = data.data.operations || [];
this.dataIndex = data.index;
this.dialogVisible = true;
}
},
@ -78,13 +82,14 @@ export default {
this.stepDetail.operations.splice(index, 1);
},
backStepList() {
this.$emit('backStepList', this.stepDetail);
this.$emit('backStepList', { index: this.dataIndex, stepDetail: this.stepDetail });
this.dialogVisible = false;
this.stepDetail = {
id: '',
description: '',
operations: []
};
this.dataIndex = 0;
},
covertString(data) {
// const datate = {