From 9398f14feea7ad8b7d00ce7d2bb2e5362cec59d3 Mon Sep 17 00:00:00 2001
From: surprise <15810472099@163.com>
Date: 星期二, 09 一月 2024 15:20:15 +0800
Subject: [PATCH] 代码提交

---
 src/components/left/layerTree/Layer.vue |   80 +++++++++++++++++++++++++++++++--------
 1 files changed, 63 insertions(+), 17 deletions(-)

diff --git a/src/components/left/layerTree/Layer.vue b/src/components/left/layerTree/Layer.vue
index 9cb47da..e958b23 100644
--- a/src/components/left/layerTree/Layer.vue
+++ b/src/components/left/layerTree/Layer.vue
@@ -97,7 +97,7 @@
 import AddOnlineMap from "./AddOnlineMap.vue";
 import GetScene from "./GetScene.vue";
 import SaveScene from "./SaveScene.vue";
-import { Op_SelectByPage, Op_Insert, Op_UpdateById } from '../../../api/api.js'
+import { Op_SelectByPage, Op_Insert, Op_UpdateById, Img_SelectByPage, Img_DeleteByIds } from '../../../api/api.js'
 import model from "../../../assets/js/Layer/model";
 import mapOL from "../../../assets/js/Layer/mapOL";
 // 宸ョ▼鏍戝伐鍏�
@@ -154,6 +154,16 @@
     };
   },
   mounted() {
+
+    Bus.$on("reastLayer", (type) => {
+      this.setTreeData([]);
+      this.initData({});
+      model.deleteAll();
+      setTimeout(() => {
+  
+        this.histotyPlotting();
+      }, 100);
+    });
     // 鑾峰彇鏈湴閰嶇疆鏂囦欢
     if (this.$route.query.hasOwnProperty("layer")) {
       axios
@@ -196,12 +206,13 @@
       Bus.$emit("checkTab", "index/add/treeLayer", false);
     },
     closeLayer() {
-      this.$store.state.isShowLayer= false
+      this.$store.state.isShowLayer = false
       // this.$parent.hideLayer();
     },
     // 瀹氫箟涓浆绔欎簨浠�
     initBusEvent() {
-      Bus.$off("addLayer");
+
+
       Bus.$on("addLayer", (type) => {
         this.selectNode = this.$refs.tree && this.$refs.tree.getCurrentNode();
         this.openThisTypePop(type);
@@ -394,7 +405,9 @@
       this.setTreeData([]);
       this.initData({});
       model.deleteAll();
+      var finalPlotting = [];
       const data = await Op_SelectByPage({ pageSize: 1000000, pageIndex: 1, name: '' });
+      const data1 = await Img_SelectByPage({ pageSize: 1000000, pageIndex: 1, name: '' });
       if (data.status == 200 && data.data.length > 0) {
         var val_data = data.data;
         for (var i in val_data) {
@@ -405,7 +418,7 @@
             let plottingArr = [];
             plottingArr.push(val[0]);
             const newArr = arrGroup(plottingArr, (item) => item.name);
-            let finalPlotting = [];
+
             newArr.map((a) => {
               let newObj = {};
               a.map((b) => {
@@ -417,16 +430,33 @@
               });
               finalPlotting.push(newObj);
             });
-            let json = {
-              name: "姹熻嫃浜ゆ帶鏅烘収楂橀��",
-              id: 1,
-              open: true,
-              children: finalPlotting,
-            };
-            this.initData(json);
+
           }
         }
       }
+
+      if (data1.status == 200) {
+        var img_data = data1.data;
+        if (img_data && img_data.length > 0) {
+          for (var i = 0; i < img_data.length; i++) {
+            var item = img_data[i]
+            item.sourceType = 'imgUp'
+            item.sid = item.id;
+            item.id = new Date().getTime() + i;
+            item.checked = true;
+            finalPlotting[0].children.push(item)
+          }
+        }
+
+      }
+      var json = {
+        name: "姹熻嫃浜ゆ帶鏅烘収楂橀��",
+        id: 1,
+        open: true,
+        children: finalPlotting
+      };
+   
+      this.initData(json);
       // const downloading = this.$loading({
       //   lock: true,
       //   text: "浼氳淇濋殰鍘嗗彶鏁版嵁鍔犺浇涓紝璇风◢鍚�",
@@ -555,7 +585,7 @@
         if (addData && node._children) {
           node._children.forEach((item) => {
             _treeTool.addData(item);
-            console.log(item)
+  
             this.setAddGLBLayer(item);
           });
         } else {
@@ -823,6 +853,8 @@
         model.addModelLayer(res);
       } else if (res.sourceType == "SimpleGraphic" && res.checked) {
         mapOL.addLayerData(res);
+      } else if (res.sourceType == "imgUp" && res.checked) {
+        model.addImgUpLayer(res);
       }
     },
     // 娣诲姞婕旂ず鍔ㄧ敾
@@ -941,6 +973,9 @@
     // 鍙抽敭鑿滃崟鍏冪礌
     rightClick(e, data, node, comp) {
       this.isClickParent = !!data.children;
+      if (data.sourceType == 'imgUp') {
+        this.isClickParent = true;
+      }
       this.selectNode = data;
       this.rightClickMenuStyle = { top: e.pageY + "px", left: e.pageX + "px" };
       this.rightClickMenuDisplay = true;
@@ -957,16 +992,15 @@
       if (this.selectNode.sourceType === "GLB") {
         model.setDelGLBModel(this.selectNode)
       }
-       if (this.selectNode.sourceType === "SimpleGraphic") {
-     
+      if (this.selectNode.sourceType === "SimpleGraphic") {
         mapOL.removeLayerData(this.selectNode)
       }
-
+      if (this.selectNode.sourceType === "imgUp") {
+        this.removeimgUpData(this.selectNode)
+      }
       this.remove(this.selectNode);
       this.$refs.tree && this.$refs.tree.setCurrentKey(null);
       this.selectNode = undefined;
-
-
     },
     // 鍙抽敭缂栬緫鎸夐挳缂栬緫鏍戣妭鐐�
     editTreeNode() {
@@ -993,6 +1027,18 @@
         }
       }
     },
+    async removeimgUpData(res) {
+      const data = await Img_DeleteByIds(res.sid);
+      if (data.status == 200) {
+
+      }
+    },
+
+
+
+
+
+
     // 娣诲姞鐩綍
     addFold() {
       let newChild = {

--
Gitblit v1.9.3