This commit is contained in:
fan 2019-10-24 18:19:28 +08:00
commit 0c67d2a077
5 changed files with 169 additions and 50 deletions

View File

@ -40,7 +40,7 @@ export default {
return this.$store.state.app.width; return this.$store.state.app.width;
}, },
height() { height() {
return this.$store.state.app.height - 60-30; return this.$store.state.app.height-60-30;
} }
}, },
created() { created() {

View File

@ -66,6 +66,7 @@ import PlanMonitorDetail from '@/views/planMonitor/detail';
import DesignPlatformHome from '@/views/designPlatform/home'; import DesignPlatformHome from '@/views/designPlatform/home';
import DesignPlatform from '@/views/designPlatform/index'; import DesignPlatform from '@/views/designPlatform/index';
import DesignPlatformUser from '@/views/designPlatform/userIndex'; import DesignPlatformUser from '@/views/designPlatform/userIndex';
import MapPreview from '@/views/designPlatform/mapPreview';
import Replay from '@/views/replay/index'; import Replay from '@/views/replay/index';
import Package from '@/views/package/index'; import Package from '@/views/package/index';
@ -196,7 +197,8 @@ export const UrlConfig = {
trainingRecord: '/design/lesson/training', trainingRecord: '/design/lesson/training',
runPlan: '/design/runPlan/detail', runPlan: '/design/runPlan/detail',
scriptHome: '/design/script/home', scriptHome: '/design/script/home',
display: '/design/display' display: '/design/display',
mapPreview: '/design/mapPreview'
}, },
designUser: { designUser: {
prefix: '/design/userlist/home', prefix: '/design/userlist/home',
@ -395,6 +397,12 @@ export const asyncRouter = [
path: 'lesson/training/:trainingId/:trainingName', path: 'lesson/training/:trainingId/:trainingName',
component: TrainingrecordManage, component: TrainingrecordManage,
hidden: true hidden: true
},
{
path: 'mapPreview/:mapId',
component: MapPreview,
hidden: true
} }
] ]
} }

View File

@ -4,7 +4,6 @@
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" /> <filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable /> <el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }">
<!-- :style="{ height: heightUp +'px' }" -->
<el-tree <el-tree
ref="tree" ref="tree"
:data="treeList" :data="treeList"
@ -31,6 +30,7 @@
<script> <script>
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { superAdmin, admin } from '@/router';
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
import FilterCity from '@/views/components/filterCity'; import FilterCity from '@/views/components/filterCity';
import localStore from 'storejs'; import localStore from 'storejs';
@ -65,8 +65,6 @@ export default {
}, },
node: { node: {
}, },
// mapId: '',
heightUp: 450,
point: { point: {
x: 0, x: 0,
y: 0 y: 0
@ -74,16 +72,8 @@ export default {
editModel: {}, editModel: {},
localParamName: 'publish_cityCode', localParamName: 'publish_cityCode',
cityCode: '' cityCode: ''
// skinCode:''
}; };
}, },
computed: {
role() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05') ||
this.$store.state.user.roles.includes('01');
}
},
watch: { watch: {
filterText(val) { filterText(val) {
this.treeList = this.treeData.filter((res) => { this.treeList = this.treeData.filter((res) => {
@ -94,9 +84,6 @@ export default {
beforeDestroy () { beforeDestroy () {
removeSessionStorage('demonList'); removeSessionStorage('demonList');
}, },
mounted() {
this.heightUp = Number(localStore.get('upHeight')?localStore.get('upHeight'):(this.height)/2);
},
methods: { methods: {
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
@ -127,6 +114,11 @@ export default {
} }
case 'map': { case 'map': {
setSessionStorage('demonList', obj.id); setSessionStorage('demonList', obj.id);
break;
}
case 'mapPreview':{
this.$router.push({ path: `${UrlConfig.design.mapPreview}/${obj.mapId}` });
break;
} }
} }
// this.$refs.menu.doClose(); // this.$refs.menu.doClose();
@ -144,24 +136,28 @@ export default {
// debugger; // debugger;
// elem.children.find(n => { return n.name.includes("")}) // elem.children.find(n => { return n.name.includes("")})
elem.children=[ elem.children=[
// { {
// id:'1', id:'1',
// name:'', name:'地图预览',
// type:'mapDesign' type:'mapPreview',
// }, mapId: elem.id,
hidden:false
},
{ {
id: '2', id: '2',
name: '课程设计', name: '课程设计',
type: 'lessonDesign', type: 'lessonDesign',
mapId: elem.id, mapId: elem.id,
skinCode: elem.skinCode skinCode: elem.skinCode,
hidden:this.isAdministrator()
}, },
{ {
id: '3', id: '3',
name: '剧本设计', name: '剧本设计',
type: 'scriptDesign', type: 'scriptDesign',
mapId: elem.id, mapId: elem.id,
skinCode: elem.skinCode skinCode: elem.skinCode,
hidden:false
// code:elem.children.find(n => { return n.name.includes("")}) // code:elem.children.find(n => { return n.name.includes("")})
}, },
{ {
@ -169,7 +165,8 @@ export default {
name: '运行图设计', name: '运行图设计',
type: 'runPlanDesign', type: 'runPlanDesign',
mapId: elem.id, mapId: elem.id,
skinCode: elem.skinCode skinCode: elem.skinCode,
hidden:false
} }
]; ];
}); });
@ -187,18 +184,15 @@ export default {
this.$messageBox(this.$t('error.refreshFailed')); this.$messageBox(this.$t('error.refreshFailed'));
} }
}, },
// refresh1(){
// },
drapHeight(height) {
this.heightUp = Number(height);
},
resize() { resize() {
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft; this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
const width = this.$store.state.app.width - 521 - this.widthLeft; const width = this.$store.state.app.width - 521 - this.widthLeft;
const height = this.$store.state.app.height - 90; const height = this.$store.state.app.height - 90;
this.$store.dispatch('config/resize', { width: width, height: height }); this.$store.dispatch('config/resize', { width: width, height: height });
} },
isAdministrator() {
return this.$store.state.user.roles.indexOf(superAdmin) || this.$store.state.user.roles.indexOf(admin);
},
// createMap() { // createMap() {
// this.$emit("createMap"); // this.$emit("createMap");
// }, // },

View File

@ -6,7 +6,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 :product-list="productList" :widthLeft="widthLeft"/>
</transition> </transition>
</el-scrollbar> </el-scrollbar>
</div> </div>

View File

@ -0,0 +1,117 @@
<template>
<div class="map-view">
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" @onMenu="onContextmenu" />
</div>
</template>
<script>
import JlmapVisual from '@/views/jlmap/index';
import { loadMapData, loadMapDataById } from '@/utils/loaddata';
export default {
name: 'mapPreview',
components: {
JlmapVisual
},
data(){
return{
size: {
width: document.documentElement.clientWidth - 400,
height: document.documentElement.clientHeight-80
},
}
},
props: {
widthLeft: {
required: true
}
},
computed: {
mapId() {
return this.$route.params.mapId;
},
height() {
return this.$store.state.app.height - 50-30;
}
},
async beforeDestroy() {
// await this.clearAllTimer();
// if (!this.isReplay) {
// await this.quit();
// }
// await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear');
// EventBus.$off('clearCheckLogin');
},
watch: {
widthLeft(val){
this.setWindowSize();
},
$route() {
this.$nextTick(() => {
this.initLoadData();
});
},
// '$store.state.map.mapViewLoadedCount': function (val) {
// // this.subscribe();
// debugger;
// this.$store.dispatch('map/setTrainWindowShow', false);
// },
'$store.state.app.windowSizeCount': function() {
this.setWindowSize();
},
},
async mounted() {
await this.setWindowSize();
await this.initLoadData();
},
methods:{
async initLoadData(){
if (parseInt(this.mapId)) {
await this.loadMapDataById(this.mapId);
} else {
this.endViewLoading();
}
},
// id
async loadMapDataById(mapId) {
try {
await loadMapDataById(mapId);
await this.$store.dispatch('training/setMapDefaultState');
await this.$store.dispatch('map/setTrainWindowShow', false);
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
//
endViewLoading(isSuccess) {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
clickEvent(em){
},
onContextmenu(em){
},
setWindowSize() {
this.$nextTick(() => {
const width = this.$store.state.app.width-this.widthLeft;
const height = this.height;
this.$store.dispatch('config/resize', { width, height });
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
});
}
}
};
</script>
<style lang="scss" scoped>
.map-view {
float: left;
width: auto;
}
</style>