From e0a68e0426c7d883f720831ebfeb843c70df697c Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 03 四月 2023 09:05:13 +0800
Subject: [PATCH] 1

---
 src/views/Tools/LayerTree.vue |  114 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 99 insertions(+), 15 deletions(-)

diff --git a/src/views/Tools/LayerTree.vue b/src/views/Tools/LayerTree.vue
index 4909a56..f461b83 100644
--- a/src/views/Tools/LayerTree.vue
+++ b/src/views/Tools/LayerTree.vue
@@ -1,11 +1,35 @@
 <template>
   <div class="lalala tree-container">
-    <el-input
-      placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"
-      v-model="filterText"
-      class="search"
-    >
-    </el-input>
+
+    <el-form ref="form">
+      <el-form-item>
+
+        <el-select
+          v-model="$store.state.pigCode"
+          clearable
+          filterable
+          style="width :100%"
+          @change="setproChange"
+        >
+          <el-option
+            v-for="item in optionts"
+            :key="item.code"
+            :label="item.name"
+            :value="item.code"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+
+        <el-input
+          placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"
+          v-model="filterText"
+          class="search"
+        >
+        </el-input>
+      </el-form-item>
+    </el-form>
     <el-tree
       ref="tree"
       :data="treeData"
@@ -192,7 +216,10 @@
 
 import View from "ol/View.js";
 import { Fill, Stroke, Style } from "ol/style.js";
-import { perms_selectLayers, inquiry_selectDomains, comprehensive_selectPubById } from "../../api/api.js";
+import {
+  perms_selectLayers, inquiry_selectDomains, comprehensive_selectPubById,
+  project_selectDirAll, project_selectByDirid
+} from "../../api/api.js";
 export default {
   name: "tree",
   components: { queryinfo },
@@ -241,6 +268,8 @@
       ],
       childOption: [],
       mptLayer: [],
+      optionts: [],
+      proValue: null,
     };
   },
   methods: {
@@ -878,25 +907,25 @@
           // Cesium.Matrix4.equals(a,b)鍒ゆ柇涓や釜鍥涚淮鐭╅樀鏄惁鐩哥瓑
           // 鏁翠釜鏍硅妭鐐规ā鍨嬬煩闃碉紝璇ileSet=>涓栫晫鍧愭爣绯�
           // 鍗曚綅鐭╅樀锛屽瑙掔嚎鍊间负1.0鐨�4*4鐭╅樀
-          if (!Cesium.Matrix4.equals(tileset.root.transform,Cesium.Matrix4.IDENTITY)) {
+          if (!Cesium.Matrix4.equals(tileset.root.transform, Cesium.Matrix4.IDENTITY)) {
             // 鑾峰彇妯″瀷鐨勪笘鐣屽潗鏍�(绗涘崱灏�)
             // Cesium.Matrix4.getTranslation 閫氳繃浠垮皠鍙樻崲鐭╅樀鑾峰彇璇ileSet鐨勪笘鐣屽潗鏍�
             const transformCenter = Cesium.Matrix4.getTranslation(
-                tileset.root.transform,
-                new Cesium.Cartesian3()
+              tileset.root.transform,
+              new Cesium.Cartesian3()
             );
             // 灏嗙瑳鍗″皵鍧愭爣杞崲涓篧GS84缁忕含搴﹀潗鏍囷紙妯″瀷鐨勶級
             const transformCartographic = Cesium.Cartographic.fromCartesian(
-                transformCenter
+              transformCenter
             );
             // 灏嗙瑳鍗″皵鍧愭爣杞崲涓篧GS84缁忕含搴﹀潗鏍囷紙鎴潰鐨勶級
             const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(
-                tileset.boundingSphere.center
+              tileset.boundingSphere.center
             );
             const height = boundingSphereCartographic.height - transformCartographic.height;
             // 浠庝竴涓狢artesian3瀵硅薄鐢熸垚Matrix4鍙樻崲鐭╅樀锛堣鍒囬潰鐨勶級
             window.modelHeight = height;
-          }else window.modelHeight = 0;
+          } else window.modelHeight = 0;
           this.getTilesetArgs(tileset, res);
         });
         this.$store.state.setAlphaList.push({
@@ -1122,6 +1151,56 @@
       if (!value) return true;
       return data.cnName.indexOf(value) !== -1;
     },
+
+    async setproChange(res) {
+      this.$store.state.pigCode = res;
+      if (res) {
+        var obj = {
+          dirid: res,
+          pageIndex: 1,
+          pageSize: 10,
+        }
+
+        const data = await project_selectByDirid(obj);
+        if (data.code != 200) {
+          this.$message.error("鍒楄〃鑾峰彇澶辫触");
+          return;
+        }
+        if (data.result[0]) {
+          var geom = data.result[0].geom
+          var wkt = this.$wkt.parse(geom)
+          Viewer.camera.flyTo({
+            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[0].toFixed(6), wkt.coordinates[1].toFixed(6), 5000),
+          });
+
+        }
+        this.setChangeProLayer();
+      } else {
+        this.$store.state.isProjectLayer = [];
+      }
+    },
+    setChangeProLayer() {
+
+      if (value.length != 0) {
+        var value = this.$store.state.isProjectLayer;
+        var std = [];
+        for (var i in value) {
+          std.push(value[i].id)
+        }
+        this.$refs.tree.setCheckedKeys(std);
+        this.$bus.$emit("showMenuLayer", value);
+      }
+
+
+    },
+
+    async getMenuProject() {
+      const data = await project_selectDirAll();
+      if (data.code != 200) {
+        return
+      }
+      this.optionts = data.result;
+    },
   },
   watch: {
     filterText(val) {
@@ -1129,7 +1208,7 @@
     },
   },
   mounted() {
-
+    this.getMenuProject()
     this.$bus.$on("treeDataCopy", (res) => {
       this.$store.state.treeData = this.treeData;
       this.$store.state.checkedKeys = this.$refs.tree.getCheckedKeys();
@@ -1310,7 +1389,12 @@
     }
   }
 }
-
+/deep/ .el-form .el-form-item {
+  padding-right: 0px !important;
+}
+/deep/ .el-form-item {
+  margin-bottom: 10px !important;
+}
 /*.lalala {*/
 /*position: relative;*/
 /*}*/

--
Gitblit v1.9.3