| | |
| | | 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) |
| | |
| | | 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) { |
| | |
| | | }) |
| | | }, |
| | | onEachFeature: function (feature, layer) { |
| | | console.log(feature) |
| | | console.log(layer) |
| | | featureList.push(layer) |
| | | layer.addTo(featureGroup) |
| | | } |
| | |
| | | } else { |
| | | geojson.bringToFront() |
| | | } |
| | | return geojson |
| | | featureGroup.addTo(that.map) |
| | | return featureGroup |
| | | } |
| | | |
| | | removeLayer (item) { |