Ver código fonte

智能选址前端

liutao 2 meses atrás
pai
commit
fbc9096d57

+ 22 - 3
web_ui/src/views/industrial-land/AiIndustriaLandDetail.vue

@@ -236,6 +236,7 @@
           @toggle="toggleInfoTab"
           @cluster="addClusterLayer"
           @gowkt="goWkt"
+          @locationByGeojson="locationByGeojson"
           @clear="clearMark"
           :item="detailData"
         ></znxz-detail>
@@ -412,7 +413,7 @@ export default {
       startTime: 0,
       showIndentify: false,
       detailData: null,
-
+      cyyqLayer: null,
       legend: [
         {
           name: "可利用资源",
@@ -809,7 +810,7 @@ export default {
             );
             item.layer.setZIndex(item.zindex);
           }
-        } 
+        }
         this.map.addLayer(item.layer);
       } else {
         if (item.layer != undefined || item.layer != null) {
@@ -1051,12 +1052,26 @@ export default {
               },
             });
             that.geojsonLayer = geos.addTo(that.map);
-            that.map.fitBounds(geos.getBounds(), { maxZoom: 17 });
+            that.map.fitBounds(geos.getBounds(), { padding: [200, 200] });
           }
         });
 
       // });
     },
+    locationByGeojson(geojson, name) {
+      if (this.cyyqLayer) {
+        this.map.removeLayer(this.cyyqLayer);
+        this.cyyqLayer = null;
+      }
+      var layer = L.geoJSON(geojson, {
+        style: function (feature) {
+          return { color: "yellow", fillOpacity: 0 };
+        },
+      });
+      this.cyyqLayer = layer.addTo(this.map);
+      layer.bindPopup(name).openPopup();
+      this.map.fitBounds(layer.getBounds(), { padding: [200, 200] });
+    },
     //获取地块信息
     async getActiveItemGeometry(item) {
       return new Promise((resolve, reject) => {
@@ -1174,6 +1189,10 @@ export default {
           this.map.removeLayer(ele);
         });
       }
+      if (this.cyyqLayer) {
+        this.map.removeLayer(this.cyyqLayer);
+        this.cyyqLayer = null;
+      }
     },
     addClusterLayer(points) {
       this.nearMarkerList.forEach((ele) => {

+ 4 - 2
web_ui/src/views/industrial-land/ZnxzDetail.vue

@@ -1076,10 +1076,12 @@ export default {
       }, 500);
     },
     zbcyClick(item) {
-      console.log(item);
+      let geojson = JSON.parse(item.geom);
+      this.$emit("locationByGeojson", geojson,item.name);
     },
     zbyqClick(item) {
-      console.log(item);
+      let geojson = JSON.parse(item.geom);
+      this.$emit("locationByGeojson", geojson,item.name);
     },
     //地类图斑定位
     goInfoLocation(wkt) {

+ 2 - 2
web_ui/static/config.js

@@ -132,8 +132,8 @@
             id: "GYYDDC",
             checked: false,
             type: 'geoserver',
-            url: 'https://kjzl.zrzyt.zj.gov.cn/zdzy/geoserver/sde/wms',
-            layername: 'sde:zjgyddc',
+            url: 'https://kjzl.zrzyt.zj.gov.cn/zdzy/geoserver/test/wms',
+            layername: 'test:zjgyydc',
             zindex: 1
           }
         ]