Explorar el Código

feat:点击采砂区弹窗

lavinia hace 3 meses
padre
commit
1f37166c9b
Se han modificado 1 ficheros con 10 adiciones y 35 borrados
  1. 10 35
      src/views/components/layerList/index.vue

+ 10 - 35
src/views/components/layerList/index.vue

@@ -181,9 +181,6 @@ export default {
             layerCache[id].show = true
           } else {
             await this.loadGeoJsonLayer(node)
-            if (node.type === 'csq') {
-              this.getCsqLayer(node.label)
-            }
           }
         }
       }
@@ -219,9 +216,6 @@ export default {
             layerCache[child.id].show = true
           } else {
             await this.loadGeoJsonLayer(child)
-            if (child.type === 'csq') {
-              this.getCsqLayer(child.label)
-            }
           }
         }
       }
@@ -434,6 +428,16 @@ export default {
           },
           { template: false, offsetY: 0 }
         )
+      } else if (['3-1', '3-2', '3-3'].includes(layer.id)) {
+         const coorList = {
+        兴平市宜空采砂区: [108.352091, 34.202407, 100],
+        兴平市团结采砂区: [108.360076, 34.20512, 100],
+        兴平市汤坊龙兴1区采砂区: [108.474301, 34.21255, 100]
+      }
+       const position = coorList[layer.options.name]
+       layer.on(this.mars3d.EventType.click, function (event) {
+        _that.$globalEventBus.$emit('clickCsqModal', { title: layer.options.name, position: position })
+      })
       } 
     },
     getMonitorData() {
@@ -512,35 +516,6 @@ export default {
         // window.map.removeLayer(graphicsLayer)
       }
     },
-    // 采砂区柱状图
-    getCsqLayer(name) {
-      const coorList = {
-        兴平市宜空采砂区: [108.352091, 34.202407, 100],
-        兴平市团结采砂区: [108.360076, 34.20512, 100],
-        兴平市汤坊龙兴1区采砂区: [108.474301, 34.21255, 100]
-      }
-      if (csqGraphicsLayer) {
-        csqGraphicsLayer.show = true
-      } else {
-        csqGraphicsLayer = new this.mars3d.layer.GraphicLayer()
-        window.map.addLayer(csqGraphicsLayer)
-      }
-      const position = coorList[name]
-      const graphic = new this.mars3d.graphic.BillboardEntity({
-        position: position,
-        style: {
-          image: require('@/assets/image/common/csq.png'),
-          scale: 1,
-          horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
-          verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM
-        }
-      })
-      csqGraphicsLayer.addGraphic(graphic)
-      let that = this
-      graphic.on(this.mars3d.EventType.click, function () {
-        that.$globalEventBus.$emit('clickCsqModal', { title: name, position: position })
-      })
-    },
     removeCsqLayer(name) {
       if (csqGraphicsLayer) {
         const graphic = csqGraphicsLayer.getGraphicById(name)