派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-01-05 8356b1850885fe03a6bd388500a447dd5c42692c
src/components/LayerController/modules/LcServiceLayer.vue
@@ -27,10 +27,9 @@
</template>
<script>
    import {mapState, mapMutations} from "vuex";
    import WmsHelper from "../../helpers/WmsHelper";
    var wmsHelper = new WmsHelper()
    export default {
        name: "LcServiceLayer",
        components: {},
@@ -44,20 +43,17 @@
            };
        },
        computed: {
            ...mapState({
                serviceLayerHelper: (state) => {
                    return state.serviceLayerHelper
                },
                mapConfig: (state) => {
                    return state.mapConfig
                }
            }),
          serviceLayerHelper(){
              return this.$store.state.map.serviceLayerHelper
          },
          mapConfig(){
            return this.$store.state.map.mapConfig
          }
        },
        mounted() {
            // console.log('03步骤:', this.helper)
        },
        methods: {
            ...mapMutations(['setSelectedServiceLayer', 'toggleServiceLayerFilter']),
            swAllLayers(item) {
                // eslint-disable-next-line no-debugger
                item.checked = !item.checked
@@ -75,6 +71,7 @@
                console.log('该WMTS方法未实现!')
            },
            swWmsLayer(itm) {
                console.log('22222222')
                itm.checked = !itm.checked
                this.updateWms()
            },
@@ -108,7 +105,9 @@
                }
            },
            updateWms() {
                console.log('------')
                var mapConfig = this.mapConfig
                var wmsHelper = new WmsHelper()
                wmsHelper.initMapConfig(mapConfig)
                var wmsLayersMap = wmsHelper.getWmsLayersMap()
                //var filterURL = wmsHelper.getFilterURL()
@@ -117,7 +116,8 @@
                    var layers = wmsLayersMap[k]
                    var tileLayer = this.serviceLayerHelper.getTileLayer(k)
                    if (tileLayer) {
                        tileLayer.setParams({layers: layers}, true)
                        tileLayer.setParams({layers: layers.join(',')}, false)
                        tileLayer.setUrl(tileLayer.config.url,false)
                    }
                }
            }