From 95f7d3b2fa9399514af2d32dbffbc9e4a7c9b197 Mon Sep 17 00:00:00 2001
From: wangyawei <1796609990@qq.com>
Date: 星期五, 18 四月 2025 14:27:44 +0800
Subject: [PATCH] Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb

---
 src/components/tools/Tools.vue |  109 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 61 insertions(+), 48 deletions(-)

diff --git a/src/components/tools/Tools.vue b/src/components/tools/Tools.vue
index 56ab6ec..146a429 100644
--- a/src/components/tools/Tools.vue
+++ b/src/components/tools/Tools.vue
@@ -42,16 +42,18 @@
       <div v-show="echartsShow" id="sectionCharts" class="sectionChars">
         <div id="echartsView1" style="width: 100%; height: 100%"></div>
       </div>
-      <!-- 鍧″悜鍒嗘瀽 -->
+      <!-- 鍧″害鍧″悜鍒嗘瀽 -->
       <Aspect
         v-show="showAspect"
         @draw="SlopeArrow"
         @clear="SlopeArrowClose"
+        @handleaspect="handleaspect"
+        @handleSlope="handleSlope"
         class="popup-menu-see"
       />
       <SlopeAnalysis
         @draw="SlopeAnalysiss"
-        v-show="showSlope"
+        v-show="isContourLabel"
         class="popup-menu-see"
         @update-slope="onUpdateSlope"
       />
@@ -128,9 +130,6 @@
 // 鍧″悜绠ご寮圭獥
 const showAspect = ref(false);
 
-// 鍧″害鍒嗘瀽寮圭獥
-const showSlope = ref(false);
-
 // 宸ュ叿鍒楄〃
 const toolList = ref([
   {
@@ -162,8 +161,7 @@
     active: false,
     options: [
       { name: "鐐逛綅淇℃伅鎻愬彇", icon: "鐐逛綅淇℃伅鎻愬彇" },
-      { name: "鍧″害鍒嗘瀽", icon: "鍧″害鍧″悜鎻愬彇" },
-      { name: "鍧″悜鍒嗘瀽", icon: "鍧″害鍧″悜鎻愬彇" },
+      { name: "鍧″害鍧″悜鍒嗘瀽", icon: "鍧″害鍧″悜鎻愬彇" },
       { name: "鍓栭潰鎻愬彇", icon: "鍓栭潰鎻愬彇" },
       { name: "鎸栧~鏂硅绠�", icon: "鎸栧~鏂硅绠�" },
       { name: "绛夐珮绾垮垎鏋�", icon: "绛夐珮绾垮垎鏋�" },
@@ -201,38 +199,51 @@
 
 // 澶勭悊宸ュ叿鐐瑰嚮浜嬩欢
 function handleClick(tool, event) {
-  console.log(tool.options);
-  // 濡傛灉宸ュ叿鍚嶇О鏄� "鍥惧眰绠$悊"
+  // 閬嶅巻宸ュ叿鍒楄〃锛屾洿鏂版縺娲荤姸鎬�
+  toolList.value.forEach((item) => {
+    item.active = item.name === tool.name && currentToolOptions.value !== tool.options;
+  });
+
+  // 瀹氫箟涓�涓嚱鏁扮敤浜庨噸缃墍鏈夌姸鎬�
+  const resetAllStates = () => {
+    isPopupVisible.value = false;
+    seeAnalyzeShow.value = false;
+    topographyShow.value = false;
+    echartsShow.value = false;
+    showAspect.value = false;
+    showRain.value = false;
+    showSnow.value = false;
+    isContourLabel.value = false;
+  };
+
+  // 濡傛灉褰撳墠宸ュ叿宸茬粡鏄縺娲荤姸鎬侊紝鍒欏叧闂畠
+  if (currentToolOptions.value === tool.options) {
+    currentToolOptions.value = null; // 娓呯┖褰撳墠宸ュ叿閫夐」
+    resetAllStates();
+    return;
+  }
+
+  // 濡傛灉宸ュ叿鍚嶇О鏄� "鍥惧眰绠$悊"锛屽垏鎹㈠浘灞傛爲鏄剧ず鐘舵��
   if (tool.name === "鍥惧眰绠$悊") {
-    showLayerTree.value = !showLayerTree.value; // 鍒囨崲鍥惧眰鏍戠殑鏄剧ず鐘舵��
-    isPopupVisible.value = false; // 闅愯棌寮圭獥
-    seeAnalyzeShow.value = false; //鍙鍩�
-    topographyShow.value = false; //鍓栭潰
-    echartsShow.value = false; //鍓栭潰echarts
-    showAspect.value = false; //鍧″悜绠ご
-    showSlope.value = false; //鍧″悜绠ご
-    showRain.value = false; //闆ㄥぉ
-    showSnow.value = false; //闆ㄥぉ
+    showLayerTree.value = !showLayerTree.value;
+    resetAllStates();
     return;
   }
 
   // 瀵逛簬鍏朵粬宸ュ叿
+  resetAllStates();
   showLayerTree.value = false; // 纭繚鍥惧眰鏍戦殣钘�
   isPopupVisible.value = true; // 鏄剧ず寮圭獥
   currentToolOptions.value = tool.options; // 璁剧疆褰撳墠宸ュ叿鐨勫姛鑳介�夐」
-  seeAnalyzeShow.value = false; //鍙鍩�
-  topographyShow.value = false; //鍓栭潰
-  echartsShow.value = false; //鍓栭潰echarts
-  showAspect.value = false; //鍧″悜绠ご
-  showSlope.value = false; //鍧″悜绠ご
-  showRain.value = false; //闆ㄥぉ
-  showSnow.value = false; //闆ㄥぉ
 }
+
+const currentOption = ref(null);
 
 // 澶勭悊寮圭獥閫夐」鐐瑰嚮浜嬩欢
 function handleOptionClick(option) {
   isPopupVisible.value = false;
-  console.log("Selected option:", option);
+  currentOption.value = option.name;
+  console.log("Selected option:", currentOption.value);
   const actionMap = {
     鏄剧ず鍥惧眰: () => (showLayerTree.value = true),
     闅愯棌鍥惧眰: () => (showLayerTree.value = false),
@@ -278,11 +289,16 @@
     鍓栭潰鎻愬彇: () => {
       topographyShow.value = true;
     },
-    鍧″害鍒嗘瀽: () => {
-      showSlope.value = true;
-    },
-    鍧″悜鍒嗘瀽: () => {
+    鍧″害鍧″悜鍒嗘瀽: () => {
       showAspect.value = true;
+    },
+    绛夐珮绾垮垎鏋�: () => {
+      isContourLabel.value = true;
+      // if (isContourLabel.value === false) {
+      //   mapUtils.createContourLabel();
+      // } else {
+      //   mapUtils.closeContourLabel();
+      // }
     },
     鐐逛綅淇℃伅鎻愬彇: () => {
       isPickActive.value = !isPickActive.value;
@@ -302,14 +318,6 @@
         mapUtils.FloodAnalysis("close");
       } else {
         mapUtils.FloodAnalysis();
-      }
-    },
-    绛夐珮绾垮垎鏋�: () => {
-      isContourLabel.value = !isContourLabel.value;
-      if (isContourLabel.value === false) {
-        mapUtils.createContourLabel();
-      } else {
-        mapUtils.closeContourLabel();
       }
     },
   };
@@ -374,6 +382,14 @@
   mapUtils.handleClear();
 };
 
+// 鍒掑垎鍖哄煙
+const SlopeArrow = () => {
+  mapUtils.hfqy();
+};
+// 鍧″害鍒嗘瀽
+const handleaspect = () => {
+  mapUtils.pdfx();
+};
 //鍧″害鐨勭澶磋搴�(瑙掑害涓�0~1,鑼冨洿鍐呯殑鍧囧寑鎻掑��)
 const angles = [
   0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7,
@@ -401,18 +417,17 @@
   "#F0AD56",
   "#F2CC45",
 ];
-
-const SlopeArrow = () => {
+// 鍧″悜鍒嗘瀽
+const handleSlope = () => {
   mapUtils.pxjt(colors, angles);
 };
-// 鍏抽棴鍧″悜绠ご
+// 鍏抽棴鍧″害鍧″悜鍒嗘瀽
 const SlopeArrowClose = () => {
-  mapUtils.cleanupAnalysisTools();
+  mapUtils.clearPreviousAnalysis();
 };
 
-// 鍧″害鍒嗘瀽
+// 绛夐珮绾�
 const formData = reactive({
-  terrainRender: 0,
   contourLines: false,
   color: "red",
   spacing: 50,
@@ -420,14 +435,12 @@
 });
 
 const SlopeAnalysiss = () => {
-  mapUtils.pdfx(formData);
+  mapUtils.dgxfx(formData);
 };
 
-
-// 鍧″害
 const onUpdateSlope = (newOption) => {
   Object.assign(formData, newOption);
-  mapUtils.pdfx(formData);
+  mapUtils.dgxfx(formData);
 };
 
 // 闆�

--
Gitblit v1.9.3