This commit is contained in:
zyy 2019-10-24 18:28:15 +08:00
commit 6f4c8e02ba
9 changed files with 184 additions and 174 deletions

View File

@ -41,7 +41,7 @@ export default {
{
name: 'global.scan',
handle: this.qcodeEntry,
hidden: process.env.NODE_ENV != 'development'
hidden: process.env.NODE_ENV != 'development' || getSessionStorage('design')
},
{
name: 'global.quickEntry',

View File

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

View File

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

View File

@ -1,104 +0,0 @@
<template>
<div
ref="drapBox"
class="drapHeight"
:style="{width: width + 'px', height: height + 'px', top: heightUp +'px'}"
@mousedown="mousedown"
/>
</template>
<script>
import localStore from 'storejs';
export default {
name: 'DrapUp',
props: {
heightUp: {
type: Number,
required: true
},
isSave: {
type: Boolean,
default: true
},
max: {
type: Number,
default: 0
},
min: {
type: Number,
default: 0
},
width: {
type: Number,
default: 0
},
height: {
type: Number,
default: 36
}
},
data() {
return {
heightUps: 0
};
},
computed: {
heightTotol() {
return this.$store.state.app.height - 50;
},
},
mounted() {
const oDiv = this.$refs.drapBox;
oDiv.onmousedown = () => {
return false;
};
},
methods: {
mousedown(e) {
const oDiv = this.$refs.drapBox;
const maxNum = this.max || this.heightTotol-200;
const minNum = this.min || 150;
oDiv.onmousedown = function() {
return false;
};
e.stopPropagation();
window.event.cancelBubble = true;
const odiv = e.target;
const disY = e.clientY - odiv.offsetTop ;
document.onmousemove = (e) => {
let top = e.clientY - disY;
if (top > maxNum) {
top = maxNum;
} else if (top < minNum) {
top = minNum;
}
odiv.style.top = top + 'px';
this.$emit('drapHeight', top);
this.heightUps = top;
};
document.onmouseup = (e) => {
if (this.isSave) {
if (this.heightUps > minNum) {
localStore('upHeight', JSON.stringify(this.heightUps));
}
}
document.onmousemove = null;
document.onmouseup = null;
};
}
}
};
</script>
<style>
.drapHeight {
float: left;
width: 16px;
background: red;
opacity: 0;
cursor: n-resize;
position: absolute;
top: 0;
z-index: 9999;
}
</style>

View File

@ -9,10 +9,7 @@
</template>
<script>
import { setUserConfigInfo } from '@/api/management/user';
import { listPublishMap } from '@/api/jmap/map';
import {getUserMapTree,publisMapCityList} from '@/api/designPlatform';
import { getPublishMapTree } from '@/api/management/mapprd';
import { publisMapCityList} from '@/api/designPlatform';
import localStore from 'storejs';
@ -34,11 +31,11 @@ export default {
queryFunction: {
type: Function,
required: true
},
localParamName:{
type:String,
required: true
}
},
localParamName: {
type: String,
required: true
}
},
data() {
return {
@ -54,22 +51,22 @@ export default {
//
this.filterOptions=[];
let resp = this.$route.fullPath.includes('design/userlist')?await this.$Dictionary.cityType():await publisMapCityList('city_type');
resp=this.$route.fullPath.includes('design/userlist')?resp:resp.data;
let resp = this.$route.fullPath.includes('design/userlist')?await this.$Dictionary.cityType():await publisMapCityList('city_type');
resp=this.$route.fullPath.includes('design/userlist')?resp:resp.data;
const cityList = resp.sort((a, b) => {
return a.code.localeCompare(b.code);
});
this.filterOptions=cityList;
this.filterSelect = localStore.get(this.localParamName) || cityList[0].code;
this.filterOptions=cityList;
this.filterSelect = localStore.get(this.localParamName) || cityList[0].code;
this.$emit('filterSelectChange', this.filterSelect);
this.$emit('filterSelectChange', this.filterSelect);
},
filterSelectChange(filterSelect) {
//
// localStore.set('_cityCode', filterSelect);
localStore.set(this.localParamName, filterSelect);
this.$emit('filterSelectChange', filterSelect);
// localStore.set('_cityCode', filterSelect);
localStore.set(this.localParamName, filterSelect);
this.$emit('filterSelectChange', filterSelect);
}
}
};

View File

@ -4,7 +4,6 @@
<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-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }">
<!-- :style="{ height: heightUp +'px' }" -->
<el-tree
ref="tree"
:data="treeList"
@ -31,6 +30,7 @@
<script>
import { listPublishMap } from '@/api/jmap/map';
import { UrlConfig } from '@/router/index';
import { superAdmin, admin } from '@/router';
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
import FilterCity from '@/views/components/filterCity';
import localStore from 'storejs';
@ -65,8 +65,6 @@ export default {
},
node: {
},
// mapId: '',
heightUp: 450,
point: {
x: 0,
y: 0
@ -74,16 +72,8 @@ export default {
editModel: {},
localParamName: 'publish_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: {
filterText(val) {
this.treeList = this.treeData.filter((res) => {
@ -94,9 +84,6 @@ export default {
beforeDestroy () {
removeSessionStorage('demonList');
},
mounted() {
this.heightUp = Number(localStore.get('upHeight')?localStore.get('upHeight'):(this.height)/2);
},
methods: {
filterNode(value, data) {
if (!value) return true;
@ -110,24 +97,29 @@ export default {
},
clickEvent(obj, data, ele) {
switch (obj.type) {
case 'scriptDesign': {
setSessionStorage('designType', 'scriptDesign');
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?skinCode=${obj.skinCode}` });
break;
}
case 'lessonDesign': {
setSessionStorage('designType', 'lessonDesign');
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}/${obj.skinCode}`, query: {cityCode: this.cityCode} });
break;
}
case 'runPlanDesign': {
setSessionStorage('designType', 'runPlanDesign');
this.$router.push({ path: `${UrlConfig.design.runPlan}/${obj.mapId}?skinCode=${obj.skinCode}` });
break;
}
case 'map': {
setSessionStorage('demonList', obj.id);
}
case 'scriptDesign': {
setSessionStorage('designType', 'scriptDesign');
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?skinCode=${obj.skinCode}` });
break;
}
case 'lessonDesign': {
setSessionStorage('designType', 'lessonDesign');
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}/${obj.skinCode}`, query: {cityCode: this.cityCode} });
break;
}
case 'runPlanDesign': {
setSessionStorage('designType', 'runPlanDesign');
this.$router.push({ path: `${UrlConfig.design.runPlan}/${obj.mapId}?skinCode=${obj.skinCode}` });
break;
}
case 'map': {
setSessionStorage('demonList', obj.id);
break;
}
case 'mapPreview':{
this.$router.push({ path: `${UrlConfig.design.mapPreview}/${obj.mapId}` });
break;
}
}
// this.$refs.menu.doClose();
},
@ -144,24 +136,28 @@ export default {
// debugger;
// elem.children.find(n => { return n.name.includes("")})
elem.children=[
// {
// id:'1',
// name:'',
// type:'mapDesign'
// },
{
id:'1',
name:'地图预览',
type:'mapPreview',
mapId: elem.id,
hidden:false
},
{
id: '2',
name: '课程设计',
type: 'lessonDesign',
mapId: elem.id,
skinCode: elem.skinCode
skinCode: elem.skinCode,
hidden:this.isAdministrator()
},
{
id: '3',
name: '剧本设计',
type: 'scriptDesign',
mapId: elem.id,
skinCode: elem.skinCode
skinCode: elem.skinCode,
hidden:false
// code:elem.children.find(n => { return n.name.includes("")})
},
{
@ -169,7 +165,8 @@ export default {
name: '运行图设计',
type: 'runPlanDesign',
mapId: elem.id,
skinCode: elem.skinCode
skinCode: elem.skinCode,
hidden:false
}
];
});
@ -187,18 +184,15 @@ export default {
this.$messageBox(this.$t('error.refreshFailed'));
}
},
// refresh1(){
// },
drapHeight(height) {
this.heightUp = Number(height);
},
resize() {
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
const width = this.$store.state.app.width - 521 - this.widthLeft;
const height = this.$store.state.app.height - 90;
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() {
// this.$emit("createMap");
// },

View File

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

View File

@ -3,9 +3,7 @@
<div slot="header" class="clearfix">
<span>{{ $t('global.mapList') }}</span>
</div>
<!-- v-if="project!=='xty' " -->
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
<!-- v-if="project!=='xty' " -->
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }">
<el-tree