仿真界面调整

This commit is contained in:
fan 2022-10-11 09:55:07 +08:00
parent ecc7f73d5b
commit d37b5a45dd
15 changed files with 509 additions and 243 deletions

View File

@ -537,3 +537,11 @@ export function queryPaTimedList(group, params) {
params
});
}
/** 创建仿真 */
export function createSimulation(data) {
return request({
url: `/simulation/new`,
method: 'post',
data
});
}

View File

@ -75,4 +75,34 @@ export function getSubSystemByProjectCode() {
method: 'get'
});
}
/** 创建地图系统 */
export function createMapSystem(data) {
return request({
url: `/api/mapSystem/new`,
method: 'post',
data
});
}
/** 列表查询地图系统 */
export function queryMapSystemList(params) {
return request({
url: `/api/mapSystem/new/list`,
method: 'get',
params
});
}
/** 更新地图系统 */
export function updateMapSystem(data) {
return request({
url: `/api/mapSystem/new/${data.id}`,
method: 'post',
data
});
}
/** 删除地图系统 */
export function deleteMapSystem(id) {
return request({
url: `/api/mapSystem/new/${id}`,
method: 'delete'
});
}

View File

@ -1,6 +1,6 @@
<template>
<div class="menus" :style="{width: width + 'px'}">
<menu-bar v-show="isShowBar" ref="menuBar" :selected="selected" />
<menu-bar ref="menuBar" :selected="selected" />
<menu-deplot-button ref="menuDeplotButton" />
<menu-station-stand ref="menuStationStand" :selected="selected" />
<menu-switch ref="menuSwitch" :selected="selected" />
@ -54,16 +54,9 @@ export default {
computed: {
...mapGetters('config', [
'width'
]),
isShowBar() {
return this.$store.state.training.prdType && this.$store.state.training.prdType !== '07' && this.$store.state.training.prdType != '09';
}
},
watch: {
isShowBar(val) {
val && this.$store.dispatch('config/updateMenuBar');
}
])
},
watch: {},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('config/updateMenuBar');

View File

@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: "localWorkMenu"
}
</script>
<style scoped>
</style>

View File

@ -190,7 +190,6 @@ const training = {
state.prdType = prdType;
},
setRoles: (state, roles) => {
console.log(roles, '---------------roles');
state.roles = roles;
},
notifyGetCommandDefinition: (state, lineCode) => {
@ -209,6 +208,7 @@ const training = {
if (userId == item.userId) {
state.roles = item.type;
state.roleDeviceCode = item.deviceCode;
console.log(item.deviceCode, '----------', state.roleDeviceCode);
}
});
}
@ -283,6 +283,7 @@ const training = {
},
setRoleDeviceCode :(state, roleDeviceCode) => {
console.log(roleDeviceCode, '---');
state.roleDeviceCode = roleDeviceCode;
},
setOrignalUserRoleId:(state, orignalUserRoleId) => {

View File

@ -24,12 +24,12 @@ export function handlerUrl(data) {
if (process.env.NODE_ENV === 'development') {
// const data = null;
// 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.3.233/rtss-server';
// BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.3.90:9100'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -123,13 +123,15 @@ StompClient.prototype = {
unsubscribe(topic) {
const subscription = this.subscribeMap.get(topic);
subscription.count--;
if (subscription && subscription.sub && subscription.count < 0) {
subscription.sub.unsubscribe();
this.subscribeMap.delete(topic);
console.log('取消订阅:' + topic);
} else if (subscription && subscription.count < 0) {
this.subscribeMap.delete(topic);
if (subscription && subscription.count > 0) {
subscription.count--;
if (subscription && subscription.sub && subscription.count < 0) {
subscription.sub.unsubscribe();
this.subscribeMap.delete(topic);
console.log('取消订阅:' + topic);
} else if (subscription && subscription.count < 0) {
this.subscribeMap.delete(topic);
}
}
},

View File

@ -26,7 +26,7 @@ import SimulationControl from './simulationControl.vue';
export default {
name: 'DisplayDraft',
components: {
TerminalsPicture,
TerminalsPicture,
SimulationMenu,
SimulationControl
},
@ -155,3 +155,8 @@ export default {
}
};
</script>
<style lang="scss" scoped>
.main{
height: 100%;
}
</style>

View File

@ -1,16 +1,16 @@
<template>
<div>
<div v-loading="loading" style="height: 100%">
<dispatcher-work v-if="picture === 'dispatchWork'" ref="dispatcherWork" />
<local-work v-else-if="picture === 'localWork'" ref="localWork" :centralized-station-map="centralizedStationMap" />
<message-board v-else-if="picture === 'messageBoard'" ref="messageBoard" />
<jl3d-drive v-else-if="picture === 'drivingPlan'" ref="jl3dDrive" />
<jl3d-device v-else-if="picture === 'jl3dModle'" ref="jl3dModle" />
<jl3d-passflow v-else-if="picture === 'cctvView'" ref="cctvView" />
<digital-stand v-else-if="picture === 'digitalStand'" ref="digitalStand" />
<traffic-terminal-work v-else-if="picture === 'trafficTerminal'" ref="trafficTerminalWork" :centralized-station-map="centralizedStationMap" />
<ibp-plate v-else-if="picture === 'ibp'" ref="ibpPlate" />
<dispatch-cmd v-if="datie" ref="dispatchCmd" @close="close" />
<dispatcher-loger v-if="datie" ref="dispatcherLoger" @close="close" />
<terminal-menu v-if="menuShow" ref="terminalMenu" @pictureChange="pictureChange" @popupTerminalShow="popupTerminalShow" />
<terminal-menu v-if="menuShow" ref="terminalMenu" @pictureChange="pictureChange" @popupTerminalShow="popupTerminalShow" @loadingChange="loadingChange" />
</div>
</template>
@ -22,12 +22,12 @@ import { defaultCallback, stateCallback } from '@/utils/subscribeCallback';
import DispatcherWork from './dispatchWork';
import LocalWork from './localWork';
import TerminalMenu from './terminalMenu';
import MessageBoard from '../messageBoard';
import DispatchCmd from '@/views/dispatcherStationManage/dispatchCmd';
import DispatcherLoger from '@/views/dispatcherLoger/index';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import Jl3dPassflow from '@/views/jlmap3d/passflow/jl3dpassflow';
import DigitalStand from '@/views/jlmap3d/simulation/jl3dsimulation';
import IbpPlate from '@/views/ibp/ibpsystem/index';
import TrafficTerminalWork from './trafficTerminalWork';
export default {
@ -36,21 +36,22 @@ export default {
DispatcherWork,
LocalWork,
TerminalMenu,
MessageBoard,
DispatchCmd,
DispatcherLoger,
Jl3dDevice,
Jl3dDrive,
Jl3dPassflow,
IbpPlate,
TrafficTerminalWork
TrafficTerminalWork,
DigitalStand
},
data() {
return {
picture: '',
menuShow: true,
centralizedStationList: [],
centralizedStationMap: {}
centralizedStationMap: {},
loading: false
};
},
computed: {
@ -65,6 +66,9 @@ export default {
},
datie() {
return ['16', '19'].includes(this.$route.query.lineCode);
},
roleDeviceCode() {
return this.$store.state.training.roleDeviceCode;
}
},
watch: {
@ -84,7 +88,6 @@ export default {
console.log('[ERROR] ', error);
this.mapViewLoaded(false);
}
}
},
mounted() {
@ -93,6 +96,7 @@ export default {
beforeDestroy() {
this.clearSubscribe();
this.$store.dispatch('map/mapClear');
this.$store.dispatch('training/setRoles', '');
this.$store.dispatch('map/initJlmapLoadedCountClear');
this.$store.dispatch('socket/clearSimulationRoleList');
},
@ -125,9 +129,15 @@ export default {
clearSubscribe(getTopic('CTC', this.group));
}
},
loadingChange() {
this.loading = true;
},
pictureChange(val) {
console.log(val, '--------------0');
this.picture = val;
if (val === 'ibp') {
this.$nextTick(() => { this.$refs.ibpPlate.show(this.roleDeviceCode, ''); });
}
this.$nextTick(() => { this.loading = false; });
},
popupTerminalShow(val) {
this.$refs[val].doShow();

View File

@ -22,13 +22,13 @@ export default {
code: 'localWork',
roleList: ['STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_MASTER', 'STATION_SIGNALER', 'STATION_PASSENGER',
'STATION_SWITCH_MAN', 'STATION_FACILITATOR', 'STATION_WORKER', 'DEVICE_MANAGER', 'TRAIN_MASTER'],
click: this.localWorkShow
click: this.changePictureShow
},
{
name: '行调工作站',
code: 'dispatchWork',
roleList: ['DISPATCHER'],
click: this.dispatchWorkShow
click: this.changePictureShow
}
],
terminalMap:{
@ -37,7 +37,7 @@ export default {
name: '车务终端',
code: 'trafficTerminal',
roleList: ['STATION_SUPERVISOR'],
click: this.trafficTerminalShow
click: this.changePictureShow
},
{
name: '车务管理终端',
@ -64,38 +64,31 @@ export default {
name: 'cctv视图',
code: 'cctvView',
roleList: ['STATION_SUPERVISOR'],
click: this.noEvent
},
{
name: '故障设备',
code: 'jlmap3dFault',
roleList: ['STATION_SUPERVISOR'],
click: this.noEvent
click: this.changePictureShow
},
// {
// name: '',
// code: 'jlmap3dFault',
// roleList: ['STATION_SUPERVISOR'],
// click: this.noEvent
// },
{
name: '司机视角',
code: 'drivingPlan',
roleList: ['DRIVER'],
click: this.noEvent
click: this.changePictureShow
},
{
name: 'IBP盘',
code: 'ibp',
roleList: ['STATION_SUPERVISOR'],
click: this.ibpShow
click: this.changePictureShow
},
{
name: '数字沙盘',
code: 'digitalStand',
roleList: ['STATION_SUPERVISOR'],
click: this.noEvent
},
{ // {label:'', name:'messageBoard', click:this.messageBoard, isShow:false},
name: '留言板',
code: 'messageBoard',
roleList: ['DISPATCHER', 'STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_MASTER', 'STATION_SIGNALER', 'STATION_PASSENGER',
'STATION_SWITCH_MAN', 'STATION_FACILITATOR', 'STATION_WORKER', 'DEVICE_MANAGER', 'TRAIN_MASTER'],
click: this.messageBoardShow
click: this.changePictureShow
}
]
}
@ -116,9 +109,6 @@ export default {
},
roles() {
return this.$store.state.training.roles;
},
roleDeviceCode() {
return this.$store.state.trainingNew.roleDeviceCode;
}
},
watch: {
@ -155,15 +145,6 @@ export default {
this.active = code;
this.$emit('popupTerminalShow', 'dispatchCmd');
},
messageBoardShow(code) {
this.active = code;
console.log(this.active, 'messageB', code);
this.$emit('pictureChange', code);
},
ibpShow(code) {
this.active = code;
this.$refs.ibpPlate.show(this.roleDeviceCode, '');
},
close() {
this.active = 0;
},
@ -171,25 +152,20 @@ export default {
const localWorkRoleList = ['STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_MASTER', 'STATION_SIGNALER', 'STATION_PASSENGER', 'STATION_SWITCH_MAN',
'STATION_FACILITATOR', 'STATION_WORKER', 'DEVICE_MANAGER', 'TRAIN_MASTER'];
if (localWorkRoleList.includes(this.roles)) {
this.localWorkShow('localWork');
this.changePictureShow('localWork');
} else if (this.roles === 'DISPATCHER') {
this.dispatchWorkShow('dispatchWork');
this.changePictureShow('dispatchWork');
} else if (this.roles === 'MAINTAINER') {
//
}
},
dispatchWorkShow(code) {
changePictureShow(code) {
this.active = code;
this.$emit('pictureChange', code);
},
trafficTerminalShow(code) {
this.active = code;
this.$emit('pictureChange', code);
},
localWorkShow(code) {
this.active = code;
this.$emit('pictureChange', code);
this.$emit('loadingChange');
setTimeout(() => {
this.$emit('pictureChange', code);
}, 100);
}
}
};

View File

@ -1,15 +1,34 @@
<template>
<div style="height: 100%; overflow: auto;">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<select-role ref="selectRole" @reloadTable="reloadTable" />
</div>
<el-tabs v-model="activeName" style="height: 100%;margin: 10px;" type="border-card" @tab-click="handleClick">
<el-tab-pane label="仿真系统" name="first" style="height: 100%;">
<div style="display: flex;flex-wrap:wrap; justify-content:center;height: 100%;overflow-y: auto;">
<template v-for="system in systemList">
<el-card :key="system.id" class="box-card">
<div style="text-align: center;font-size: 26px;font-weight: bolder;color: #0C161A;">{{ system.name }}</div>
<div style="font-size: 14px;color: #0C161A;text-indent: 28px;margin-top: 20px;">{{ system.desc }}</div>
<el-button style="position: absolute;bottom: 15px;left: 0;right: 0;margin: 0 auto;width: 60px;" size="small" type="primary" @click="enterSimulation(system)">进入</el-button>
</el-card>
</template>
</div>
</el-tab-pane>
<el-tab-pane label="地图权限" name="second">
<div style="height: 100%; overflow: auto;">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<select-role ref="selectRole" @reloadTable="reloadTable" />
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
import { listUserPermision } from '@/api/management/author';
import { queryMapSystemList } from '@/api/trainingPlatform';
import { superAdmin, admin } from '@/router/index';
import selectRole from './selectRole/list';
import LangStorage from '@/utils/lang';
import { launchFullscreen } from '@/utils/screen';
import { createSimulation } from '@/api/simulation';
import { getSessionStorage } from '@/utils/auth';
export default {
name: 'Author',
@ -19,8 +38,10 @@ export default {
data() {
return {
param: '',
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts', 'hlsdrts', 'designhlsdrts', 'teaching', 'designteaching'],
activeName: 'first',
WhetherTypeList: [],
// EffectiveTypeList: [],
systemList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -107,18 +128,33 @@ export default {
}
};
},
computed: {
project() {
return getSessionStorage('project');
}
},
watch: {
'$route.params.mapId': function (val) {
this.$refs.queryListPage.refresh(true);
this.initMapSystem();
}
},
mounted() {
this.loadInitData();
this.initMapSystem();
},
methods: {
handleRoleVest(index, row) {
this.$refs.selectRole.doShow(row.id);
},
initMapSystem() {
queryMapSystemList({mapId: this.$route.params.mapId}).then(resp => {
this.systemList = resp.data;
console.log(resp);
}).catch(() => {
this.$message.error('获取地图子系统列表失败!');
});
},
loadInitData() {
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
},
@ -135,7 +171,43 @@ export default {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
enterSimulation(system) {
const data = {...system.paramVO, mapId: system.mapId};
createSimulation(data).then(resp => {
const query = { lineCode: this.$route.query.lineCode, group: resp.data, mapId: system.mapId, project: this.project};
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `/display/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;
});
},
handleClick(tab, event) {
console.log(tab, event);
}
}
};
</script>
<style lang="scss" scoped>
.box-card {
width: 30%;
padding: 20px;
height: 220px;
margin: 20px;
position: relative;
}
/deep/ {
.el-tabs__content {
height: 100%;
}
}
</style>

View File

@ -7,6 +7,7 @@
<local-map ref="localMap" />
<export-map ref="exportMap" />
<map-sort ref="mapSort" />
<subsystem-manage ref="subsystemManage" />
<!--<input ref="files" type="file" class="file_box" accept=".json, application/json" style="display: none" @change="importf">-->
<el-dialog
title="一键领取权限"
@ -39,6 +40,7 @@ import MapSort from './mapSort';
import { superAdmin } from '@/router/index';
import { ProjectList } from '@/scripts/ProjectConfig';
import { getPermissionQuickly } from '@/api/management/author';
import SubsystemManage from './subsystem';
export default {
name: 'PublishMap',
@ -48,7 +50,8 @@ export default {
CopyMap,
LocalMap,
ExportMap,
MapSort
MapSort,
SubsystemManage
},
data() {
return {
@ -186,6 +189,11 @@ export default {
name: '领取权限',
handleClick: this.handlePermission,
type: 'default'
},
{
name: '子系统管理',
handleClick: this.subsystemManage,
type: 'default'
}
]
}
@ -465,6 +473,9 @@ export default {
this.mapId = row.id;
this.dialogVisible = true;
},
subsystemManage(index, row) {
this.$refs.subsystemManage.doShow(row);
},
permissionCommit() {
getPermissionQuickly(this.mapId, this.permissionNum).then(resp => {
this.dialogVisible = false;

View File

@ -0,0 +1,292 @@
<template>
<el-dialog
title="子系统管理"
:visible.sync="dialogVisible"
width="60%"
center
>
<el-button type="primary" size="small" style="position: relative;left: 90%;margin-bottom: 10px;" @click="handleAddSubsystem">新增</el-button>
<el-table v-loading="loading" :data="tableData" border style="width: 100%">
<el-table-column prop="name" label="名称" />
<el-table-column prop="simType" label="类型">
<template slot-scope="scope">
<span>{{ simTypeMap[scope.row.simType] }}</span>
</template>
</el-table-column>
<el-table-column prop="simUsage" label="使用方式">
<template slot-scope="scope">
<span>{{ simUsageMap[scope.row.simUsage] }}</span>
</template>
</el-table-column>
<el-table-column prop="desc" label="描述" width="400px" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="updateRow(scope.row)">更新</el-button>
<el-button type="text" size="small" @click="deleteRow(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
width="30%"
:title="innerTitle"
:visible.sync="innerVisible"
center
append-to-body
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
<el-form-item label="子系统名称:" prop="name">
<el-input v-model="ruleForm.name" style="width: 200px;" />
</el-form-item>
<el-form-item label="类型:" prop="type">
<el-select v-model="ruleForm.type" placeholder="请选择类型">
<el-option label="地铁" value="METRO" />
<el-option label="铁路/大铁" value="RAILWAY" />
<el-option label="应急调度" value="EMERGENCY" />
</el-select>
</el-form-item>
<el-form-item label="使用方式:" prop="usage">
<el-select v-model="ruleForm.usage" placeholder="请选择使用方式">
<el-option label="单角色仿真" value="SINGLE_MEMBER" />
<el-option label="单客户端仿真" value="SINGLE_CLIENT" />
<el-option label="综合演练" value="JOINT" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_MEMBER' || ruleForm.usage === 'JOINT'" label="角色:" prop="memberType">
<el-select v-model="ruleForm.memberType" placeholder="请选择角色">
<el-option v-for="option in roleList" :key="option.value" :label="option.label" :value="option.value" />
</el-select>
</el-form-item>
<el-form-item v-if="stationRoles.includes(ruleForm.memberType)" label="车站:" prop="deviceCode">
<el-select v-model="ruleForm.deviceCode" placeholder="请选择设备">
<el-option v-for="option in stationList" :key="option.code" :label="option.name" :value="option.code" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.memberType === 'DRIVER'" label="列车:" prop="deviceCode">
<el-select v-model="ruleForm.deviceCode" placeholder="请选择设备">
<el-option v-for="option in trainList" :key="option.code" :label="option.code" :value="option.code" />
</el-select>
</el-form-item>
<el-form-item v-if="ruleForm.usage === 'SINGLE_CLIENT'" label="客户端:" prop="client">
<el-select v-model="ruleForm.client" placeholder="请选择使用客户端">
<el-option label="联锁" value="INTERLOCK" />
<el-option label="大屏" value="BIG_SCREEN" />
<el-option label="综合监控" value="ISCS" />
</el-select>
</el-form-item>
<el-form-item label="功能:" prop="function">
<el-select v-model="ruleForm.function" placeholder="请选择功能">
<el-option label="大客流" value="LPF" />
</el-select>
</el-form-item>
<el-form-item label="描述:" prop="desc">
<el-input
v-model="ruleForm.desc"
type="textarea"
:rows="2"
placeholder="请输入内容"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeInner"> </el-button>
<el-button type="primary" @click="commit"> </el-button>
</span>
</el-dialog>
</el-dialog>
</template>
<script>
import { getStationListNeedAttendant } from '@/api/jmap/map';
import { queryMapSystemList, updateMapSystem, createMapSystem, deleteMapSystem } from '@/api/trainingPlatform';
export default {
name: 'Subsystem',
data() {
return {
dialogVisible: false,
tableData: [],
mapId: '',
loading: false,
innerVisible: false,
mapSystemId: '',
stationList: [],
trainList: [],
innerTitle: '',
ruleForm: {
name: '',
type: '',
usage: '',
memberType: '',
deviceCode: '',
client: '',
function: ''
},
simTypeMap: {
METRO: '地铁',
RAILWAY: '铁路/大铁',
EMERGENCY: '应急调度'
},
simUsageMap: {
SINGLE_MEMBER: '单角色仿真',
SINGLE_CLIENT: '单客户端仿真',
JOINT: '综合演练'
},
stationRoles: ['STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_MASTER', 'STATION_SIGNALER', 'STATION_PASSENGER', 'STATION_SWITCH_MAN',
'STATION_FACILITATOR', 'STATION_WORKER', 'TRAIN_MASTER'],
rules: {
name: [
{ required: true, message: '请输入子系统名称', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择子系统类型', trigger: 'change' }
],
usage: [
{ required: true, message: '请选择使用方式', trigger: 'change' }
]
},
roleList: [
{label: '行调', value: 'DISPATCHER'},
{label: '行值', value: 'STATION_SUPERVISOR'},
{label: '司机', value: 'DRIVER'},
{label: '通号', value: 'MAINTAINER'},
{label: '车辆段信号楼', value: 'DEPOT_DISPATCHER'},
{label: '停车场信号楼', value: 'PARKING_LOT_SIGNAL_BUILDING'},
{label: '车站助理', value: 'STATION_ASSISTANT'},
{label: '车站站长', value: 'STATION_MASTER'},
{label: '车站信号员', value: 'STATION_SIGNALER'},
{label: '车站客运员', value: 'STATION_PASSENGER'},
{label: '车站扳道员', value: 'STATION_SWITCH_MAN'},
{label: '车站引导员', value: 'STATION_FACILITATOR'},
{label: '车站工务工', value: 'STATION_WORKER'},
{label: '车务段段长', value: 'TRAIN_MASTER'}
]
};
},
methods: {
handleAddSubsystem() {
this.innerTitle = '创建子系统';
this.innerVisible = true;
},
doShow(data) {
if (data && data.id) {
this.mapId = data.id;
this.stationList = [];
getStationListNeedAttendant(data.id).then(resp => {
if (resp.data && resp.data.length) {
this.stationList = resp.data;
}
}).catch(() => {
this.$message.error('获取车站列表失败');
});
this.reload();
this.dialogVisible = true;
}
},
reload() {
this.loading = true;
this.tableData = [];
queryMapSystemList({mapId: this.mapId}).then(resp => {
if (resp.data && resp.data.length) {
this.tableData = resp.data;
}
this.loading = false;
}).catch(() => {
this.loading = false;
this.$message.error('获取地图系统列表!');
});
},
doClose() {
this.dialogVisible = false;
},
deleteRow(row) {
this.$confirm('删除子系统,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteMapSystem(row.id).then(resp => {
this.reload();
}).catch(error => {
this.$message.error(`删除子系统: ${error.message}`);
});
}).catch( () => { });
},
updateRow(row) {
this.mapSystemId = row.id;
this.ruleForm.name = row.name;
this.ruleForm.desc = row.desc;
this.ruleForm.type = row.paramVO.type;
this.ruleForm.usage = row.paramVO.usageInfo.usage;
this.ruleForm.client = row.paramVO.usageInfo.param.client;
this.ruleForm.memberType = row.paramVO.usageInfo.param.memberType;
this.ruleForm.deviceCode = row.paramVO.usageInfo.param.deviceCode;
const functionList = Object.keys(row.paramVO.functionMap);
if (functionList && functionList.length) {
this.ruleForm.function = functionList[0];
}
this.innerTitle = '修改子系统';
this.innerVisible = true;
},
commit() {
const functionMap = {};
if (this.ruleForm.function) {
functionMap[this.ruleForm.function] = null;
}
const data = {
mapId: this.mapId,
name: this.ruleForm.name,
desc: this.ruleForm.desc,
paramVO: {
type: this.ruleForm.type,
usageInfo: {
usage: this.ruleForm.usage,
param: {
client: this.ruleForm.client,
memberType: this.ruleForm.memberType,
deviceCode: this.ruleForm.deviceCode
}
},
functionMap: functionMap
}
};
if (this.innerTitle === '创建子系统') {
createMapSystem(data).then(resp => {
this.innerVisible = false;
this.reload();
this.$message.success('创建子系统成功!');
this.closeInner();
}).catch(() => {
this.$message.error('创建子系统失败!');
});
} else {
data.id = this.mapSystemId;
updateMapSystem(data).then(resp => {
this.innerVisible = false;
this.reload();
this.closeInner();
this.$message.success('修改子系统成功!');
}).catch(() => {
this.$message.error('修改子系统失败!');
});
}
},
closeInner() {
this.mapSystemId = '';
this.ruleForm = {
name: '',
type: '',
usage: '',
memberType: '',
deviceCode: '',
client: '',
function: ''
};
this.innerVisible = false;
this.$refs.ruleForm.resetFields();
}
}
};
</script>
<style scoped>
</style>

View File

@ -11,36 +11,27 @@
<el-tree
ref="tree"
:data="treeList"
node-key="key"
node-key="id"
:props="{children:'children',label:'name'}"
highlight-current
:span="22"
:filter-node-method="filterNode"
:default-expanded-keys="expandList"
@node-click="clickEvent"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
>
<span slot-scope="{ node }">
<span
class="el-icon-tickets"
/>
<span v-if="node.data.id ==='Simulation'" :id="node.data.key">&nbsp;{{ node.data.name+ $t('global.simulationSystem') }}</span>
<span v-else-if="node.data.id ==='Lesson'" :id="node.data.key">&nbsp;{{ node.data.name+ $t('global.lessonSystem') }}</span>
<span v-else-if="node.data.id ==='Exam'" :id="node.data.key">&nbsp;{{ node.data.name+ $t('global.examSystem') }}</span>
<span v-else-if="node.data.id ==='Plan'" :id="node.data.key">&nbsp;{{ node.data.name+ $t('global.runPlanSystem') }}</span>
<span v-else :id="node.data.key">&nbsp;{{ node.data.name }}</span>
<span :id="node.data.id">&nbsp;{{ node.data.name }}</span>
</span>
</el-tree>
</div>
</div>
</template>
<script>
import { getTrainingSystemList, getSubSystemInfo, getSubSystemByProjectCode } from '@/api/trainingPlatform';
import { getPublishMapInfo } from '@/api/jmap/map';
import { listPublishMap } from '@/api/jmap/map';
import { UrlConfig } from '@/scripts/ConstDic';
import FilterCity from '@/views/components/filterCity';
import localStore from 'storejs';
import { getSessionStorage } from '@/utils/auth';
import { GetMapListByProjectList } from '@/scripts/ProjectConfig';
@ -55,7 +46,6 @@ export default {
filterText: '',
treeList: [],
mapId: '',
expandList: [],
filterSelect: ''
};
},
@ -86,76 +76,10 @@ export default {
if (!value) return true;
return data.name.includes(value);
},
clickEvent(obj, data, ele, isReplace = false) {
if (ele) {
if ( ele.expanded) {
ele.expanded = false;
} else {
ele.expanded = true;
}
}
localStore.set('trainingPlatformCheckId' + this.filterSelect + this.userId + this.project, obj.key);
this.mapId = obj.key.split('-')[0];
if ( obj.type === 'Map') {
this.mapId = obj.id;
const router = { path: `${UrlConfig.trainingPlatform.permission}/${this.mapId}`};
this.toNextPage(isReplace, router);
} else if ( obj.type === 'System' ) {
const router = { path: `${UrlConfig.trainingPlatform.secondaryHome}`, query: { type: obj.id } };
this.toNextPage(isReplace, router);
} else if ( obj.type === 'MapSystem') {
getSubSystemInfo(obj.id).then(resp => { //
let router = '';
switch (resp.data.type) {
case 'Exam':
// this.setLocalRoute(`${UrlConfig.trainingPlatform.examHome}/${obj.id}`);
// router = localStore.get('examDetail' + obj.id);
// if (!router) { router = { path: `${UrlConfig.trainingPlatform.examHome}/${obj.id}`}; }
// this.toNextPage(isReplace, router);
router = { path: `${UrlConfig.trainingPlatform.examHome}/${obj.id}`};
this.toNextPage(isReplace, router);
break;
case 'Lesson':
this.setLocalRoute(`${UrlConfig.trainingPlatform.teachHome}/${obj.id}`);
router = { path: `${UrlConfig.trainingPlatform.teachHome}/${obj.id}`};
this.toNextPage(isReplace, router);
break;
case 'Simulation':
if (resp.data.prdType == '08') {
//
getPublishMapInfo(this.mapId).then(rest => {
this.setLocalRoute(`${UrlConfig.trainingPlatform.runPlan}/${this.mapId}?lineCode=${rest.data.lineCode}`);
router = { path: `${UrlConfig.trainingPlatform.runPlan}/${this.mapId}`, query: { lineCode: rest.data.lineCode}};
this.toNextPage(isReplace, router);
});
} else {
this.setLocalRoute(`${UrlConfig.trainingPlatform.prodDetail}/${obj.id}?mapId=${this.mapId}`);
router = { path: `${UrlConfig.trainingPlatform.prodDetail}/${obj.id}`, query: { mapId: this.mapId}};
this.toNextPage(isReplace, router);
}
break;
}
}).catch((error) => {
if (error.code === '40004') {
this.$messageBox(this.$t('systemGenerate.getSubSystemInfoFail'));
}
});
}
},
toNextPage(isReplace, router) {
isReplace ? this.$router.replace(router) : this.$router.push(router);
},
setLocalRoute(path) {
localStore.set('trainingPlatformRoute' + this.userId + this.project, path);
},
forTree(item) {
item.children && item.children.forEach(childrenItem => {
childrenItem.key = item.key + '-' + childrenItem.id;
if (childrenItem.children && childrenItem.children.length) {
this.forTree(childrenItem);
}
});
clickEvent(obj, data, ele) {
this.mapId = obj.id;
const router = { path: `${UrlConfig.trainingPlatform.permission}/${this.mapId}`, query: { lineCode: obj.lineCode }};
this.$router.push(router);
},
async refresh(filterSelect) {
this.loading = true;
@ -164,92 +88,21 @@ export default {
try {
let res = {};
if (this.IsProject) {
res = await getSubSystemByProjectCode();
res = await listPublishMap({project: this.project});
} else {
res = await getTrainingSystemList(filterSelect);
}
this.$emit('goRoutePath', res.data);
res.data && res.data.forEach(item =>{
item.key = item.id;
this.forTree(item);
});
if (this.project === 'cgy') {
this.treeList = [];
res.data.forEach(item => {
const childList = [];
if (item && item.children && item.children.length > 3) {
item.children.forEach(elem => {
if (elem.id === 'Lesson') {
childList[0] = elem;
} else if (elem.id === 'Exam') {
childList[3] = elem;
} else if (elem.id === 'Simulation') {
childList[1] = elem;
} else {
childList[2] = elem;
}
});
item.children = childList;
}
});
res = await listPublishMap({ cityCode:filterSelect});
}
this.treeList = res.data;
this.getExpandList(filterSelect);
this.$nextTick(() => {
let checkId = localStore.get('trainingPlatformCheckId' + filterSelect + this.userId + this.project) || null;
checkId = checkId && checkId.includes('-') ? checkId : null;
this.$refs.tree && this.$refs.tree.setCurrentKey(checkId);
if (!this.$route.path.includes('result') && !this.$route.path.includes('/trainingPlatform/teach/')) {
checkId && this.findTree(this.treeList, checkId);
!checkId && this.treeList && this.treeList.length && this.clickEvent(this.treeList[0], {data: this.treeList[0]});
}
setTimeout(()=> {
if (checkId) {
const checkIdDom = document.getElementById(checkId);
const mapTreeDom = document.getElementById('trainingMapTree');
if (checkIdDom && mapTreeDom) {
mapTreeDom.scrollTop = checkIdDom.offsetTop;
}
}
this.loading = false;
}, 200);
this.$refs.tree && this.$refs.tree.setCurrentKey(this.$route.params.mapId + '');
});
console.log(res.data, '----');
this.$emit('goRoutePath', res.data);
this.loading = false;
} catch (error) {
this.loading = false;
this.$message.error(this.$t('error.refreshFailed'));
}
},
/* 根据localstorage缓存的trainingPlatformCheckId跳转右侧显示页面 */
findTree(treeList, checkId, data) {
treeList && treeList.length && treeList.forEach(item =>{
if (item.type === 'Map') {
data = item;
}
if (checkId === item.key) {
this.clickEvent(item, {data: data}, null, true);
} else {
this.findTree(item.children, checkId, data);
}
});
},
nodeExpand(obj, node, ele) {
const key = obj.key;
this.expandList = this.expandList.filter(item => item !== key);
this.expandList.push(key);
localStore.set('trainIngPlatformExpandList' + this.filterSelect + this.userId + this.project, this.expandList);
},
nodeCollapse(obj, node, ele) {
const key = obj.key;
this.expandList = this.expandList.filter(item => (item !== key && !item.startsWith(`${key}-`)));
localStore.set('trainIngPlatformExpandList' + this.filterSelect + this.userId + this.project, this.expandList);
},
getExpandList(filterSelect) {
this.expandList = [];
let expand = localStore.get('trainIngPlatformExpandList' + filterSelect + this.userId + this.project);
expand = expand ? (expand + '').split(',') : '';
if (expand instanceof Array) {
this.expandList = expand;
}
}
}
};

View File

@ -46,10 +46,10 @@ export default {
const userId = this.$store.state.user.id;
const path = localStore.get('trainingPlatformRoute' + userId + project);
if (path && path.startsWith('/trainingPlatform')) {
localStore.set('orignalTrainingPlatformRoute' + userId + project, `/trainingPlatform/permission/${data[0].id}`);
localStore.set('orignalTrainingPlatformRoute' + userId + project, `/trainingPlatform/permission/${data[0].id}?lineCode=${data[0].lineCode}`);
this.$router.push(path);
} else if (data && data[0]) {
this.$router.push(`/trainingPlatform/permission/${data[0].id}`);
this.$router.push(`/trainingPlatform/permission/${data[0].id}?lineCode=${data[0].lineCode}`);
}
setSessionStorage('againEnter', true);
}