Explorar o código

聚合卡顿问题

彭宇 %!s(int64=2) %!d(string=hai) anos
pai
achega
36631c16b2
Modificáronse 2 ficheiros con 10 adicións e 8 borrados
  1. 4 5
      src/components/supermap.vue
  2. 6 3
      src/views/forest.vue

+ 4 - 5
src/components/supermap.vue

@@ -974,7 +974,7 @@ export default {
         })
         let markerClick = window.L.marker([markersList[i].lat, markersList[i].lng], {
           icon: icon
-        }).addTo(this.map)
+        })
         if (markersList[i].bindPopupHtml != null && markersList[i].bindPopupHtml !== '') {
           let html = markersList[i].bindPopupHtml
           if (keepBindPopup) {
@@ -1008,14 +1008,13 @@ export default {
         if (isAggregation) {
           _that.isAggregationLayers.addLayer(markerClick)
           _that.isAggregationMyGroup = window.L.layerGroup(_that.isAggregationLayers)
-          this.map.addLayer(_that.isAggregationLayers)
         } else {
           _that.layers.push(markerClick)
           _that.myGroup = window.L.layerGroup(_that.layers)
-          this.map.addLayer(_that.myGroup)
         }
-
       }
+      _that.map.addLayer(_that.isAggregationLayers)
+      _that.map.addLayer(_that.myGroup)
     },
     setMarkersByType: function(markersList, type) { //地图标点(根据类型,可取消落点 clearMByType方法)
       const _that = this
@@ -1266,7 +1265,7 @@ export default {
 		align-items: center;
 		.input-group-addon{
 			color: $inBlue;
-			
+
 		}
 		.form-control{
 			padding: 0 .3rem;

+ 6 - 3
src/views/forest.vue

@@ -918,27 +918,30 @@ export default {
               keepBindPopup: false,
               isAggregation: false
             }
-            if (this.eventList.length > 50) {
+            if (this.eventList.length > 200) {
               markersMap.isAggregation = true
             }
             if (this.eventList[i].eventStatusValue == 'forest_event_status_1' && this.eventList[i].urgeCount == 0) {
               markersMap.click = 'showEventDialog'
               markersMap.icon = 'sj-icon-map-xinshangbao'
-              markersMap.isAggregation = false
+              markersMap.isAggregation = true
             }
             if (this.eventList[i].eventStatusValue == 'forest_event_status_1' && this.eventList[i].urgeCount > 0) {
               markersMap.click = 'showEventDialog'
               markersMap.icon = 'sj-icon-map-cuiban'
-              markersMap.isAggregation = false
+              markersMap.isAggregation = true
             } else if (this.eventList[i].eventStatusValue == 'forest_event_status_2') {
               markersMap.click = 'showEventDialog'
               markersMap.icon = 'sj-icon-map-qianshou'
+              markersMap.isAggregation = false
             } else if (this.eventList[i].eventStatusValue == 'forest_event_status_5') {
               markersMap.click = 'showEventDialog'
               markersMap.icon = 'sj-icon-map-banjie'
+              markersMap.isAggregation = false
             } else if (this.eventList[i].eventStatusValue == 'forest_event_status_6') {
               markersMap.click = 'showEventDialog'
               markersMap.icon = 'sj-icon-map-guidang'
+              markersMap.isAggregation = false
             }
             markersMap.parameter = this.eventList[i].eventCode
             markersMap.lng = this.eventList[i].longitude