大铁仿真调整

This commit is contained in:
fan 2021-04-23 09:01:12 +08:00
parent 38199d0606
commit 7379945c42
14 changed files with 338 additions and 153 deletions

44
src/api/rtSimulation.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request';
/** 创建仿真 */
export function createSimulation(data) {
return request({
url: `/rtSimulation?mapId=${data.mapId}&prdType=${data.prdType}`,
method: 'post'
});
}
/** 根据仿真group获取仿真基础信息 */
export function getSimulationInfoByGroup(groupId) {
return request({
url: `/rtSimulation/${groupId}`,
method: 'get'
});
}
/** 根据仿真group获取仿真地图数据 */
export function getMapDataByGroup(groupId) {
return request({
url: `/rtSimulation/${groupId}/mapData`,
method: 'get'
});
}
/** 仿真发送指令 */
export function sendSimulationCommand(group, memberId, type, data) {
return request({
url: `/common/simulation/${group}/member/${memberId}/operate/${type}`,
method: 'post',
data
});
}
/** 获取仿真成员列表 */
export function getMemberListCommon(group) {
return request({
url: `/common/simulation/${group}/members`,
method: 'get'
});
}
/** 获取仿真用户列表 */
export function getUserListCommon(group) {
return request({
url: `/common/simulation/${group}/users`,
method: 'get'
});
}

View File

@ -15,6 +15,13 @@ export function generateMapSystem(mapId) {
method: 'post'
});
}
/** 生成指定子系统 */
export function generateAppointMapSystem(mapId, prdType) {
return request({
url: `/api/mapSystem/generate/${mapId}/${prdType}`,
method: 'post'
});
}
/** 查询子系统信息 */
export function getSubSystemInfo(id) {
return request({

View File

@ -1,106 +1,99 @@
<template>
<div v-if="isShowBtn" id="menuButtons_box" class="menu menuButton" style="height: 45px;" :style="{left: point.x+'px', bottom: point.y+'px' }">
<div v-if="isShowBtn" id="menuButtons_box" class="menu menuButton" style="height: 35px;" :style="{left: point.x+'px', bottom: point.y+'px' }">
<button :id="Signal.arrangementRoute.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.arrangementRoute.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<span style="color: #800000">
<center><b>X引导总锁</b></center>
</span>
</button>
<button :id="MixinCommand.totalCancel.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.totalCancel.button.operation, ['Signal','AutoTurnBack','AutomaticRoute'])">
<span style="color: black">
<center><b></b></center>
<center><b></b><b></b></center>
<span style="color: #800000">
<center><b>坡道解锁</b></center>
</span>
</button>
<button :id="Signal.guide.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.guide.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<center><b>总取消</b></center>
</span>
</button>
<!-- 流程未做暂不显示 -->
<button :id="Station.guideLock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Station.guideLock.button.operation, ['GuideLock'])">
<span style="color: #800000">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<center><b>总人解</b></center>
</span>
</button>
<button :id="Signal.humanTrainRoute.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.humanTrainRoute.button.operation, ['Signal'])">
<span style="color: #800000">
<center><b></b></center>
<center><b></b><b></b></center>
<center><b>区故解</b></center>
</span>
</button>
<button :id="Section.fault.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Section.fault.button.operation, ['Section'])">
<span style="color: #800000">
<center><b></b></center>
<center><b></b><b></b></center>
</span>
</button>
<button :id="Switch.locate.button.domId" class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown(Switch.locate.button.operation, ['Switch'])">
<button :id="Switch.locate.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.locate.button.operation, ['Switch'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<center><b>总定位</b></center>
</span>
</button>
<button :id="Switch.reverse.button.domId" class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown(Switch.reverse.button.operation, ['Switch'])">
<span style="color: black">
<center><b>总反位</b></center>
</span>
</button>
<button :id="Switch.reverse.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.reverse.button.operation, ['Switch'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<center><b>清除</b></center>
</span>
</button>
<button :id="Switch.lock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.lock.button.operation, ['Switch'])">
<span style="color: black">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<center><b>单锁</b></center>
</span>
</button>
<button :id="Switch.unlock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Switch.unlock.button.operation, ['Switch'])">
<span style="color: #800000">
<center><b></b><b></b></center>
<center><b></b><b></b></center>
<span style="color: black">
<center><b>单解</b></center>
</span>
</button>
<button :id="MixinCommand.block.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.block.button.operation, ['Switch', 'Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b></center>
<center><b>按钮封锁</b></center>
</span>
</button>
<button :id="MixinCommand.unblock.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.unblock.button.operation, ['Switch', 'Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b></center>
<center><b>按钮解封</b></center>
</span>
</button>
<button :id="MixinCommand.functionButton.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(MixinCommand.functionButton.button.operation, ['StationStand', 'AutoTurnBack', 'AutomaticRoute', 'Station'])">
<span style="color: black">
<center>
<b style="color:#4B4B99"></b>
<b style="color:#943E3E"></b>
</center>
<center>
<b style="color:#E64BE6"></b>
<b style="color:#4C994C"></b>
</center>
<center><b>道岔封锁</b></center>
</span>
</button>
<button :id="Signal.atsAutoControl.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.atsAutoControl.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b><b></b></center>
<center><b>道岔解封</b></center>
</span>
</button>
<button :id="Signal.humanControl.button.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Signal.humanControl.button.operation, ['Signal'])">
<span style="color: black">
<center><b></b></center>
<center><b></b><b></b></center>
<span style="color: #800000">
<center><b>S引导总锁</b></center>
</span>
</button>
<button :id="Command.cancel.clearMbm.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Command.cancel.clearMbm.operation)">
<span style="color: #800000">
<center><b>上电解锁</b></center>
</span>
</button>
<button class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown()">
<span style="color: black">
<center><b></b></center>
<center><b></b></center>
<center><b>辅助菜单</b></center>
</span>
</button>
<button class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown()">
<span style="color: #800000">
<center><b>分路不良</b></center>
</span>
</button>
<button class="button_box" :style="{width: width+'px',backgroundColor:buttonUpColor}" @click="buttonDown()">
<span style="color: black">
<center><b>标记窗</b></center>
</span>
</button>
<password-box ref="password" @checkOver="passWordCommit" @checkCancel="checkCancel" />
@ -129,18 +122,19 @@ export default {
return {
point: {
x: 0,
y: 15
y: 0
},
operation: '0',
buttonName: '',
buttonDownColor: '#A8A8A8',
buttonUpColor: '#DCDCDC',
width: 58,
width: 78,
tempData: null,
offset: {},
commandTypeList: [],
cmdTypeList: [],
deviceList: []
deviceList: [],
timer: null
};
},
computed: {
@ -222,7 +216,7 @@ export default {
methods: {
passWordCommit(data) {
let operate = {};
if (data.overNext) {
if (data.overNext) {
operate = {
over: true,
code: data.code,
@ -307,6 +301,9 @@ export default {
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
this.timer = setTimeout(() => {
this.clearOperate();
}, 15000);
this.$store.dispatch('training/emitTipFresh');
}
});
@ -538,7 +535,7 @@ export default {
this.deviceList = [];
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate['operateNext'] = this.Command.close.password.operation;
operate['operation'] = this.Command.close.password.operation;
operate['operation'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
}).catch((error) => {
@ -550,7 +547,7 @@ export default {
const operate = {
over: true,
code: deviceList[1].code,
cmdType: this.cmdType,
cmdType: this.cmdType,
operation: this.$store.state.menuOperation.buttonOperation,
overNext: true
};
@ -575,8 +572,8 @@ export default {
handleTotalHumanSolution(model) {
const operate = {
send: true,
overNext: true,
code: model.code,
overNext: true,
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation
};
@ -588,7 +585,7 @@ export default {
} else {
operate.cmdType = CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE;
operate.param = {signalCode: model.code};
operate.val = model.code;
operate.val = model.code;
this.deviceList = [];
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => {
console.error(error);
@ -623,11 +620,12 @@ export default {
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
cmdType: this.cmdType,
param: { switchCode: model.code}
param: { id: model.code}
};
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => {
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => { this.clearOperate(); }).catch((error) => {
console.error(error);
this.$refs.noticeInfo.doShow();
});
},
handelBlockOrUnblock(model) {
@ -695,7 +693,6 @@ export default {
if (this.$store.state.training.prdType != '01') {
return '';
}
const buttonOperation = this.$store.state.menuOperation.buttonOperation;
const model = this.$store.state.menuOperation.selected; //
const subType = this.$store.state.menuOperation.subType; //
@ -708,43 +705,41 @@ export default {
} else {
const station = this.$store.getters['map/getDeviceByCode'](model.stationCode);
if (station) {
if (station.controlMode == 'Local' || station.controlMode == 'Emergency') {
if (buttonOperation && this.commandTypeList.includes(model._type)) {
this.deviceList.push(model);
if (buttonOperation === this.Signal.arrangementRoute.button.operation) {
this.arrangementRouteOperation(this.deviceList);
} else if (buttonOperation === this.MixinCommand.totalCancel.button.operation) {
this.handelTotalCancel(model, subType);
} else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) {
this.handleTotalHumanSolution(model);
} else if (buttonOperation === this.Signal.guide.button.operation) {
this.handleGuideRoute(this.deviceList);
} else if (buttonOperation === this.Signal.atsAutoControl.button.operation || buttonOperation === this.Signal.humanControl.button.operation) {
this.handelControlRoute(model);
} else if (switchOperation.includes(buttonOperation)) {
this.handelSwitchOperate(model);
} else if (buttonOperation === this.MixinCommand.block.button.operation || buttonOperation === this.MixinCommand.unblock.button.operation) {
this.handelBlockOrUnblock(model);
} else if (buttonOperation === this.Station.guideLock.button.operation) {
this.handelGuideLock(model);
} else if (buttonOperation === this.Section.fault.button.operation) {
this.handelFaultSection(model);
} else {
this.clearOperate();
}
if (buttonOperation && this.commandTypeList.includes(model._type)) {
this.deviceList.push(model);
if (buttonOperation === this.Signal.arrangementRoute.button.operation) {
this.arrangementRouteOperation(this.deviceList);
} else if (buttonOperation === this.MixinCommand.totalCancel.button.operation) {
this.handelTotalCancel(model, subType);
} else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) {
this.handleTotalHumanSolution(model);
} else if (buttonOperation === this.Signal.guide.button.operation) {
this.handleGuideRoute(this.deviceList);
} else if (buttonOperation === this.Signal.atsAutoControl.button.operation || buttonOperation === this.Signal.humanControl.button.operation) {
this.handelControlRoute(model);
} else if (switchOperation.includes(buttonOperation)) {
this.handelSwitchOperate(model);
} else if (buttonOperation === this.MixinCommand.block.button.operation || buttonOperation === this.MixinCommand.unblock.button.operation) {
this.handelBlockOrUnblock(model);
} else if (buttonOperation === this.Station.guideLock.button.operation) {
this.handelGuideLock(model);
} else if (buttonOperation === this.Section.fault.button.operation) {
this.handelFaultSection(model);
} else {
this.clearOperate();
}
} else {
this.clearOperate();
this.operatemode != OperateMode.FAULT && this.$message.info('请先切换到站控或紧急站控');
}
}
}
if (this.timer) {
clearTimeout(this.timer);
}
},
clearOperate() {
Handler.clear(); //
this.deviceList = [];
this.deviceList = [];
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
}
@ -756,6 +751,8 @@ export default {
.button_box{
display: block;
float: left;
font-size: 13px;
height: 35px;
}
.menu {
background-color: $bg;

View File

@ -1,5 +1,7 @@
import { sendCommandNew } from '@/api/jmap/training';
import { sendSimulationCommand } from '@/api/rtSimulation';
import router from '@/router/index';
import store from '@/store/index';
import Command from './Command';
import Handler from './Handler';
@ -96,11 +98,22 @@ class CommandHandle {
execute(id, command) {
return new Promise((resolve, reject) => {
const group = router.currentRoute.query.group;
sendCommandNew(group, id, command).then((response) => {
resolve(response);
}).catch(error => {
reject(error);
});
const newApi = router.currentRoute.query.newApi;
if (newApi) {
const userInfo = store.state.training.simulationUserList.find(el => el.id == store.state.user.id);
sendSimulationCommand(group, userInfo.memberId, id, command).then((response) => {
resolve(response);
}).catch(error => {
reject(error);
});
} else {
sendCommandNew(group, id, command).then((response) => {
resolve(response);
}).catch(error => {
reject(error);
});
}
});
}

View File

@ -1,6 +1,13 @@
import store from '@/store/index';
import { Notification } from 'element-ui';
function handleSockInfo(state, msg, type) {
switch (type) {
case 'ats':
state.deviceStateMessages = msg;
break;
}
}
function handle(state, data) {
// console.log(data, 'socket订阅');
const msg = data.body;
@ -305,7 +312,8 @@ const socket = {
LPFstrategy:[], // 北交大 大客流 推荐策略
isFirst:false, // 第一次是否已经订阅
competitionPracticeFinish:0, // 竞赛场景结束标识
simulationAlarmInfo: [] // 仿真报警信息
simulationAlarmInfo: [], // 仿真报警信息
deviceStateMessages: {} // 新版订阅设备状态消息
},
getters: {
},
@ -326,6 +334,10 @@ const socket = {
state.equipmentStatus = equipmentStatus;
},
setDeviceStateMessages: (state, deviceStateMessages) => {
state.deviceStateMessages = deviceStateMessages;
},
setTrainStationList: (state, trainStationList) => {
state.trainStationList = trainStationList;
},
@ -379,7 +391,9 @@ const socket = {
setStomp: ({ state }, res) => {
handle(state, res);
},
handleSock: ({ state }, res, type) => {
handleSockInfo(state, res, type);
},
setChatContent: ({ commit }, chatContent) => {
commit('setChatContent', chatContent);
},
@ -396,6 +410,10 @@ const socket = {
commit('setEquipmentStatus', []);
},
setDeviceStateMessages: ({ commit }) => {
commit('setDeviceStateMessages', {});
},
setTrainStationList: ({ commit }) => {
commit('setTrainStationList', []);
},

View File

@ -532,7 +532,10 @@ const training = {
updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapState', deviceStatus);
},
/** 新版状态 更新地图设备状态数据 */
updateMapState: ({ commit }, deviceStatus) => {
commit('updateMapStateNew', deviceStatus);
},
/**
* 开始教学模式
*/

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// 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.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.169:9000'; // 旭强
// BASE_API = 'http://192.168.3.203:9000'; // 张赛
BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

30
src/utils/parseStatus.js Normal file
View File

@ -0,0 +1,30 @@
import store from '@/store/index';
import deviceType from '@/jmapNew/constant/deviceType';
export default function parsetStatus(deviceStatus) {
const msgList = [];
(deviceStatus.switchList || []).forEach(msg => {
const elem = {};
elem.code = msg[0];
elem.deviceType = deviceType.Switch;
switch (msg[1]) {
case 0:
elem.normalPosition = 0;
elem.reversePosition = 0;
break;
case 1:
elem.normalPosition = 1;
elem.reversePosition = 0;
break;
case 2:
elem.normalPosition = 0;
elem.reversePosition = 1;
break;
case 4:
elem.normalPosition = 0;
elem.reversePosition = 0;
break;
}
msgList.push(elem);
});
return msgList;
}

View File

@ -20,13 +20,15 @@ export function creatSubscribe(topic, header) {
console.error('websocket订阅失败');
}
}
// 回调函数
function callback(Response) {
if (store) {
var data = JSON.parse(Response.body);
// console.log(Response.body);
store.dispatch('socket/setStomp', data);
if (Response.headers.destination.includes('ats')) {
store.dispatch('socket/handleSock', Response.body, 'ats');
} else {
const data = JSON.parse(Response.body);
store.dispatch('socket/setStomp', data);
}
} else {
callback(Response);
}

View File

@ -27,6 +27,7 @@ import { getGoodsTryUse } from '@/api/management/goods';
import { PermissionType, UrlConfig } from '@/scripts/ConstDic';
import { launchFullscreen } from '@/utils/screen';
import { createSimulationNew } from '@/api/simulation';
import { createSimulation } from '@/api/rtSimulation';
import LimitList from '@/views/components/limits/index';
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { getSessionStorage } from '@/utils/auth';
@ -42,6 +43,7 @@ export default {
tryTime: 0,
goodsId: '',
tryUser: 0,
newApi: false,
loading: false,
disabled: false,
currentPrdType: '',
@ -131,6 +133,7 @@ export default {
pmsList: resp.data.permissionList || [],
PermissionType: PermissionType.SIMULATION
};
this.newApi = resp.data.newApi;
this.currentPrdType = resp.data.prdType;
if (!this.courseModel.pmsList) {
this.tryUser = 1;
@ -222,22 +225,42 @@ export default {
jumpSimulation() {
this.disabled = true;
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
} else {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
}
this.disabled = false;
});
if (this.newApi) {
createSimulation(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project, newApi: this.newApi };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `/displayCity/demon`, query: query });
launchFullscreen();
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
} else {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
}
this.disabled = false;
});
} else {
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project, newApi: this.newApi };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
}).catch(error=>{
if (error.code == 10003) {
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
} else {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
}
this.disabled = false;
});
}
},
jumpScheduling() {
this.jumpSimulation();

View File

@ -83,10 +83,6 @@ export default {
}
});
},
// menuSchema
'$store.state.training.prdType':function(val) {
if (val == '01') { this.switchModeInner('01'); } else { this.switchModeInner('02'); }
},
'$store.state.config.menuBarLoadedCount': function (val) { // menuBar
this.setPosition();
},
@ -95,6 +91,7 @@ export default {
},
'$store.state.training.prdType': function (val) { //
this.setPosition();
if (val == '01') { this.switchModeInner('01'); } else { this.switchModeInner('02'); }
},
'$store.state.map.mapViewLoadedCount': function (val) { //
if (this.planRunning) {
@ -180,7 +177,7 @@ export default {
initLoadData() {
this.group = this.$route.query.group;
this.$store.dispatch('training/reset');
this.loadSimulationInfo();
// this.loadSimulationInfo();
this.loadMapData();
},
// 仿group仿

View File

@ -21,7 +21,7 @@
:offset-bottom="offsetBottom"
/>
<div class="display-draft" :class="{'haerbin_btn_box': $route.query.lineCode == '07'||$route.query.lineCode == '14'}" :style="{bottom: offsetBottom + 'px'}">
<div class="display-draft" :class="{'haerbin_btn_box': $route.query.lineCode == '07'||$route.query.lineCode == '14'}" :style="{bottom: offsetBottom + 'px'}">
<el-button-group class="button-group-box">
<template v-if="!dataError">
<template v-if="!projectDevice">
@ -41,17 +41,17 @@ import DemonMenu from './demonMenu';
import { Notification } from 'element-ui';
import MenuSchema from '@/views/newMap/displayCity/menuSchema';
import { getGoodsTryUse } from '@/api/management/goods';
import {getSimulationInfoNew, clearSimulation } from '@/api/simulation';
import {clearSimulation } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index';
import { TrainingMode } from '@/scripts/ConstDic';
import { quitScriptNew } from '@/api/simulation';
// import { quitScriptNew } from '@/api/simulation';
import { setGoodsTryUse } from '@/api/management/goods';
import {loadScriptNew } from '@/api/simulation';
// import {loadScriptNew } from '@/api/simulation';
import StatusIcon from '@/views/components/StatusIcon/statusIcon';
import Vue from 'vue';
// import Vue from 'vue';
import { getSessionStorage } from '@/utils/auth';
import { EventBus } from '@/scripts/event-bus';
// import { EventBus } from '@/scripts/event-bus';
export default {
name: 'MenuDemon',

View File

@ -10,6 +10,8 @@ import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
import { checkLoginLine } from '@/api/login';
import { getSimulationMemberList, getAllSimulationUser } from '@/api/simulation';
import { getMemberListCommon, getUserListCommon } from '@/api/rtSimulation';
import parseStatus from '@/utils/parseStatus';
import { mapGetters } from 'vuex';
export default {
@ -42,6 +44,11 @@ export default {
this.statusMessage(val);
}
},
'$store.state.socket.deviceStateMessages': function (val) {
if (val !== {}) {
this.statusMessageNew(val);
}
},
'$store.state.map.mousemove': function (val) {
this.mousemove();
},
@ -68,7 +75,8 @@ export default {
}
},
mounted() {
window.onbeforeunload = this.clearSubscribe;
const _that = this;
window.onbeforeunload = () => { _that.clearSubscribe(); _that.clearSubscribeNew(); };
this.mode = this.$route.params.mode || '';
this.currentMap = this.$refs.mapCommon;
this.groupModel = this.$route.query.group;
@ -82,6 +90,7 @@ export default {
},
beforeDestroy() {
this.clearSubscribe();
this.clearSubscribeNew();
this.clearAllTimer();
},
methods: {
@ -92,17 +101,20 @@ export default {
await this.$store.dispatch('training/updateMapState', list);
await this.$store.dispatch('socket/setEquipmentStatus');
},
async statusMessageNew(deviceStatus) {
const list = parseStatus(deviceStatus);
await this.$store.dispatch('training/updateMapStateNew', list);
await this.$store.dispatch('socket/setDeviceStateMessages');
},
async simulationError() {
await this.$store.dispatch('map/clearJlmapTrainView');
await this.$store.dispatch('map/setTrainWindowShow', false);
await this.$store.dispatch('training/setMapDefaultState');
// this.clearSubscribe();
this.$confirm(this.$t('tip.getMapStateDataException'), this.$t('tip.hint'), {
confirmButtonText: this.$t('global.confirm'),
showCancelButton: false,
type: 'warning'
}).then(() => {
// this.$emit('back');
}).catch(() => {
});
},
@ -112,6 +124,15 @@ export default {
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
await this.$store.dispatch('training/setHasSubscribed');
},
async subscribeNew() {
this.clearSubscribeNew();
const header = { 'X-Token': getToken() };
creatSubscribe(`/user/queue/simulation/${this.$route.query.group}/ats`, header);
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribeNew() {
clearSubscribe(`/user/queue/simulation/${this.$route.query.group}/ats`);
},
clearSubscribe() {
clearSubscribe(`${displayTopic}\/${this.groupModel}`);
},
@ -164,20 +185,34 @@ export default {
}, 1000);
},
initMemberUserInfo(isFirst = false) {
// 仿
getSimulationMemberList(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
getAllSimulationUser(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setSimulationUserList', resp.data);
if (isFirst) {
this.subscribe();
}
if (this.$route.query.newApi) {
getMemberListCommon(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
getUserListCommon(this.$route.query.group).then(res => {
this.$store.dispatch('training/setSimulationUserList', res.data);
if (isFirst) { this.subscribeNew(); }
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
});
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
this.$messageBox('获取仿真成员列表失败!');
});
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
} else {
// 仿
getSimulationMemberList(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
getAllSimulationUser(this.$route.query.group).then(res => {
this.$store.dispatch('training/setSimulationUserList', res.data);
if (isFirst) {
this.subscribe();
}
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
});
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
}
},
handlerMemberOnOff(data) {
this.$store.dispatch('training/updateMemberAndUser', { simulationUserList: data, userId: this.userId });

View File

@ -11,7 +11,7 @@
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import {createMapSubSystem, updateSubSystem, generateMapSystem} from '@/api/trainingPlatform';
import {createMapSubSystem, updateSubSystem, generateMapSystem, generateAppointMapSystem} from '@/api/trainingPlatform';
import { ProjectList} from '@/scripts/ProjectConfig';
import Cookies from 'js-cookie';
export default {
@ -37,6 +37,8 @@ export default {
name: '',
prdType: '',
type: '',
newApi: false,
appoint: false,
id:null
}
};
@ -67,7 +69,9 @@ export default {
form = {
labelWidth: '150px',
items: [
{ prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true, options: this.mapList}
{ prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true, options: this.mapList},
{ prop: 'appoint', label: '是否指定生成', type: 'switch'},
{ prop: 'prdType', label: '产品类型', type: 'select', required: true, options: this.prdTypeList, show: this.formModel.appoint }
]
};
} else {
@ -75,7 +79,8 @@ export default {
form = {
labelWidth: '150px',
items: [
{ prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true}
{ prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true},
{ prop: 'newApi', label: '是否使用新API', type: 'switch' }
]
};
}
@ -120,6 +125,7 @@ export default {
this.isGernerate = false;
this.formModel.name = row.name;
this.formModel.id = row.id;
this.formModel.newApi = row.newApi || false;
} else {
if (type == 'add') {
this.title = this.$t('systemGenerate.createSubSystem');
@ -128,7 +134,7 @@ export default {
this.formModel.mapId = '';
this.formModel.name = '';
} else {
this.title = this.$t('systemGenerate.generation');
this.title = '生成子系统';
this.isAdd = false;
this.isGernerate = true;
this.formModel.mapId = '';
@ -151,14 +157,24 @@ export default {
this.$messageBox(this.$t('systemGenerate.createMapSystemFail'));
});
} else if (this.isGernerate) {
generateMapSystem(this.formModel.mapId).then(response => {
this.$message.success(this.$t('systemGenerate.generateSuccess'));
self.$emit('reloadTable');
}).catch(() => {
this.$messageBox(this.$t('systemGenerate.generateFail'));
});
if (this.formModel.appoint) {
generateAppointMapSystem(this.formModel.mapId, this.formModel.prdType).then(resp => {
this.$message.success('生成指定子系统成功!');
self.$emit('reloadTable');
}).catch(() => {
this.$messageBox('生成指定子系统异常!');
});
} else {
generateMapSystem(this.formModel.mapId).then(response => {
this.$message.success(this.$t('systemGenerate.generateSuccess'));
self.$emit('reloadTable');
}).catch(() => {
this.$messageBox(this.$t('systemGenerate.generateFail'));
});
}
} else {
const datainfo = {'name': this.formModel.name};
const datainfo = {name: this.formModel.name, newApi: this.formModel.newApi};
updateSubSystem(this.formModel.id, datainfo).then(response => {
this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess'));
self.$emit('reloadTable');