From bb63e626e2222227cceb9b7a7e2ed4b632af3aa4 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期二, 05 一月 2021 11:41:23 +0800 Subject: [PATCH] 顶部表单 --- src/views/MapTemplate.vue | 33 ++++++++++++++++++--------------- 1 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/views/MapTemplate.vue b/src/views/MapTemplate.vue index 08869b5..c945854 100644 --- a/src/views/MapTemplate.vue +++ b/src/views/MapTemplate.vue @@ -21,7 +21,6 @@ import LcServiceLayer from '@components/LayerController/modules/LcServiceLayer' import LcServiceLayerFilter from '@components/LayerController/modules/LcServiceLayerFilter' import MonitorPanel from '@components/panel/MonitorPanel' -import { mapMutations, mapState } from 'vuex' import TopEnterprisePanel from "@components/panel/TopEnterprisePanel"; export default { @@ -35,10 +34,12 @@ } }, computed:{ - ...mapState({ - showServiceLayerFilter: state => state.showServiceLayerFilter, - mapConfig: state => state.mapConfig - }) + showServiceLayerFilter(){ + return this.$store.state.map.showServiceLayerFilter + }, + mapConfig(){ + return this.$store.state.map.mapConfig + } }, beforeMount(){ this.$nextTick(() => { @@ -46,12 +47,12 @@ }) }, methods:{ - ...mapMutations({ - setMapObj: 'setMapObj', - setBasemapHelper: 'setBasemapHelper', - setServiceLayerHelper: 'setServiceLayerHelper', - setVectorLayerHelper: 'setVectorLayerHelper' - }), + saveMapStatus(){ + this.$store.commit('setMapObj', this.mapObj); + this.$store.commit('setBasemapHelper', this.basemapHelper); + this.$store.commit('setServiceLayerHelper', this.serviceLayerHelper); + this.$store.commit('setVectorLayerHelper', this.vectorLayerHelper); + }, init() { const mapcontainer = this.$refs.rootmap this.mapObj = Sgis.initMap(mapcontainer) @@ -65,10 +66,12 @@ this.vectorLayerHelper = Sgis.initVectorLayersHelper(this.mapObj.map, this.mapObj.L) // 鍒濆鍖栧姩鎬佽绱犲浘灞傚姪鎵� this.vectorLayerHelper.initVectorLayers(this.mapConfig) - this.setMapObj(this.mapObj) - this.setBasemapHelper(this.basemapHelper) - this.setServiceLayerHelper(this.serviceLayerHelper) - this.setVectorLayerHelper(this.vectorLayerHelper) + + this.saveMapStatus() + // this.setMapObj(this.mapObj) + // this.setBasemapHelper(this.basemapHelper) + // this.setServiceLayerHelper(this.serviceLayerHelper) + // this.setVectorLayerHelper(this.vectorLayerHelper) } } } -- Gitblit v1.8.0