派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-03-12 1bbce96c3e694c834a830b2c038f9303e35895b5
src/components/helpers/ServiceLayerHelper.js
@@ -140,11 +140,10 @@
     * @param res
     */
  loadGeojson (res, opt) {
    var that = this
    var icon = opt.icon
    const featureGroup = that.L.featureGroup()
    const featureGroup = this.L.featureGroup()
    const featureList = []
    const geojson = that.L.geoJSON(res.features, {
    const geojson = this.L.geoJSON(res.features, {
      style: function (feature) {
        return {
          fill: styles.defaultLineStyle.fill,
@@ -157,8 +156,8 @@
          dashSpeed: styles.defaultLineStyle.dashSpeed
        }
      },
      pointToLayer: function (geoJsonPoint, latlng) {
        return that.L.canvasMarker(latlng,
      pointToLayer: (geoJsonPoint, latlng) => {
        return this.L.canvasMarker(latlng,
          {
            img: {
              // url: 'assets/images/map/marker-icon.png',
@@ -167,21 +166,19 @@
            }
          })
      },
      onEachFeature: function (feature, layer) {
        console.log(feature)
        console.log(layer)
      onEachFeature: (feature, layer) => {
        featureList.push(layer)
        layer.bindPopup(function (layer) {
          that.popupComp.setDatas(layer)
          that.popupComp.setShow()
          return that.popupComp.$el
        layer.bindPopup((layer) => {
          this.popupComp.setDatas(layer)
          this.popupComp.setShow()
          return this.popupComp.$el
        }, {
          className: 's-map-popup',
          minWidth: 300,
          closeButton: false,
          autoClose: false
        })
          .bindTooltip(function (layer) {
          .bindTooltip((layer) => {
            const nameId = layer.feature.id
            let name = ''
            if (nameId.indexOf('三通') !== -1 || nameId.indexOf('四通') !== -1 || nameId.indexOf('窨井') !== -1) {
@@ -194,7 +191,7 @@
            }
            return name
          }, { direction: 'bottom', offset: [0, 15], sticky: true })
          .on('mouseover', function (e) {
          .on('mouseover', (e) => {
            const type = e.target.feature.geometry.type
            if (type === 'LineString' || type === 'MultiLineString') {
              layer.setStyle({ weight: 8, color: '#00ffff' })
@@ -208,7 +205,7 @@
              layer.bringToFront()
            }
          }).on('mouseout', function (e) {
          }).on('mouseout', (e) => {
            const type = e.target.feature.geometry.type
            if (type === 'LineString' || type === 'MultiLineString') {
              layer.setStyle({ weight: styles.defaultLineStyle.weight, color: styles.defaultLineStyle.color })
@@ -225,8 +222,8 @@
      }
    })
    store.commit('addSewersDatas', geojson)
    featureGroup.addTo(that.map)
    that.setZIndex(featureGroup)
    featureGroup.addTo(this.map)
    this.setZIndex(featureGroup)
    return featureGroup
  }