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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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