Browse Source

选址结果列表飞入事件,辅助选址确定按钮事件

lkk 11 months ago
parent
commit
74c3735dc1

+ 4 - 3
src/views/siteselection/components/fzxz.vue

@@ -411,7 +411,8 @@ export default {
     submitData() {
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
-          alert("submit!");
+          // this.activeTabs = 'lsju'
+          this.$emit('updateParent','activeTabs','lsju')
         } else {
           console.log("error submit!!");
           return false;
@@ -526,10 +527,10 @@ export default {
   }
 }
 /deep/ .el-input .el-input--mini .el-input--suffix {
-  width: 284px !important;
+  width: 278px !important;
 }
 /deep/ .el-select {
-  width: 284px !important;
+  width: 278px !important;
 }
 /deep/ .el-form-item__error {
   top: 32px !important;

+ 47 - 43
src/views/siteselection/components/xzjg.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="xzjg">
     <div>项目名称XXXXXX</div>
-    <div class="box-sizing" style="height:  47%; width: 100%">
+    <div class="box-sizing" style="height: 47%; width: 100%">
       <div class="title site-title">
         <!-- <span class="block-title"
           >意向地块{{ bgList ? bgList.length : 0 }})</span
@@ -28,7 +28,7 @@
               <span class="tools">
                 <i
                   class="header-icon el-icon-place"
-                  @click="mapview(item1)"
+                  @click.stop="mapview(item1)"
                 ></i>
                 <i
                   class="header-icon el-icon-delete"
@@ -51,7 +51,7 @@
         </el-collapse>
       </el-scrollbar>
     </div>
-    <div class="box-sizing padding-bottom-60" style="height:  47%; width: 100%">
+    <div class="box-sizing padding-bottom-60" style="height: 47%; width: 100%">
       <div class="title height-50 flex-box align-center">
         <span class="block-title"
           >备选地块({{
@@ -75,7 +75,7 @@
                 item.properties.ydmj.toFixed(0)
               }})
               <span class="tools">
-                <i class="header-icon el-icon-place" @click="mapview(item)"></i>
+                <i class="header-icon el-icon-place" @click.stop="mapview(item)"></i>
                 <i
                   class="header-icon el-icon-plus"
                   @click="addprogramme($event, item)"
@@ -98,13 +98,11 @@
       </el-scrollbar>
     </div>
 
-    <div class="xz-btn flex-box" style="justify-content: space-between">
-      <div class="max-height flex-box align-center margin-left-22"></div>
-      <div class="max-height flex-box align-center">
+    <!-- <div class="xz-btn flex-box" style="justify-content: space-between">
+      <div>
         <el-button round class="btn-style" @click="resetAll">重选</el-button>
         <el-button
           round
-          class="btn-style"
           @click="downReport"
           v-if="reportText == '查看报告'"
           >下载报告</el-button
@@ -112,12 +110,11 @@
         <el-button
           type="primary"
           round
-          class="btn-style margin-right-22"
           @click="submit"
           >{{ reportText }}</el-button
         >
       </div>
-    </div>
+    </div> -->
   </div>
 </template>
 
@@ -160,11 +157,12 @@ export default {
       geoJsonEntities: null,
       xzjgObj: ghjgData,
       tempObj: ghjgData,
-      copyData:null,
+      copyData: null,
+      arrww: [],
     };
   },
   mounted() {
-    this.copyData = JSON.parse(JSON.stringify(ghjgData))
+    this.copyData = JSON.parse(JSON.stringify(ghjgData));
     this.addPolygon("规划结果", "ghjg");
     this.addPolygon("draw", "draw");
   },
@@ -229,44 +227,49 @@ export default {
     resetAll() {
       // this.xzjgObj = JSON.parse(JSON.stringify(this.tempObj))
       // parent.emit("update:xzjgObj", JSON.parse(JSON.stringify(this.tempObj)));
-      this.xzjgObj = this.copyData
+      this.xzjgObj = this.copyData;
       this.reportText = "生成报告";
       this.bgList = [];
     },
     mapview(item) {
+      this.edlARR()
       // e.stopPropagation()
-      // console.log(item, "=====");
-      // console.log(item.geometry.coordinates[0][0][0][0],'item.geometry.coordinates[0][0]');
-      // viewer.camera.flyTo({
-      //   destination: Cesium.Cartesian3.fromDegrees(
-      //     item.geometry.coordinates[0][0][0][0],
-      //     item.geometry.coordinates[0][0][0][1],
-      //     15000.0
-      //   ),
-      //   orientation: {
-      //     heading: Cesium.Math.toRadians(20.0),
-      //     pitch: Cesium.Math.toRadians(-35.0),
-      //     roll: 0.0,
-      //   },
-      // });
       let tempArr = item.geometry.coordinates[0];
+      for (let i = 0; i < tempArr.length; i++) {
+        const oneDArray = tempArr[i].reduce(
+          (accumulator, currentValue) => accumulator.concat(currentValue),
+          []
+        );
+        console.log(i);
+        let entity = new Cesium.Entity({
+          name: "地块" + i,
+          show: true,
+          polygon: {
+            hierarchy: {
+              positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
+            },
+            material: Cesium.Color.WHITE.withAlpha(0.3),
+            clampToGround: true,
+            outline: true,
+            outlineWidth: 6,
+            outlineColor: Cesium.Color.fromCssColorString("#FF0000"),
+          },
+        });
+        viewer.entities.add(entity);
+        // 存ID
+        this.arrww.push(entity.id);
+        viewer.flyTo(entity);
+      }
+    },
 
-      let entity = new Cesium.Entity({
-        name: "地块",
-        show: true,
-        position: Cesium.Cartesian3.fromDegrees(
-          obj.centroid[0],
-          res.properties.centroid[1],
-          5000
-        ),
-        clampToGround: true,
-        stroke: Cesium.Color.BLUE,
-        fill: Cesium.Color.WHITE.withAlpha(0.3), //注意:颜色必须大写,即不能为blue
-        strokeWidth: 5,
-      });
-      earth.czm.viewer.entities.add(entity);
-      // 存ID
-      this.arrww.push(entity.id);
+    edlARR() {
+      //删除路径
+      if (this.arrww.length != 0) {
+        this.arrww.forEach((item) => {
+          viewer.entities.removeById(item);
+        });
+        this.arrww = [];
+      }
     },
     submit() {
       console.log("生成报告");
@@ -306,6 +309,7 @@ export default {
 
   beforeDestroy() {
     viewer.dataSources.removeAll();
+    this.edlARR()
   },
 };
 </script>

+ 9 - 5
src/views/siteselection/index.vue

@@ -15,9 +15,9 @@
         @tab-click="tabClick"
       >
         <el-tab-pane label="辅助选址" name="fzxz">
-          <FZXZ></FZXZ>
+          <FZXZ @updateParent="changeData"></FZXZ>
         </el-tab-pane>
-        <el-tab-pane label="历史记录"  name="lsju">
+        <el-tab-pane label="历史记录" name="lsju">
           <Lsjl
             :rzBsm="rzBsm"
             :activeTabs="activeTabs"
@@ -26,7 +26,11 @@
           ></Lsjl>
         </el-tab-pane>
         <!-- :disabled="activeTabs != 'scjg'" -->
-        <el-tab-pane label="选址结果" :disabled="activeTabs != 'scjg'" name="xzjg">
+        <el-tab-pane
+          label="选址结果"
+          :disabled="activeTabs != 'scjg'"
+          name="xzjg"
+        >
           <XZJG
             :activeTabs="activeTabs"
             :loading="loading"
@@ -75,7 +79,6 @@ export default {
   methods: {
     changeData(name, updata) {
       this[name] = updata;
-      console.log(name, updata, "name, updata");
     },
     tabClick(evt) {
       this.activeTabs = evt.name;
@@ -83,8 +86,9 @@ export default {
   },
   watch: {
     activeTabs(newValue) {
-       if (newValue != "lsju")
+      if (newValue != "lsju") {
         viewer.dataSources.removeAll();
+      }
     },
   },
 };