From 2dee2fd0049aca6e2af948dabe19dbfecd889318 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 23 五月 2023 09:38:46 +0800
Subject: [PATCH] 1.合并代码

---
 src/views/Tools/LayerTree.vue |  207 ++++++++++++++++++---------------------------------
 1 files changed, 74 insertions(+), 133 deletions(-)

diff --git a/src/views/Tools/LayerTree.vue b/src/views/Tools/LayerTree.vue
index 99ec7cd..7da5a56 100644
--- a/src/views/Tools/LayerTree.vue
+++ b/src/views/Tools/LayerTree.vue
@@ -58,18 +58,17 @@
              v-show="menuVisible">
       <div class="edit"
            @click="showLayerAttribute()"
-           v-if="!showlocal && !shwoHistogram"
-           v-show="!firstLevel">
+           v-if="showProp && !shwoHistogram">
         <i class="el-icon-tickets"></i>&nbsp;&nbsp;灞炴��
       </div>
       <div class="edit"
            @click="positioning()"
-           v-if="showlocal">
+           v-if="showLocal">
         <i class="el-icon-tickets"></i>&nbsp;&nbsp;瀹氫綅
       </div>
       <div class="edit"
            @click="pellucidity()"
-           v-if="showlocal">
+           v-if="showOpacity">
         <i class="el-icon-tickets"></i>&nbsp;&nbsp;閫忔槑搴�
       </div>
       <div class="edit"
@@ -95,13 +94,20 @@
   components: { queryinfo },
   data () {
     return {
-      shwoHistogram: false,
-      showlocal: false,
+      showProp: false, // 灞炴��
+      shwoHistogram: false, // 閽诲瓟鏌辩姸鍥�
+      showLocal: false, // 瀹氫綅
+      showOpacity: false, // 涓嶉�忔槑搴�
+      menuVisible: false, // 鑿滃崟
+      levelArray: [ // 璋冭瘯鏁扮粍
+        0, 40000000, 20000000, 10000000, 5000000, 2000000, 1000000, 500000,
+        250000, 200000, 100000, 50000, 17000, 9000, 5000, 2000, 1000, 500, 200,
+        100, 50, 25, 10, 0,
+      ],
       eleId: "",
       isShow: false,
       currentData: "",
       currentNode: "",
-      menuVisible: false,
       firstLevel: false,
       filterText: "",
       appendNodetitle: "",
@@ -193,7 +199,6 @@
         let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁
         branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊�
         // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛岄偅涔� a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛�
-        // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋�
         return father.pid == 0; // 杩斿洖涓�绾ц彍鍗�
       });
     },
@@ -215,48 +220,25 @@
       //  瑕佸強鏃跺叧鎺夌洃鍚紝涓嶅叧鎺夌殑鏄竴涓潙锛屼笉淇′綘璇曡瘯锛岃櫧鐒跺墠鍙版樉绀虹殑鏃跺�欐病鏈夊暐姣涚梾锛屽姞涓�涓猘lert浣犲氨鐭ラ亾浜�
       document.removeEventListener("click", this.rmListener);
     },
-
-
-
-    //杞瓟鏌辩姸鍥�
-    async histogram () {
-      this.menuVisible = false
-      var layer = this.currentData.enName.replaceAll("_", "");
-      this.$store.state.mapSpaceQueryLayer = layer;
-      this.$store.state.mapPopBoxFlag = "2";
-      this.$store.state.showPopBoxFlag = true;
+    // 杩囨护鑺傜偣
+    filterNode (value, data) {
+      if (!value) return true;
+      return data.cnName.indexOf(value) !== -1;
     },
     // 榧犳爣鍙冲嚮浜嬩欢
-    rightClick (event, object, Node, element) {
-      if (object.type == 1) {
-        return
-      }
+    rightClick (event, object, node, element) {
+      debugger
+      if (object.type == 1 || node.data.children != null) return;
+
+      this.currentNode = node;
       this.currentData = object;
-      this.currentNode = Node;
+      this.$store.state.propertiesName = object;
 
-      this.$store.state.propertiesName = this.currentData;
-      if (this.currentData.serveType == "Tileset" || this.currentData.serveType == "3DML") {
-        this.showModelAttach = true;
-      } else {
-        this.showModelAttach = false;
-      }
-      if (this.currentData.enName == "s_explorationpoint") {
-        this.shwoHistogram = true;
-      } else {
-        this.shwoHistogram = false;
-      }
-
-      if (Node.data.children == null) {
-        this.firstLevel = false;
-      } else {
-        this.firstLevel = true;
-      }
-      if (Node.data.children == null && Node.data.serveType == "Tileset" || Node.data.serveType == "3DML") {
-        this.showlocal = true;
-      } else if (Node.data.children == null && Node.data.serveType != "Tileset" || Node.data.serveType == "3DML") {
-        this.showlocal = false;
-      }
-      this.menuVisible = true;
+      this.showProp = object.serveType == "WMS"; // 灞炴��
+      this.shwoHistogram = this.showProp && object.enName == "s_explorationpoint"; // 閽诲瓟鏌辩姸鍥�
+      this.showLocal = ["Tileset", "3DML", "Mpt", "TMS", "DOM", "DEM"].indexOf(object.serveType) > -1; // 瀹氫綅
+      this.showOpacity = ["Tileset", "3DML"].indexOf(object.serveType) > -1; // 涓嶉�忔槑搴�
+      this.menuVisible = this.showProp || this.shwoHistogram || this.showLocal || this.showOpacity; // 鑿滃崟
 
       this.$refs.card.$el.style.left = event.pageX + 20 + "px";
       this.$refs.card.$el.style.top = event.pageY + "px";
@@ -264,14 +246,50 @@
     // 灞炴�ф樉绀�
     showLayerAttribute (data) {
       this.rmListener();
-      this.menuVisible = false
       this.currentData = data ? data : this.currentData;
       var layer = this.currentData.enName.replaceAll("_", "");
       this.$store.state.mapSpaceQueryLayer = layer;
       this.$store.state.showPopBoxFlag = true;
       this.$store.state.mapPopBoxFlag = "2";
     },
-    // 妯″瀷璁剧疆閫忔槑搴�
+    // 瀹氫綅
+    async positioning () {
+      this.menuVisible = false;
+      if (["Tileset", "3DML"].indexOf(this.currentData.serveType) > -1) {
+        for (var i in Viewer.scene.primitives._primitives) {
+          if (Viewer.scene.primitives._primitives[i].id == this.currentData.cnName) {
+            Viewer.flyTo(Viewer.scene.primitives._primitives[i]);
+            break;
+          }
+        }
+        return;
+      }
+
+      if (["TMS", "DOM", "DEM"].indexOf(this.currentData.serveType) > -1 && this.currentData.pubid) {
+        var data = await comprehensive_selectPubById({ id: this.currentData.pubid });
+        if (data.result && data.result.geom) {
+          var wkt = this.$wkt.parse(data.result.geom);
+          var height = this.getHeight(wkt.coordinates[2]);
+          Viewer.camera.flyTo({
+            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], height), // 2000
+          });
+        }
+        return;
+      }
+
+      if ("Mpt" == this.currentData.serveType) {
+        viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(101.8, 37.9, 10000000.0) }); // 涓浗
+      }
+    },
+    // 閽诲瓟鏌辩姸鍥�
+    async histogram () {
+      this.menuVisible = false
+      var layer = this.currentData.enName.replaceAll("_", "");
+      this.$store.state.mapSpaceQueryLayer = layer;
+      this.$store.state.mapPopBoxFlag = "2";
+      this.$store.state.showPopBoxFlag = true;
+    },
+    // 閫忔槑搴�
     pellucidity () {
       this.rmListener();
       this.menuVisible = false
@@ -284,82 +302,11 @@
         }
       }
     },
-    // 妯″瀷瀹氫綅
-    positioning () {
-      this.menuVisible = false
-      for (var i in Viewer.scene.primitives._primitives) {
-        if (
-          Viewer.scene.primitives._primitives[i].id == this.currentData.cnName
-        ) {
-          Viewer.flyTo(Viewer.scene.primitives._primitives[i]);
-        }
-      }
-    },
-    // 缂栬緫鑺傜偣
-    editNode (data) {
-      this.rmListener();
-      this.menuVisible = false
-      this.currentData = data ? data : this.currentData;
-      if (!this.currentData.isEdit) {
-        this.$set(this.currentData, "isEdit", true);
-      }
-      // 鑾峰彇鐒︾偣
-      this.$nextTick(() => {
-        this.$refs["slotTreeInput" + this.currentData.id].focus();
-      });
-    },
-    menuMoveF (type) {
-      // 灏嗗彉鍔ㄤ箣鍓嶇殑node澶囦唤
-      var node = this.currentNode;
-      var data = this.currentData;
-      let copyNode = this.currentNode;
+    // 鑾峰彇楂樺害
+    getHeight (level) {
+      if (level > -1 && level < 23) return this.levelArray[level];
 
-      let nodeData = {};
-      if (type === "up") {
-        // 涓婄Щ
-        if (node.previousSibling) {
-          // 鍒犻櫎鍘熷厛鐨刵ode
-          this.$refs.tree.remove(node.data);
-          // 鎷垮埌copy鐨刵ode
-          // nodeData = CircularJSON.parse(window.sessionStorage.getItem('menuNode'))
-          // // 澶嶅埗璇ode鍒版寚瀹氫綅缃�(鍙傛暟锛�1. 瑕佸鍔犵殑鑺傜偣鐨� data 2. 瑕佸鍔犵殑鑺傜偣鐨勫悗涓�涓妭鐐圭殑 data銆乲ey 鎴栬�� node)
-          // this.$refs.tree.insertBefore(nodeData.data,nodeData.previousSibling.data)
-          window.sessionStorage.removeItem("menuNode");
-        } else {
-          this.$message.warning("璇ヨ彍鍗曞凡缁忔槸褰撳墠灞傛渶涓婄骇");
-        }
-      } else {
-        // 涓嬬Щ
-        if (node.nextSibling) {
-          this.$refs.tree.remove(node.data);
-          nodeData = CircularJSON.parse(
-            window.sessionStorage.getItem("menuNode")
-          );
-          // 鍙傛暟锛�1. 瑕佸鍔犵殑鑺傜偣鐨� data 2. 瑕佸鍔犵殑鑺傜偣鐨勫墠涓�涓妭鐐圭殑 data銆乲ey 鎴栬�� node
-          this.$refs.tree.insertAfter(nodeData.data, nodeData.nextSibling.data);
-          window.sessionStorage.removeItem("menuNode");
-        } else {
-          this.$message.warning("璇ヨ彍鍗曞凡缁忔槸褰撳墠灞傛渶涓嬬骇");
-        }
-      }
-    },
-    handleDragStart (node, ev) {
-      console.log("drag start", node);
-    },
-    handleDragEnter (draggingNode, dropNode, ev) {
-      console.log("tree drag enter: ", dropNode.label);
-    },
-    handleDragLeave (draggingNode, dropNode, ev) {
-      console.log("tree drag leave: ", dropNode.label);
-    },
-    handleDragOver (draggingNode, dropNode, ev) {
-      console.log("tree drag over: ", dropNode.label);
-    },
-    handleDragEnd (draggingNode, dropNode, dropType, ev) {
-      console.log("tree drag end: ", dropNode && dropNode.label, dropType);
-    },
-    handleDrop (draggingNode, dropNode, dropType, ev) {
-      console.log("tree drop: ", dropNode.label, dropType);
+      return this.levelArray[this.levelArray.length - 1];
     },
     handleCheckChange (data, checked, indeterminate) {
       if (data.type == 1) {
@@ -737,10 +684,10 @@
 
         layer.name = res.cnName;
         if (data.result.geom) {
-          var wkt = this.$wkt.parse(data.result.geom);
-          Viewer.camera.flyTo({
-            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000),
-          });
+          // var wkt = this.$wkt.parse(data.result.geom);
+          // Viewer.camera.flyTo({
+          //   destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000),
+          // });
         }
         this.setChangeWMS();
       }
@@ -767,12 +714,6 @@
       //淇敼妯″瀷鐭╅樀
       tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
       // Viewer.flyTo(tileset);
-    },
-    // 鏌ヨ
-    filterNode (value, data) {
-
-      if (!value) return true;
-      return data.cnName.indexOf(value) !== -1;
     },
     async setproChange (res) {
       if (res) {

--
Gitblit v1.9.3