派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-03-10 7af28eaca09c2aa1f9a678df081abb378e22ee16
src/components/helpers/ServiceLayerHelper.js
@@ -126,10 +126,8 @@
      const res = await AjaxUtils.GetDataAsynByUrl(newUrl, {})
      if (res.data instanceof Object && Object.prototype.hasOwnProperty.call(res.data, 'features')) {
        store.commit('addSewersDatas', res.data)
        if (newUrl.indexOf('管网') !== -1 || newUrl.indexOf('四通') !== -1) {
          var layer = that.loadGeojson(res.data, item)
          that.layerArray[code] = layer
        }
      }
    } else {
      that.layerArray[code].addTo(that.map)
@@ -143,7 +141,7 @@
  loadGeojson (res, opt) {
    var that = this
    var icon = opt.icon
    const featureGroup = that.L.featureGroup().addTo(that.map)
    const featureGroup = that.L.featureGroup()
    const featureList = []
    const geojson = that.L.geoJSON(res.features, {
      style: function (feature) {
@@ -169,6 +167,8 @@
          })
      },
      onEachFeature: function (feature, layer) {
        console.log(feature)
        console.log(layer)
        featureList.push(layer)
        layer.addTo(featureGroup)
      }
@@ -233,7 +233,8 @@
    } else {
      geojson.bringToFront()
    }
    return geojson
    featureGroup.addTo(that.map)
    return featureGroup
  }
  removeLayer (item) {