实训平台 代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-25 13:31:36 +08:00
parent 7e0c3696ab
commit 8c054f492f
6 changed files with 48 additions and 105 deletions

View File

@ -28,11 +28,6 @@ export default {
loading: false loading: false
}; };
}, },
computed: {
path() {
return window.location.pathname;
}
},
watch: { watch: {
'$store.state.socket.simulationInvite': function (val) { '$store.state.socket.simulationInvite': function (val) {
if (val.creator) { if (val.creator) {
@ -101,7 +96,8 @@ export default {
}, },
subscribe() { subscribe() {
const token = getToken(); const token = getToken();
if (token && this.$route.path != '/404' && !this.path.endsWith('login')) { const path = window.location.pathname;
if (token && this.$route.path != '/404' && !path.endsWith('login')) {
const header = { group: '', 'X-Token': token }; const header = { group: '', 'X-Token': token };
this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')}); this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')});
} }

View File

@ -2,8 +2,8 @@
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
v-dialogLoading="pageLoading" v-dialogLoading="pageLoading"
:title="title" :title="$t('global.synthesisTrainingTitle')"
:visible.sync="show" :visible.sync="dialogShow"
width="600px" width="600px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
@ -17,7 +17,7 @@
class="filter-tree" class="filter-tree"
default-expand-all default-expand-all
:data="trainingList" :data="trainingList"
:props="defaultProps" :props="{label: 'roomName'}"
:filter-node-method="filterNode" :filter-node-method="filterNode"
:style="{height: height+'px'}" :style="{height: height+'px'}"
> >
@ -44,8 +44,6 @@
<script> <script>
import { getSimulationListCantainUser } from '@/api/jointSimulation'; import { getSimulationListCantainUser } from '@/api/jointSimulation';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, roomTopic} from '@/utils/stomp';
export default { export default {
name: 'DeomonList', name: 'DeomonList',
@ -54,45 +52,16 @@ export default {
dialogShow: false, dialogShow: false,
height: 120, height: 120,
trainingList: [], trainingList: [],
defaultProps: {
label: 'roomName'
},
group: '', group: '',
loading: false, loading: false,
pageLoading: false pageLoading: false
}; };
}, },
computed: {
show() {
return this.dialogShow;
},
title() {
return this.$t('global.synthesisTrainingTitle');
},
isWatch() {
return true;
},
isjoin() {
return true;
}
},
methods: { methods: {
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
async subscribe(group) {
if (!this.$store.state.socket.roomIsSubscribe) {
this.clearSubscribe(group);
const header = { group: group || '', 'X-Token': getToken() };
creatSubscribe(`${roomTopic}\/${group}`, header);
await this.$store.dispatch('socket/setRoomSubscribe', true);
}
},
async clearSubscribe(group) {
clearSubscribe(`${roomTopic}\/${group}`);
await this.$store.dispatch('socket/setRoomSubscribe', false);
},
async doShow() { async doShow() {
try { try {
this.pageLoading = true; this.pageLoading = true;

View File

@ -1,8 +1,8 @@
<template> <template>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
:title="title" :title="$t('global.synthesisTrainingTitle')"
:visible.sync="show" :visible.sync="dialogShow"
width="600px" width="600px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
@ -36,16 +36,6 @@ export default {
loading: false loading: false
}; };
}, },
computed: {
show() {
return this.dialogShow;
},
title() {
return this.$t('global.synthesisTrainingTitle');
}
},
mounted() {
},
methods: { methods: {
doShow(data) { doShow(data) {
this.roomName = data.creator.nickname; this.roomName = data.creator.nickname;

View File

@ -385,43 +385,42 @@ export default {
}, },
// //
onSelected(em) { onSelected(em) {
console.log(em); console.log(em);
const path = window.location.href; const path = window.location.href;
if (path.includes("/practiceDisplay")){ if (path.includes('/practiceDisplay')) {
if(em.deviceType == "StationStand"){ if (em.deviceType == 'StationStand') {
// console.log(em.deviceType ); // console.log(em.deviceType );
const routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path:'/jlmap3d/trafficplan', path:'/jlmap3d/trafficplan',
query:{ query:{
mapid:this.$route.query.mapId, mapid:this.$route.query.mapId,
group:this.$route.query.group, group:this.$route.query.group,
project: this.$route.query.project, project: this.$route.query.project,
noPreLogout: true, noPreLogout: true,
lineCode:this.$route.query.lineCode, lineCode:this.$route.query.lineCode,
deviceCode:em.deviceCode, deviceCode:em.deviceCode
} }
}); });
window.open(routeData.href, '_blank', 'noopener noreferrer'); window.open(routeData.href, '_blank', 'noopener noreferrer');
} }
if(em.deviceType == "Train"){ if (em.deviceType == 'Train') {
// console.log(em.deviceType ); // console.log(em.deviceType );
const routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain', path:'/jlmap3d/traffictrain',
query:{ query:{
mapid:this.$route.query.mapId, mapid:this.$route.query.mapId,
group:this.$route.query.group, group:this.$route.query.group,
project: this.$route.query.project, project: this.$route.query.project,
noPreLogout: true, noPreLogout: true,
lineCode:this.$route.query.lineCode, lineCode:this.$route.query.lineCode,
deviceCode:em.deviceCode, deviceCode:em.deviceCode
} }
}); });
window.open(routeData.href, '_blank', 'noopener noreferrer'); window.open(routeData.href, '_blank', 'noopener noreferrer');
} }
}else{ } else {
this.$emit('onSelect', em); this.$emit('onSelect', em);
} }
}, },

View File

@ -4,14 +4,14 @@
<span>{{ $t('global.mapList') }}</span> <span>{{ $t('global.mapList') }}</span>
</div> </div>
<div class="left-map-list"> <div class="left-map-list">
<filter-city v-if="!getMapByCode" ref="filerCity" filter-empty :local-param-name="localParamName" @filterSelectChange="refresh" /> <filter-city v-if="!getMapByCode" ref="filerCity" filter-empty local-param-name="training_cityCode" @filterSelectChange="refresh" />
<el-input v-if="!getMapByCode" v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable /> <el-input v-if="!getMapByCode" v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<div style="height: calc(100% - 76px); overflow: auto;"> <div style="height: calc(100% - 76px); overflow: auto;">
<el-tree <el-tree
ref="tree" ref="tree"
:data="treeList" :data="treeList"
node-key="key" node-key="key"
:props="defaultProps" :props="{children: 'children',label: 'name'}"
highlight-current highlight-current
:span="22" :span="22"
:filter-node-method="filterNode" :filter-node-method="filterNode"
@ -52,20 +52,14 @@ export default {
data() { data() {
return { return {
loading: true, loading: true,
defaultShowKeys: [],
filterText: '', filterText: '',
treeList: [], treeList: [],
selected: {}, selected: {},
defaultProps: {
children: 'children',
label: 'name'
},
node: { node: {
}, },
mapId: '', mapId: '',
expandList: [], expandList: [],
filterSelect: '', filterSelect: ''
localParamName: 'training_cityCode'
}; };
}, },
computed: { computed: {

View File

@ -5,7 +5,7 @@
</div> </div>
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" /> <drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<transition> <transition>
<router-view :product-list="productList" /> <router-view />
</transition> </transition>
</div> </div>
</template> </template>
@ -25,19 +25,12 @@ export default {
}, },
data() { data() {
return { return {
widthLeft: 450, widthLeft: 450
productList: []
}; };
}, },
computed: { computed: {
width() { width() {
return this.$store.state.app.width; return this.$store.state.app.width;
},
userId() {
return this.$store.state.user.id;
},
project() {
return getSessionStorage('project');
} }
}, },
mounted() { mounted() {
@ -51,9 +44,11 @@ export default {
const againEnter = getSessionStorage('againEnter') || null; const againEnter = getSessionStorage('againEnter') || null;
if (!againEnter) { if (!againEnter) {
launchFullscreen(); launchFullscreen();
const path = localStore.get('trainingPlatformRoute' + this.userId + this.project); const project = getSessionStorage('project');
const userId = this.$store.state.user.id;
const path = localStore.get('trainingPlatformRoute' + userId + project);
if (path && path.startsWith('/trainingPlatform')) { if (path && path.startsWith('/trainingPlatform')) {
localStore.set('orignalTrainingPlatformRoute' + this.userId + this.project, `/trainingPlatform/permission/${data[0].id}`); localStore.set('orignalTrainingPlatformRoute' + userId + project, `/trainingPlatform/permission/${data[0].id}`);
this.$router.push(path); this.$router.push(path);
} else if (data && data[0]) { } else if (data && data[0]) {
this.$router.push(`/trainingPlatform/permission/${data[0].id}`); this.$router.push(`/trainingPlatform/permission/${data[0].id}`);