Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly1

This commit is contained in:
fan 2022-12-26 10:04:06 +08:00
commit 63a09a7abc
21 changed files with 266 additions and 82 deletions

View File

@ -73,9 +73,6 @@ export default {
this.loading = false;
},
'$route': function(val) {
if (val.path == '/simulation/multiplayerSimulation') {
this.quickEntry();
}
if (val.path == '/display/demon' && val.query.client == 'diagramEdit') { //
this.loading = false;
}

View File

@ -1,6 +1,6 @@
<template>
<div class="chengdou-01__system request_box">
<div class="title-box">
<div :id="domIdRequestBar" class="title-box">
<div class="title-name">操作请求堆栈</div>
<div class="icon" :class="{'is-active': unfold}" @click="unflodDiv">
<i class="el-icon-arrow-down" />
@ -13,10 +13,10 @@
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="2" :offset="4" class="button-top">
<el-button :id="domIdConfirm" size="mini" style="float: left;" :loading="loading" :disabled="commitDisabled" @click="commit">重做</el-button>
<el-button size="mini" style="float: left;" :loading="loading" :disabled="commitDisabled" @click="commit">重做</el-button>
</el-col>
<el-col :span="2" :offset="12" class="button-top">
<el-button :id="domIdCancel" size="mini" style="float: right;" @click="cancel">撤销</el-button>
<el-button size="mini" style="float: right;" @click="cancel">撤销</el-button>
</el-col>
</el-row>
<el-row justify="center" class="button-group">
@ -57,10 +57,13 @@ export default {
'requestList'
]),
domIdConfirm() {
return OperationEvent.Signal.arrangementRoute.menu.domId;
return OperationEvent.Command.commandChengDu1.confirm.domId;
},
domIdCancel() {
return OperationEvent.Command.cancel.menu.domId;
return OperationEvent.Command.commandChengDu1.cancel.domId;
},
domIdRequestBar() {
return OperationEvent.Command.commandChengDu1.requestBar.domId;
}
},
watch: {
@ -87,6 +90,10 @@ export default {
methods: {
unflodDiv() {
this.unfold = !this.unfold;
const operate = {
operation: OperationEvent.Command.commandChengDu1.requestBar.operation
};
this.$store.dispatch('trainingNew/next', operate);
},
clickEvent(row, event, column) {
this.row = row;
@ -106,7 +113,7 @@ export default {
const eachCmd = requestList[index];
const operate = {
over: true,
operation: eachCmd.operation.code,
operation: OperationEvent.Command.commandChengDu1.confirm.operation,
cmdType: eachCmd.operation.cmdType,
param: eachCmd.operation.param //
};
@ -134,10 +141,10 @@ export default {
height: auto;
position: absolute;
bottom: 10px;
left: 50%;
left: calc(50% - 300px);
background: #fff;
z-index: 10;
transform: translateX(-300px);
// transform: translateX(-300px);
background: #518E86;
.title-box{

View File

@ -372,7 +372,7 @@ export default {
this.$store.dispatch('trainingNew/next', step).then(({ valid, response }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.guide.menu.operation, name: '引导信号', cmdType:CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE}});
this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.guide.menu.operation, name: '引导信号', cmdType:CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE, param: { signalCode: `${this.selected.code}` }}});
}
});
},
@ -392,7 +392,7 @@ export default {
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.cancelTrainRoute.menu.operation, name: '取消进路', cmdType:CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE}});
this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.cancelTrainRoute.menu.operation, name: '取消进路', cmdType:CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE, param: { signalCode: `${this.selected.code}` }}});
}
});
},
@ -411,7 +411,7 @@ export default {
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.lock.menu.operation, name: '终端信号机封锁', cmdType:CMD.Signal.CMD_SIGNAL_BLOCK}});
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.lock.menu.operation, name: '终端信号机封锁', cmdType:CMD.Signal.CMD_SIGNAL_BLOCK, param: { signalCode: `${this.selected.code}` }}});
}
}).catch(() => {
this.$refs.noticeInfo.doShow();
@ -432,7 +432,7 @@ export default {
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.unlock.menu.operation, name: '终端信号机解封', cmdType:CMD.Signal.CMD_SIGNAL_UNBLOCK}});
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.unlock.menu.operation, name: '终端信号机解封', cmdType:CMD.Signal.CMD_SIGNAL_UNBLOCK, param: { signalCode: `${this.selected.code}` }}});
}
});
},
@ -449,7 +449,7 @@ export default {
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.setAutoInterlock.menu.operation, name: '开放自动进路', cmdType:CMD.Signal.CMD_SIGNAL_SET_CI_AUTO}});
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.setAutoInterlock.menu.operation, name: '开放自动进路', cmdType:CMD.Signal.CMD_SIGNAL_SET_CI_AUTO, param: { signalCode: `${this.selected.code}` }}});
}
});
},
@ -466,7 +466,7 @@ export default {
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.cancelAutoInterlock.menu.operation, name: '关闭自动进路', cmdType:CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO}});
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.cancelAutoInterlock.menu.operation, name: '关闭自动进路', cmdType:CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO, param: { signalCode: `${this.selected.code}` }}});
}
});
},

View File

@ -203,6 +203,7 @@ export default {
lock() {
const operate = {
start: true,
code: `${this.selected.code}`,
operation: OperationEvent.Switch.lock.menu.operation,
param: {
switchCode: this.selected.code
@ -220,6 +221,7 @@ export default {
unlock() {
const operate = {
start: true,
code: `${this.selected.code}`,
operation: OperationEvent.Switch.unlock.menu.operation,
param: {
switchCode: this.selected.code
@ -237,6 +239,7 @@ export default {
locate() {
const operate = {
start: true,
code: `${this.selected.code}`,
operation: OperationEvent.Switch.locate.menu.operation,
param: {
switchCode: this.selected.code
@ -254,6 +257,7 @@ export default {
reverse() {
const operate = {
start: true,
code: `${this.selected.code}`,
operation: OperationEvent.Switch.reverse.menu.operation,
param: {
switchCode: this.selected.code

View File

@ -124,6 +124,12 @@ export default {
controlTransferList.forEach(controlTransfer=>{
this.updateTableValue(controlTransfer);
});
},
'$store.state.trainingNew.trainingSwitch': function(val) {
if (val) {
this.stationType = '01';
this.station = {};
}
}
},
methods: {
@ -176,7 +182,9 @@ export default {
this.message = '';
const operate = {
operation: OperationEvent.Command.order.choose1.operation,
val: this.stationCode
param: {
stationCode: this.stationCode
}
};
// if (this.stationType == '01') {
@ -197,7 +205,9 @@ export default {
handleChooseChangeControl() {
const operate = {
operation: OperationEvent.Command.order.choose.operation,
val: this.stationCode
param: {
stationType: this.stationType
}
};
// if (this.stationType == '01') {
@ -235,23 +245,29 @@ export default {
},
//
conterCommit() {
commitOperate(menuOperate.StationControl.requestCentralControl, {stationCodes:[this.stationCode]}, 1).then((data)=>{
commitOperate(menuOperate.StationControl.requestCentralControl, {stationCodes:[this.stationCode]}, 1).then((data) => {
if (data.valid) {
this.doClose();
this.$refs.twoConfirmation.doShow(data.operate, '确认将如下操作区域的控制模式由站控转为遥控:\n' + this.stationName);
}
});
},
//
requestCommit() {
commitOperate(menuOperate.StationControl.requestStationControl, {stationCodes:[this.stationCode]}, 1).then((data)=>{
if (data.valid) {
this.doClose();
this.$refs.twoConfirmation.doShow(data.operate, '确认将如下操作区域的控制模式由中控转为站控:\n' + this.stationName);
}
});
},
//
emergencyCommit() {
commitOperate(menuOperate.StationControl.emergencyStationControl, {stationCodes:[this.stationCode]}, 1).then((data)=>{
if (data.valid) {
this.doClose();
this.$refs.twoConfirmation.doShow(data.operate, '确认将如下操作区域的控制模式由中控转为站控:\n' + this.stationName);
}
});
}
}

View File

@ -559,7 +559,7 @@ export default {
.signal-box-title {
color: #000;
position: relative;
top: 15px;
top: 10px;
left: 5px;
width: 40px;
background: #F0F0F0;

View File

@ -344,9 +344,9 @@ export default {
this.disabledSure = true;
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
this.disabledSure = false;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
this.disabledSure = false;
});
} else if (!selection) {
this.$messageBox(this.$t('menu.menuDialog.selectData'));

View File

@ -91,6 +91,9 @@
</el-submenu>
</template>
</template>
<div v-if="helpShow" class="helpDiv" @click="goToHelp">
<span>帮助</span>
</div>
<el-submenu v-if="!thirdLogin" :key="99" index="/info" :show-timeout="100">
<span slot="title">{{ username }}</span>
<el-menu-item :key="991" index="/info/personalInfo">个人信息</el-menu-item>
@ -141,6 +144,9 @@ export default {
},
isCGY() {
return getSessionStorage('project') === 'cgy';
},
helpShow() {
return this.$store.state.projectConfig.helpShow;
}
},
watch: {
@ -154,7 +160,9 @@ export default {
},
mounted() {
this.routes = this.$router.options.routes;
if (this.$route.fullPath.indexOf('design/usermap') >= 0) {
if (this.$route.fullPath.includes('/trainingPlatform/simulation')) {
this.activePath = '/simulation/simulationIndex';
} else if (this.$route.fullPath.indexOf('design/usermap') >= 0) {
this.activePath = '/design/usermap/home';
} else if (this.$route.fullPath.includes('design/lesson') || this.$route.fullPath.includes('design/script') || this.$route.fullPath.includes('design/runPlan') || this.$route.fullPath.includes('design/mapPreview')) {
this.activePath = '/design/home';
@ -163,6 +171,11 @@ export default {
}
},
methods: {
goToHelp() {
let href = '';
href = this.$store.state.user.baseSite + '/docs/';
window.open(href, '_blank');
},
toggleSideBar() {
this.$store.dispatch('ToggleSideBar');
},
@ -269,4 +282,15 @@ export default {
.targetDiv :hover {
background-color: #434A50;
}
.helpDiv {
height: 60px;
line-height: 60px;
color: #fff;
font-size: 14px;
cursor: pointer;
padding: 0 20px;
&:hover {
background-color: #434A50;
}
}
</style>

View File

@ -43,8 +43,8 @@ function handleRoute(to, next, loginPath) {
if (store.getters.roles.length == 0) {
store.dispatch('GetInfo', getToken()).then(res => {
// 根据roles权限生成可访问的路由表
const roles = res.roles;
store.dispatch('GenerateRoutes', { roles }).then(() => {
// const roles = res.roles;
store.dispatch('GenerateRoutes', res).then(() => {
router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
if (to.redirectedFrom) {
next({ path: to.redirectedFrom, replace: true });
@ -113,7 +113,7 @@ router.beforeEach( async (to, from, next) => {
// }
const response = await getFrontProjectConfigByLogin(project);
if (response.data) {
const {browserTitle, loginProLogo, baseApiUrl, baseSite, caseShow, ossUrl, homeTitle, homeProLogoWidth} = response.data.viewSetting;
const {browserTitle, loginProLogo, baseApiUrl, baseSite, caseShow, helpShow, ossUrl, homeTitle, homeProLogoWidth} = response.data.viewSetting;
if (!store.state.user.baseUrl && project) {
const urlData = handlerUrl();
store.dispatch('setBaseUrl', baseApiUrl || urlData.BASE_API);
@ -125,6 +125,7 @@ router.beforeEach( async (to, from, next) => {
const url = loginProLogo ? store.state.user.ossUrl + '/logo/' + loginProLogo : '';
document.querySelector("link[rel*='icon']").href = url;
store.commit('setCaseShow', caseShow);
store.commit('setHelpShow', helpShow);
store.dispatch('setHomeProLogoWidth', homeProLogoWidth);
store.dispatch('setLoginProLogo', url);
store.dispatch('setHomeTitle', homeTitle);

View File

@ -751,6 +751,7 @@ export const asyncRouter = [
meta: {
roles: [admin, user]
},
hidden: true,
children: [
{
path: '',
@ -941,6 +942,7 @@ export const asyncRouter = [
i18n: 'router.pulishManage',
roles: [admin]
},
hidden: true,
children: [
{ // 发布地图
path: 'map',
@ -1041,6 +1043,7 @@ export const asyncRouter = [
i18n: 'router.orderAuthorityManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'author/manage',
@ -1112,6 +1115,7 @@ export const asyncRouter = [
i18n: 'router.systemManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'dictionary',
@ -1323,6 +1327,7 @@ export const asyncRouter = [
i18n: 'router.fileManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'list',
@ -1399,6 +1404,7 @@ export const asyncRouter = [
i18n: 'router.newDesignUserPage',
roles: [admin, user]
},
hidden: true,
children: [
{
path: 'usermap',
@ -1505,6 +1511,7 @@ export const asyncRouter = [
i18n: 'router.raceManage',
roles: [admin]
},
hidden: true,
children: [
{
path: 'bank',
@ -1549,7 +1556,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.simulation',
roles: [admin, user, userTrainingPlatform]
roles: [user]
},
children: [
{ // 仿真
@ -1578,6 +1585,7 @@ export const asyncRouter = [
{ // 监管仿真
path: 'regulationSimulation',
component: ExistingSimulation,
companyAdmin: true,
meta: {
i18n: 'newRouter.regulationSimulation'
}
@ -1587,9 +1595,10 @@ export const asyncRouter = [
{ // 新路由-教学管理菜单
path: '/teaching',
component: Layout,
companyAdmin: true,
meta: {
i18n: 'newRouter.teachingManagement',
roles: [admin, user, userTrainingPlatform]
roles: [admin, user]
},
children: [
{
@ -1756,7 +1765,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.lineDesign',
roles: [admin, user, userTrainingPlatform]
roles: [admin, mapCreater]
},
children: [
{
@ -1793,7 +1802,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.case',
roles: [admin, user, userTrainingPlatform]
roles: [admin, user]
},
children: [
{
@ -1827,7 +1836,7 @@ export const asyncRouter = [
component: Layout,
meta: {
i18n: 'newRouter.SystemManagement',
roles: [admin, userTrainingPlatform]
roles: [admin]
},
children: [
{ // 系统数据管理

View File

@ -471,11 +471,11 @@ export const OperationEvent = {
// 进路
line_signal_route: {
operation: '00a23',
domId: '_Tips-ningBo-line-signal-cmd{TOP}'
domId: '_Tips-ningBo-line-signal-route{TOP}'
},
line_signal_route_cmd: {
operation: '00a231',
domId: '_Tips-ningBo-line-signal-cmd{TOP}'
domId: '_Tips-ningBo-line-signal-route-cmd{TOP}'
},
line_signal_route_show: {
operation: '00a232',
@ -730,6 +730,21 @@ export const OperationEvent = {
operation: '00c8',
domId: '_Tips-ningBo1-areaSelection-doClose'
}
},
// 成都一
commandChengDu1: {
confirm: {
operation: '00d',
domId: '_Tips-commandChengDu1-confirm{BOTTOM}'
},
cancel: {
operation: '00d1',
domId: '_Tips-commandChengDu1-cancel{BOTTOM}'
},
requestBar: {
operation: '00d2',
domId: '_Tips-commandChengDu1-requestBar{BOTTOM}'
}
}
},
// 站台概要表

View File

@ -20,6 +20,7 @@ import rpTools from './modules/rpTools';
import race from './modules/race';
import trainingNew from './modules/trainingNew';
import projectConfig from './modules/projectConfig';
import lineList from './modules/lineList';
import getters from './getters';
@ -46,7 +47,8 @@ const store = new Vuex.Store({
rpTools,
race,
trainingNew,
projectConfig
projectConfig,
lineList
},
getters
});

View File

@ -0,0 +1,23 @@
const lineList = {
namespaced: true,
state: {
lineList: [] // 线路列表
},
mutations: {
setLineList: (state, lineList) => {
if (lineList && lineList.length) {
state.lineList = lineList;
} else {
state.lineList = [];
}
}
},
actions: {
setLineList({ commit }, lineList) {
commit('setLineList', lineList);
}
}
};
export default lineList;

View File

@ -3,6 +3,7 @@ import { publicAsyncRoute, asyncRouter, constantRoutes, user, projectTrain, proj
projectSrsandbox, projectJxgm, projectSay, projectRichorhhcj, projectTeaching } from '@/router/index';
import { loginInfo } from '@/scripts/ProjectConfig';
import { getSessionStorage } from '@/utils/auth';
import store from '@/store/index';
/**
* 通过meta.role判断是否与当前用户权限匹配及子系统生成
@ -13,6 +14,9 @@ function hasPermission(roles, route, parentsRoles) {
if (!getSessionStorage('project')) {
return false;
}
if (route.companyAdmin) { // 判断有没有组织角色(管理员,教师)
return store.state.permission.companyAdmin || roles.includes(admin);
}
if (route.meta && route.meta.roles) {
// 如果存在本级路由则使用自己的roles过滤
if (getSessionStorage('project').startsWith('design') || getSessionStorage('project').startsWith('refereeJsxt')) {
@ -20,7 +24,8 @@ function hasPermission(roles, route, parentsRoles) {
return result.length && route.meta.roles.indexOf(userTrainingPlatform) < 0;
} else {
roles = roles.filter((role) => route.meta.roles.indexOf(role) >= 0);
return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0;
// return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0;
return roles.some(role => route.meta.roles.indexOf(role) >= 0);
}
} else if (parentsRoles) {
// 如果没有本级路由,有父级路由,则使用父级路由过滤
@ -84,19 +89,24 @@ function filterAsyncRouter(asyncRouter, roles, parentsRoles) {
const permission = {
state: {
routes: constantRoutes,
addRouters: []
addRouters: [],
companyAdmin: false
},
mutations: {
SET_ROUTERS: (state, routes) => {
state.addRouters = routes;
state.routes = constantRoutes.concat(routes);
},
SET_COMANYADMIN: (state, companyAdmin) => {
state.companyAdmin = companyAdmin;
}
},
actions: {
// 生成其他权限路由
GenerateRoutes({ commit, rootState }, data) {
return new Promise(resolve => {
const { roles } = data;
const { roles, companyAdmin } = data;
commit('SET_COMANYADMIN', companyAdmin);
if (roles.includes(superAdmin) && !roles.includes(admin)) { // 只拥有超级管理员 没有管理员权限
roles.push(admin);
}

View File

@ -3,7 +3,8 @@ const user = {
homeProLogoWidth:0,
loginProLogo:'',
homeTitle:'',
caseShow:true
caseShow: true,
helpShow: true
},
mutations: {
setHomeProLogoWidth: (state, homeProLogoWidth) => {
@ -17,6 +18,9 @@ const user = {
},
setCaseShow: (state, caseShow) => {
state.caseShow = caseShow;
},
setHelpShow: (state, helpShow) => {
state.helpShow = helpShow;
}
},
actions: {
@ -31,6 +35,9 @@ const user = {
},
setCaseShow({ commit }, caseShow) {
commit('setCaseShow', caseShow);
},
setHelpShow({ commit }, helpShow) {
commit('setHelpShow', helpShow);
}
}
};

View File

@ -272,21 +272,32 @@ export default {
getLoginInfo(getToken()).then(resp => {
const deviceVO = resp.data.deviceVO;
if (deviceVO) {
const config = JSON.parse(deviceVO.config);
const config = JSON.parse(deviceVO.config || '{}');
if (config && config.roleCode) {
const params = [{userId: res.id, memberId:config.roleCode}];
assignUsersPlayRoles(params, group).then(() => {
this.enterSimulation(group, mapId, config);
}).catch(res=>{
this.$message.error('切换角色失败');
this.$store.dispatch('LogOut');
});
}
}
}).catch(res=>{
this.$message.error('获取用户信息失败');
this.$store.dispatch('LogOut');
});
}).catch(res=>{
this.$store.dispatch('LogOut');
});
} else {
this.$message.error('请先配置项目信息');
this.$store.dispatch('LogOut');
}
}
}).catch(res=>{
this.$message.error('获取项目信息失败');
this.$store.dispatch('LogOut');
});
},
enterSimulation(group, mapId, config) {
@ -317,6 +328,8 @@ export default {
// if (config.client) { query.client = config.client; }
}
this.$router.push({ path: `/display/demon`, query: query });
}).catch(res=>{
this.$store.dispatch('LogOut');
});
}
}

View File

@ -245,24 +245,35 @@ export default {
createSimulation(functionId).then(resp => {
const group = resp.data;
this.assignUser(group, mapId);
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
this.$store.dispatch('LogOut').then(() => {
location.reload(); // vue-router bug
});
} else {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.$store.dispatch('LogOut').then(() => {
location.reload(); // vue-router bug
});
}
});
} else {
getGroupByMapAndFunction(mapId, functionId).then(resp => {
const group = resp.data;
this.assignUser(group, mapId);
}).catch(res=>{
this.$store.dispatch('LogOut');
});
}
} else {
this.$message.error('请先配置项目信息');
this.$store.dispatch('LogOut');
}
}
}).catch(res=>{
this.$message.error('获取项目信息失败');
this.$store.dispatch('LogOut');
});
},
assignUser(group, mapId) {
@ -270,17 +281,25 @@ export default {
getLoginInfo(getToken()).then(resp => {
const deviceVO = resp.data.deviceVO;
if (deviceVO) {
const config = JSON.parse(deviceVO.config || {});
const config = JSON.parse(deviceVO.config || '{}');
if (config && config.roleCode) {
const params = [{userId: res.id, memberId:config.roleCode}];
assignUsersPlayRoles(params, group).then(() => {
this.enterSimulation(group, mapId, config);
}).catch(res=>{
this.$message.error('切换角色失败');
this.$store.dispatch('LogOut');
});
} else {
this.$message.error('请先配置设备相关信息');
this.$store.dispatch('LogOut');
}
} else {
this.enterSimulation(group, mapId);
}
}).catch(res=>{
this.$message.error('获取用户信息失败');
this.$store.dispatch('LogOut');
});
});
},
@ -301,6 +320,9 @@ export default {
// if (config.client) { query.client = config.client; }
}
this.$router.push({ path: `/display/demon`, query: query });
}).catch(res=>{
this.$message.error('进入仿真失败');
this.$store.dispatch('LogOut');
});
},
//

View File

@ -59,7 +59,7 @@ export default {
operationType: val.cmdType ? val.cmdType.value : '',
params: val.param || {}
};
if (['trainSetButton'].includes(val.subType)) {
if (['trainSetButton', 'light'].includes(val.subType)) {
data.subType = val.subType;
}
this.stepDetail.operations.push(data);
@ -118,6 +118,9 @@ export default {
this.stepDetail.tipPosition.domId = this.stepDetail.operations[this.tagIndex].domId;
this.stepDetail.tipPosition.deviceCode = this.stepDetail.operations[this.tagIndex].deviceCode;
this.stepDetail.tipPosition.operateIndex = this.tagIndex;
if (this.stepDetail.operations[this.tagIndex].subType) {
this.stepDetail.tipPosition.subType = this.stepDetail.operations[this.tagIndex].subType;
}
}
this.$emit('backDesignPane');
this.tagIndex = 0;

View File

@ -14,11 +14,10 @@
class="el-menu-vertical-demo"
background-color="#545c64"
text-color="#fff"
router
active-text-color="#ffd04b"
>
<template v-for="(map, mapIndex) in mapList">
<el-menu-item v-show="map.name.includes(filterText)" :key="mapIndex" :index="'/trainingPlatform/simulation/' + map.id + '?lineCode=' + map.lineCode">
<el-menu-item v-show="map.name.includes(filterText)" :key="mapIndex" :index="map.id" @click="gotoPath(map)">
{{ map.name }}
</el-menu-item>
</template>
@ -28,7 +27,7 @@
</template>
<script>
import {queryMapListByUser} from '../../api/jmap/map';
import { EventBus } from '@/scripts/event-bus';
// import { EventBus } from '@/scripts/event-bus';
export default {
name: 'DemonList',
components: {
@ -41,19 +40,31 @@ export default {
defaultIndex: ''
};
},
watch: {
'$route': function(val) {
if (this.mapList && this.mapList.length && this.$route.path.includes('simulation/simulationIndex')) { //
const map = this.mapList[0];
this.gotoPath(map, true);
}
this.defaultIndex = this.$route.params.mapId;
}
},
mounted() {
this.mapList = [];
this.loading = true;
queryMapListByUser().then(resp => {
this.mapList = resp.data;
EventBus.$emit('setMapList', this.mapList);
// EventBus.$emit('setMapList', this.mapList);
this.$store.dispatch('lineList/setLineList', this.mapList);
if (this.mapList && this.mapList.length && this.$route.path.includes('simulation/simulationIndex')) {
const map = this.mapList[0];
const path = `/trainingPlatform/simulation/${map.id}?lineCode=${map.lineCode}`;
this.defaultIndex = path;
this.$router.push(path);
// const path = `/trainingPlatform/simulation/${map.id}?lineCode=${map.lineCode}`;
// this.defaultIndex = path;
// this.$router.push(path);
this.gotoPath(map);
} else if (this.$route.params.mapId) {
this.defaultIndex = this.$route.fullPath;
// this.defaultIndex = this.$route.fullPath;
this.defaultIndex = this.$route.params.mapId;
}
this.loading = false;
}).catch(e => {
@ -62,6 +73,15 @@ export default {
});
},
methods: {
gotoPath(map, isReplace) {
const path = `/trainingPlatform/simulation/${map.id}?lineCode=${map.lineCode}`;
this.defaultIndex = map.id;
if (isReplace) {
this.$router.replace(path);
} else {
this.$router.push(path);
}
}
}
};
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="trainingPlatform" :style="'padding-left:'+(widthLeft)+'px'">
<div class="trainingPubMapList" :style="{width: widthLeft+'px'}">
<demon-list ref="demonList" @goRoutePath="goRoutePath" />
<demon-list ref="demonList" />
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
</div>
<transition>
@ -14,7 +14,7 @@
import demonList from './demonList';
import drapLeft from '@/views/components/drapLeft/index';
import localStore from 'storejs';
import { getSessionStorage, setSessionStorage } from '@/utils/auth';
// import { getSessionStorage, setSessionStorage } from '@/utils/auth';
export default {
name: 'TrainingPlatform',
@ -38,14 +38,14 @@ export default {
methods: {
drapWidth(width) {
this.widthLeft = Number(width);
},
goRoutePath(data) {
const againEnter = getSessionStorage('againEnter') || null;
if (!againEnter && !this.$route.query.thirdJump) {
this.$router.push(`/trainingPlatform/simulation/${data[0].id}?lineCode=${data[0].lineCode}`);
setSessionStorage('againEnter', true);
}
}
// goRoutePath(data) {
// const againEnter = getSessionStorage('againEnter') || null;
// if (!againEnter && !this.$route.query.thirdJump) {
// this.$router.push(`/trainingPlatform/simulation/${data[0].id}?lineCode=${data[0].lineCode}`);
// setSessionStorage('againEnter', true);
// }
// }
}
};
</script>

View File

@ -42,7 +42,7 @@ import { launchFullscreen } from '@/utils/screen';
import { createSimulation } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth';
import { jointSimulationByPermission } from '@/api/jointSimulation';
import { EventBus } from '@/scripts/event-bus';
// import { EventBus } from '@/scripts/event-bus';
export default {
name: 'Simulation',
components: {
@ -52,13 +52,13 @@ export default {
return {
loading: false,
param: '',
mapName: '',
// mapName: '',
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts', 'hlsdrts', 'designhlsdrts', 'teaching', 'designteaching'],
activeName: 'first',
WhetherTypeList: [],
activeNames: ['1', '2'],
systemList: [],
mapList: [],
// mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -192,22 +192,33 @@ export default {
computed: {
project() {
return getSessionStorage('project');
},
mapList() {
return this.$store.state.lineList.lineList;
},
mapName() {
let name = '';
const map = this.mapList.find(map => map.id === this.$route.params.mapId);
if (map) {
name = map.name;
}
return name;
}
},
watch: {
'$route.params.mapId': function (val) {
this.$refs.queryListPage.refresh(true);
this.initMapSystem();
this.initMapSystem(true);
}
},
mounted() {
EventBus.$on('setMapList', (mapList) => {
this.mapList = mapList;
const map = this.mapList.find(map => map.id === this.$route.params.mapId);
if (map) {
this.mapName = map.name;
}
});
// EventBus.$on('setMapList', (mapList) => {
// this.mapList = mapList;
// const map = this.mapList.find(map => map.id === this.$route.params.mapId);
// if (map) {
// this.mapName = map.name;
// }
// });
this.loadInitData();
this.initMapSystem();
},
@ -223,10 +234,10 @@ export default {
this.$refs.selectRole.doShow(row.id);
},
initMapSystem() {
const map = this.mapList.find(map => map.id === this.$route.params.mapId);
if (map) {
this.mapName = map.name;
}
// const map = this.mapList.find(map => map.id === this.$route.params.mapId);
// if (map) {
// this.mapName = map.name;
// }
queryMapFunctionList({mapId: this.$route.params.mapId}).then(resp => {
this.systemList = resp.data;
console.log(resp);