调整代码

This commit is contained in:
zyy 2019-07-25 10:55:31 +08:00
parent 8b46424116
commit cf0cabadaf

View File

@ -1,18 +1,18 @@
<template> <template>
<div class="jlmap-canvas" :style="{ width: width+'px', height: height+28+'px' }"> <div class="jlmap-canvas" :style="{ width: width+'px', height: height+28+'px' }">
<div :id="canvasId" style="background: #000;"></div> <div :id="canvasId" style="background: #000;" />
<progress-bar ref="progressBar" ></progress-bar> <progress-bar ref="progressBar" />
<zoom-box @setShrink="setShrink" @setMagnify="setMagnify" :scaleRate="dataZoom.scaleRate" v-if="!isScreen"></zoom-box> <zoom-box :scale-rate="dataZoom.scaleRate" v-if="!isScreen" @setShrink="setShrink" @setMagnify="setMagnify" />
<div v-if="show" class="zoom-view" :style="{ width: width +'px'}"> <div v-if="show" class="zoom-view" :style="{ width: width +'px'}">
<el-form :model="dataZoom" label-width="60px" size="mini" inline> <el-form :model="dataZoom" label-width="60px" size="mini" inline>
<el-form-item label="偏移:"> <el-form-item label="偏移:">
<el-input v-model="dataZoom.offsetX" :disabled="true"></el-input> <el-input v-model="dataZoom.offsetX" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input v-model="dataZoom.offsetY" :disabled="true"></el-input> <el-input v-model="dataZoom.offsetY" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="缩放:" style="float: right"> <el-form-item label="缩放:" style="float: right">
<el-input v-model="dataZoom.scaleRate" :disabled="true"></el-input> <el-input v-model="dataZoom.scaleRate" :disabled="true" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -25,8 +25,8 @@
import Jlmap from '@/jmap/map'; import Jlmap from '@/jmap/map';
import ZoomBox from './zoom/zoom'; import ZoomBox from './zoom/zoom';
import ProgressBar from '@/views/components/progressBar/index'; import ProgressBar from '@/views/components/progressBar/index';
import { mapGetters } from 'vuex'; // import { mapGetters } from 'vuex';
import { Loading } from 'element-ui'; // import { Loading } from 'element-ui';
export default { export default {
name: 'JlmapVisual', name: 'JlmapVisual',
@ -45,8 +45,8 @@
scaleRate: '1' scaleRate: '1'
}, },
sectionActive: false, sectionActive: false,
operate: null, operate: null
} };
}, },
computed: { computed: {
// ...mapGetters('training', [ // ...mapGetters('training', [
@ -66,7 +66,7 @@
return true; return true;
}, },
isScreen() { isScreen() {
return this.$route.params.mode === 'dp' return this.$route.params.mode === 'dp';
} }
}, },
watch: { watch: {
@ -120,7 +120,7 @@
methods: { methods: {
// jlmap // jlmap
initLoadPage() { initLoadPage() {
const dom = document.getElementById(this.canvasId).oncontextmenu = function (e) { document.getElementById(this.canvasId).oncontextmenu = function (e) {
return false; return false;
}; };
@ -162,7 +162,7 @@
window.document.oncontextmenu = function () { window.document.oncontextmenu = function () {
return false; return false;
} };
}, },
// jlmap // jlmap
resetSize() { resetSize() {
@ -171,15 +171,15 @@
this.height = this.$store.state.config.height; this.height = this.$store.state.config.height;
if (this.$jlmap) { if (this.$jlmap) {
this.$jlmap.resizeZr({ width: this.width, height: this.height }); this.$jlmap.resize({ width: this.width, height: this.height });
} }
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode }); // this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
setTimeout(() => { // setTimeout(() => {
this.$store.dispatch('config/resetCanvasOffset'); // this.$store.dispatch('config/resetCanvasOffset');
this.$store.dispatch('training/emitTipFresh'); // this.$store.dispatch('training/emitTipFresh');
}, 100); // }, 100);
}); });
}, },
// //
@ -199,7 +199,7 @@
// Level // Level
setShowPhysicalLevel(levels) { setShowPhysicalLevel(levels) {
if (this.$jlmap) { if (this.$jlmap) {
onsole.log('设置物理视图Level'); console.log('设置物理视图Level');
// this.$jlmap.setShowPhysicalLevel(levels); // this.$jlmap.setShowPhysicalLevel(levels);
} }
}, },
@ -215,13 +215,13 @@
this.dataZoom.offsetY = dataZoom._offsetY.toFixed(1) + ''; this.dataZoom.offsetY = dataZoom._offsetY.toFixed(1) + '';
this.dataZoom.scaleRate = dataZoom._scaleRate + ''; this.dataZoom.scaleRate = dataZoom._scaleRate + '';
let skinStyle = this.$store.state.map.map.skinStyle; const skinStyle = this.$store.state.map.map.skinStyle;
if (skinStyle) { if (skinStyle) {
let param = { const param = {
scaleRate: this.dataZoom.scaleRate, scaleRate: this.dataZoom.scaleRate,
skinCode: skinStyle, skinCode: skinStyle,
offsetY: this.dataZoom.offsetY, offsetY: this.dataZoom.offsetY
} };
localStore.set(`scaleRate_${skinStyle}`, JSON.stringify(param)); // localStore.set(`scaleRate_${skinStyle}`, JSON.stringify(param)); //
} }
@ -276,7 +276,7 @@
this.$jlmap.setOptions({scale: 1}); this.$jlmap.setOptions({scale: 1});
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.jlmap-canvas { .jlmap-canvas {