Browse Source

智能选址范围显隐控制

maxiaoxiao 9 months ago
parent
commit
be99ad8f4a

+ 1 - 1
src/views/complianceAnalysis/components/lsjl.vue

@@ -225,7 +225,7 @@ export default {
     },
     zoomItem(item) {
       this.now = item.bsm;
-      item.geom && this.addPolygon(parse(item.geom));
+      // item.geom && this.addPolygon(parse(item.geom));
     },
     // 加载GeoJSON数据
     addPolygon(geojson) {

+ 2 - 16
src/views/complianceAnalysis/components/scjg.vue

@@ -93,7 +93,7 @@ export default {
       tempdataSourcesId: null,
       fileid: 1,
       reflist: {},
-      isshowAll: true,
+      isshowAll: false,
     };
   },
   mounted() {
@@ -238,6 +238,7 @@ export default {
         viewer.dataSources.add(dataSource);
         viewer.zoomTo(dataSource);
         dataSourceList[id] = dataSource;
+        if (id == "all") this.isshowAll = true;
         // 可以获取实体并进行操作
         // dataSource.entities.values.forEach((entity) => {
         //   // 你可以在这里设置实体的属性,例如位置、颜色等
@@ -316,21 +317,6 @@ export default {
     }
   }
 
-  .eicon {
-    width: 20px;
-    height: 20px;
-    margin-top: 10px;
-    background-size: 100% 100%;
-    display: inline-block;
-    cursor: pointer;
-  }
-  .eyes {
-    background-image: url("/static/images/ghzc/eyes.png");
-  }
-  .close_eyes {
-    background-image: url("/static/images/ghzc/close_eyes.png");
-  }
-
   .echars {
     margin-bottom: 10px;
     .echartTitle {

+ 17 - 0
src/views/complianceAnalysis/ghzc.scss

@@ -337,6 +337,23 @@
         -moz-appearance: none;
         /* 移除Firefox中的上下箭头 */
     }
+
+    .eicon {
+        width: 20px;
+        height: 20px;
+        margin-top: 10px;
+        background-size: 100% 100%;
+        display: inline-block;
+        cursor: pointer;
+    }
+
+    .eyes {
+        background-image: url("/static/images/ghzc/eyes.png");
+    }
+
+    .close_eyes {
+        background-image: url("/static/images/ghzc/close_eyes.png");
+    }
 }
 
 .flex-box {

+ 32 - 5
src/views/siteselection/components/xzjg.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="xzjg">
-    <div>项目名称:{{ rzMc }}</div>
+    <div>
+      <span class="xmmc">
+          项目名称:
+          <span class="text">{{ rzMc}}</span>
+        </span>
+      <div
+        class="eicon"
+        :class="isshowAll ? 'eyes' : 'close_eyes'"
+        @click="allChange('all')"
+      ></div>
+    </div>
     <div class="box-sizing" style="height: 47%; width: 100%">
       <div class="title block-title">
         意向地块 ({{ bgList ? bgList.length : 0 }})
@@ -140,6 +150,7 @@ export default {
       tempdataSourcesId: null,
       xzjgBSM: "",
       itemObj: {},
+      isshowAll: false,
     };
   },
   mounted() {
@@ -155,12 +166,20 @@ export default {
           this.xzjgObj.dks.forEach((item) => {
             this.drawWktPloygon(item.geom, "#0000ff"); //item.dkbm
           });
-          this.drawWktPloygon(res.data.geom, "#ff0000"); //res.data.bsm
+          this.drawWktPloygon(res.data.geom, "#ff0000", 'all'); //res.data.bsm
         } else {
           this.$message.error(res.message);
         }
       });
     },
+    allChange(id) {
+      this.isshowAll = !this.isshowAll;
+      if (dataSources[id]) {
+        dataSources[id].show = this.isshowAll;
+      } else {
+        this.loadGeoJSON(parse(this.tempObj.geom), "#ff0000", "all");
+      }
+    },
     download() {
       let dkIds = [];
       if (this.bgList.length) {
@@ -241,7 +260,8 @@ export default {
 
     // 加载GeoJSON数据
     loadGeoJSON(geojson, yanse, id, height) {
-      let fcolor = id
+      let fcolor =
+      id && id != "all"
         ? Cesium.Color.fromCssColorString(yanse)
         : Cesium.Color.WHITE;
       const dataSource = new Cesium.GeoJsonDataSource();
@@ -280,9 +300,9 @@ export default {
           });
           // viewer.zoomTo(data);
           if (id) {
-            this.tempdataSourcesId = id;
             dataSources[id] = data;
           }
+          if (id == "all") this.isshowAll = true;
         });
     },
     addprogramme(e, item) {
@@ -354,8 +374,10 @@ export default {
       this.bgList = [];
     },
     mapview(item) {
-      if (!dataSources[item.id])
+      if (!dataSources[item.id]){
         this.drawWktPloygon(item.geom, "#ff0000", item.id);
+        this.tempdataSourcesId = id;
+      }
     },
     pullUp(item, height) {
       if (!dataSources[item.id])
@@ -429,6 +451,11 @@ export default {
   box-sizing: border-box;
   padding: 0px 10px;
 
+  .xmmc {
+      width: calc(100% - 60px);
+      display: inline-block;
+  }
+
   .blue {
     color: #409eff;
   }