代码调整

This commit is contained in:
fan 2022-11-01 18:07:26 +08:00
parent 071143992e
commit a9b47a5a4a
5 changed files with 200 additions and 35 deletions

View File

@ -50,7 +50,8 @@ const training = {
triggerFaultDevice: '', // 触发故障目标设备
trainingStart: false, // 实训开始状态
notifySelected: null, // 场景弹窗内容
runPathList:[] // 运行线 (宁波三号线)
runPathList:[], // 运行线 (宁波三号线)
domConfig: {}
},
getters: {
@ -93,6 +94,9 @@ const training = {
});
}
return trainList;
},
domConfig: (state) => {
return state.domConfig;
}
},
@ -310,6 +314,9 @@ const training = {
},
setUserRole: (state, userRole) => {
state.userRole = userRole;
},
setDomConfig: (state, domConfig) => {
state.domConfig = domConfig;
}
},
@ -688,6 +695,9 @@ const training = {
},
setOperateErrMsg: ({ commit }) => {
commit('setOperateErrMsg', { errMsg: '操作错误!', color: 'red' });
},
setDomConfig: ({ commit }, config) => {
commit('setDomConfig', config);
}
}
};

View File

@ -3,7 +3,7 @@
<transition name="el-zoom-in-bottom">
<!-- v-show="!specialDispatch" -->
<!-- <map-system-draft ref="mapCanvas" @back="back" />-->
<terminals-picture ref="terminalsPicture" />
<terminals-picture v-if="terminalsShow" ref="terminalsPicture" />
</transition>
<simulation-control ref="simulationControl" />
<simulation-menu ref="simulationMenu" :mode="mode" />
@ -38,7 +38,8 @@ export default {
// textStatusHeight: 0,
// planRunning:false,
dataError: false,
group:''
group:'',
terminalsShow: true
// showMap: false
};
},
@ -66,6 +67,10 @@ export default {
watch:{
'$store.state.app.windowSizeCount': function() { //
this.setWindowSize();
},
'$store.state.training.domConfig': function(val) {
this.$refs.simulationMenu.handleMenuShow(val);
this.terminalsShow = !val.singleClient;
}
},
async mounted() {
@ -114,6 +119,9 @@ export default {
this.$messageBox('此地图数据正在维护中,无法运行!');
}
this.dataError = resp.data.dataError;
if (resp.data.paramVO && resp.data.paramVO.domConfig) {
this.$store.dispatch('training/setDomConfig', resp.data.paramVO.domConfig);
}
}
},
//

View File

@ -1,27 +1,101 @@
<template>
<div class="simulationControlAll">
<el-button class="controlButton" :loading="pauseLoading" circle :class="simulationPaused?'el-icon-video-play':'el-icon-video-pause'" @click="startOrPause" />
<el-button class="controlButton" type="info" style="background: #000;" :loading="pauseLoading" circle :class="simulationPaused?'el-icon-video-play':'el-icon-video-pause'" @click="startOrPause" />
<div>
<div class="simulationMenu" @click="showMenuSpeedList">{{ `x${speed}` }}</div>
<div v-show="isShowSpeedMenuList" class="simulationMenuList" style="right: 85px;">
<div v-for="(each, index) in speedList" :key="index">
<div class="eachSimulationMenu" :class="{'active' :speed === each.value}" @click="speedChange(each.value)">{{ each.label }}</div>
</div>
</div>
</div>
<div>
<div class="simulationMenu" style="width: 70px;" @click="showMenuModeList">{{ nowMode }}</div>
<div v-show="isShowModeMenuList" class="simulationMenuList" style="width: 80px;">
<div v-for="(each, index) in modeList" :key="index">
<div class="eachSimulationMenu" style="width: 70px;" :class="{'active' :nowMode === each.label}" @click="changeOperateMode(each)">{{ each.label }}</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { simulationPause, simulationStart } from '@/api/rtSimulation';
import { simulationPause, simulationStart, timesSpeedPlayback } from '@/api/rtSimulation';
import { OperateMode } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
export default {
name:'SimulationControl',
data() {
return {
pauseLoading:false,
group:''
group:'',
speed: 1,
nowMode: '普通模式',
isShowSpeedMenuList: false,
isShowModeMenuList: false,
modeList: [
{label: '故障模式', value: OperateMode.FAULT},
{label: '普通模式', value: OperateMode.NORMAL}
]
};
},
computed: {
simulationPaused() {
return this.$store.state.socket.simulationPause;
},
isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
speedList() {
return this.isAdmin ? [
{ value: 10, label: 'x10' },
{ value: 9, label: 'x9' },
{ value: 8, label: 'x8' },
{ value: 7, label: 'x7' },
{ value: 6, label: 'x6' },
{ value: 5, label: 'x5' },
{ value: 4, label: 'x4' },
{ value: 3, label: 'x3' },
{ value: 2, label: 'x2' },
{ value: 1, label: 'x1' }
] : [
{ value: 5, label: 'x5' },
{ value: 4, label: 'x4' },
{ value: 3, label: 'x3' },
{ value: 2, label: 'x2' },
{ value: 1, label: 'x1' }
];
},
project() {
return getSessionStorage('project');
},
isShowDirective() { //
return this.$route.query.type == 'CW' && this.project == 'heb';
}
},
mounted() {
this.group = this.$route.query.group;
if (this.isShowDirective) {
this.menuList.unshift({label: '指令模式', value: OperateMode.DIRECTIVE});
}
window.addEventListener('click', this.close, false);
},
beforeDestroy() {
window.removeEventListener('click', this.close);
},
methods:{
changeOperateMode(mode) {
this.nowMode = mode.label;
this.$store.dispatch('training/changeOperateMode', { mode: mode.value });
},
showMenuModeList() {
event.stopPropagation();
this.isShowModeMenuList = !this.isShowModeMenuList;
},
showMenuSpeedList(event) {
event.stopPropagation();
this.isShowSpeedMenuList = !this.isShowSpeedMenuList;
},
startOrPause() {
this.pauseLoading = true;
if (this.simulationPaused) {
@ -39,6 +113,18 @@ export default {
this.$messageBox('暂停失败,请稍后再试');
});
}
},
speedChange(val) {
timesSpeedPlayback(this.$route.query.group, val).then(resp => {
this.speed = val;
this.$message.success(`设置${val}倍速成功!`);
}).catch(e => {
this.$message.error('设置倍速失败!');
});
},
close() {
this.isShowModeMenuList = false;
this.isShowSpeedMenuList = false;
}
}
};
@ -46,12 +132,58 @@ export default {
<style lang="scss" scoped>
.simulationControlAll{
position: absolute;
bottom: 10px;
bottom: 9px;
right: 78px;
display: flex;
padding: 2px 5px;
border-radius: 5px;
align-items: center;
background: #ccc;
}
.controlButton{
font-size: 28px;
font-size: 22px;
padding: 3px;
background: #fff;
}
.simulationMenu {
width: 30px;
text-align: center;
font-size: 14px;
cursor: pointer;
border: 1px solid #000000;
border-radius: 3px;
background: #000;
color: #fbfbfb;
margin: 5px;
padding: 2px 0;
}
.simulationMenuList {
position: absolute;
right: 5px;
width: 40px;
bottom: 35px;
background: #ccc;
border-radius: 5px 5px 0 0;
font-size: 14px;
z-index: 2000;
padding: 5px;
}
.eachSimulationMenu {
text-align: center;
cursor: pointer;
position: relative;
white-space: nowrap;
margin-top: 2px;
border: 1px solid #000000;
border-radius: 3px;
background: #757171;
color: #fbfbfb;
padding: 2px 0;
}
.eachSimulationMenu:hover {
background: #000;
}
.active{
background: #000;
}
</style>

View File

@ -63,7 +63,6 @@
</template>
<script>
import {getPublishTrainingDetail, loadPublishTraining} from '@/api/jmap/training';
// import DistributeDraft from '@/views/components/limits/distribute';
import { getPostByProjectCode } from '@/api/learn';
import { getSessionStorage } from '@/utils/auth';
import { ProjectCode } from '@/scripts/ProjectConfig';
@ -75,7 +74,6 @@ import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import { clearSimulation, ranAsPlan, exitRunPlan } from '@/api/simulation';
import { getToken } from '@/utils/auth';
import { Notification } from 'element-ui';
import { PermissionType } from '@/scripts/ConstDic';
import { EventBus } from '@/scripts/event-bus';
import MemberManage from './memberManage/membersManage';
import RegisterBook from '../registerBook/index';
@ -506,12 +504,12 @@ export default {
if (this.trainingId) {
getPublishTrainingDetail(this.trainingId).then(detailResp=>{
// this.training = res.data;
if (detailResp.data.mapLocationJson) {
if (detailResp.data.mapLocationJson) {
const mapLocation = JSON.parse(detailResp.data.mapLocationJson);
this.$jlmap.updateTransform(parseInt(mapLocation.scale), {x:mapLocation.x, y:mapLocation.y});
}
if (detailResp.data.playerIdJson) {
const playerId = JSON.parse(detailResp.data.playerIdJson)[0];
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]);
@ -530,6 +528,14 @@ export default {
this.$messageBox('加载实训失败!');
});
}
},
'$store.state.training.domConfig': function(val) {
this.allMenuList.forEach(item => {
if (item.name === 'memberManage') {
item.isShow = !val.singleMember;
}
});
this.menuList = [...this.allMenuList];
}
},
mounted() {
@ -574,6 +580,18 @@ export default {
event.stopPropagation();
this.active = index;
},
handleMenuShow(domConfig) {
this.allMenuList.forEach(item => {
if (item.name === 'memberManage') {
item.isShow = !domConfig.singleMember;
} else if (item.name === 'trainingPane') {
item.isShow = domConfig.hasTraining;
} else if (item.name === 'exam') {
item.isShow = domConfig.hasExam;
}
});
this.menuList = [...this.allMenuList];
},
modifyOrDriving() {
if (this.datie) {
this.modifySysTime();
@ -1046,7 +1064,6 @@ export default {
this.$refs.runPlanView.doShow();
},
end() {
// this.loading = true;
initSimulation(this.group)
.then(() => {
this.$store.dispatch('training/over').then(() => {
@ -1057,9 +1074,6 @@ export default {
this.$store.dispatch('map/initSimulationButton');
});
});
// setTimeout(() => {
// this.loading = false;
// }, 1500);
})
.catch(() => {
this.loading = false;
@ -1104,7 +1118,7 @@ export default {
font-size: 14px;
}
.eachSimulationMenu {
padding: 9px 0px;
padding: 9px 0;
// border-bottom:1px #dedede solid;
text-align: center;
cursor: pointer;

View File

@ -197,23 +197,24 @@ export default {
EXAM: false
},
clientList: [
{ label: '中心ATS工作站', value: 'C_ATS' },
{ label: '中心ATS大屏', value: 'C_ATS_BS' },
{ label: '中心PA系统', value: 'C_PA' },
{ label: '中心视频监控系统', value: 'C_CCTV' },
{ label: '现地ATS工作站', value: 'L_ATS' },
{ label: '本地控制工作站', value: 'LCW' },
{ label: '现地视频监控系统', value: 'L_CCTV' },
{ label: '现地PA系统', value: 'L_PA' },
{ label: '调度台终端', value: 'GPC' },
{ label: '联锁工作站', value: 'IPC' },
{ label: '车务终端', value: 'STPC' },
{ label: '车务管理终端', value: 'DMP' },
{ label: 'ISCS', value: 'ISCS' },
{ label: 'IBP', value: 'IBP' },
{ label: 'PSL', value: 'PSL' },
{ label: '运行图编制', value: 'RUN_PLAN_DESIGN' },
{ label: '列车驾驶', value: 'DRIVE' }
{ label: '中心ATS工作站', value: 'dispatchWork' },
{ label: '中心ATS大屏', value: 'bigScreen' },
{ label: '现地ATS工作站', value: 'localWork' },
{ label: 'ISCS', value: 'iscsView' },
{ label: 'IBP', value: 'ibp' },
{ label: 'PSL', value: 'psl' },
{ label: '列车驾驶', value: 'drivingPlan' },
{ label: 'CCTV', value: 'cctvView' },
{ label: '设备视图', value: 'jl3dModle' },
{ label: '数字沙盘', value: 'digitalStand' },
{ label: '车务终端', value: 'trafficTerminal' },
{ label: '车务管理终端', value: 'trafficManageTerminal' },
{ label: '调度命令', value: 'dispatchingCommand' },
{ label: '调度计划', value: 'schedulingPlan' },
{ label: '大客流策略', value: 'largePassengerStrategy' },
{ label: '大客流视图', value: 'largePassengerView' },
{ label: '行调台', value: 'dispatcherManage' },
{ label: '派班工作站', value: 'scheduleWork' }
],
memberMetroList: [],
memberRailwayList: [],