From bf0eb543e2deab8a1629dd2a46f8e1cd191531e1 Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期四, 17 七月 2025 15:22:01 +0800
Subject: [PATCH] Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb

---
 src/store/simulation.js |  110 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 92 insertions(+), 18 deletions(-)

diff --git a/src/store/simulation.js b/src/store/simulation.js
index 3911a2c..e810802 100644
--- a/src/store/simulation.js
+++ b/src/store/simulation.js
@@ -1,13 +1,29 @@
 // stores/ui.js
 import { defineStore } from 'pinia'
 import { ref } from 'vue'
-import { createSimData } from '@/api/trApi'
-
+import { showDeviceDetail } from "@/store";
 export const useSimStore = defineStore('simulation', () => {
+    // 鏂潰鏁版嵁
+    const crossSection = ref([])
+    const openDia = ref(true)
+    // 鍘嗗彶鍥炴斁鍒楄〃
+    const rePlayList = ref([])
+    // 鍖椾含甯傛墍鏈夋潙鐨刢ode
+    const townCodeAll = ref([])
+    // 瀹炴椂妯℃嫙鏈�鏂扮殑layer
+    const layerDate = ref("")
+    // 甯ф暟
+    const frameNum = ref(0)
+    // 鐩綍鏍戦�変腑
+    const userSelectedLayers = ref([])
     // 闅愭偅鐐瑰垪琛�
-    const DeviceShowSwitch = ref(true)
-    const DangerShowSwitch = ref(true)
+    const DeviceShowSwitch = ref(false)
+    const DangerShowSwitch = ref(false)
     const DangerPoint = ref([])
+    // 娉ヤ綅璁�
+    const selectNWJ = ref()
+    // 鐩戞祴璁惧鍒楄〃
+    const devices = ref([])
     const navigationShow = ref(true)
     const leftShow = ref(false)
     const rightShow = ref(false)
@@ -24,20 +40,39 @@
     const weatherShow = ref(false)
     const barShow = ref(false)
     const deviceShow = ref(false)
-    const showResultAssess = ref(false)
     const showLayerTree = ref(true)
-    const showDangerAssess = ref(false)
     const schemCard = ref([])
     const backToHome = ref(false)
     const selectedScheme = ref(null)
+    // 褰撳墠妯℃嫙缁忕含搴�
+    const currentInfo = ref({})
+    // 鍥句緥
+    const waterLegendData = ref([])
+    // 妯℃嫙浠跨湡鍥句緥
+    const isShowEarth = ref(false)
+    // 闄嶉洦鏁版嵁鍒楄〃
     const rainFalls = ref()
+    // 闄嶉洦鍗曚綅
     const intensityUnit = ref()
+    // 鏂规涓嬫按娣辨祦閫熺瓑鏁版嵁
+    let schemWaterInfo = ref([])
     const setSelectedScheme = (scheme) => {
-        selectedScheme.value = scheme
-        rainFalls.value = JSON.parse(scheme.data).rainfalls
-        intensityUnit.value = JSON.parse(scheme.data).intensityUnit
-        console.log(intensityUnit.value, 'shceme')
-    }
+        selectedScheme.value = scheme;
+
+        try {
+            const parsedData = JSON.parse(scheme.data);
+
+            // 鍙湁褰� rainfalls 鍜� intensityUnit 瀛樺湪涓旈潪绌烘椂鎵嶈祴鍊�
+            if (parsedData.rainfalls && parsedData.intensityUnit) {
+                rainFalls.value = parsedData.rainfalls;
+                intensityUnit.value = parsedData.intensityUnit;
+            } else {
+                console.warn("缂哄皯蹇呰鐨� rainfalls 鎴� intensityUnit 瀛楁");
+            }
+        } catch (error) {
+            console.error("瑙f瀽 scheme.data 鍑洪敊", error);
+        }
+    };
     const clearSelectedScheme = () => {
         selectedScheme.value = null
     }
@@ -57,8 +92,6 @@
         rightRiverShow.value = false
         showPreview.value = false
         deviceShow.value = false
-        showResultAssess.value = false
-        showDangerAssess.value = false
         schemCard.value = []
     }
 
@@ -81,27 +114,50 @@
         }
     }
 
+    const flyToHomeView = () => {
+        const view = {
+            destination: {
+                x: -2355432.569004413,
+                y: 4687573.191838412,
+                z: 4098726.315265574,
+            },
+            orientation: {
+                pitch: -0.9541030830183503,
+                roll: 0.00031421159527500464,
+                heading: 6.140424766644804,
+            },
+        };
+        viewer.scene.camera.flyTo(view);
+    }
+
     const startYHGL = () => {
         init()
+        flyToHomeView()
         locationShow.value = true
+        isShowEarth.value = true
+
     }
 
     const startZHJC = () => {
         init()
+        flyToHomeView()
         functionShow.value = true
         deviceShow.value = true
+        isShowEarth.value = true
+
     }
 
     const startMNFZ = () => {
         init()
+        flyToHomeView()
         leftShow.value = true
-        // rightRiverShow.value = true
+        isShowEarth.value = false
+
     }
 
     const startMNPG = () => {
         init()
-        // showResultAssess.value = true
-        // showDangerAssess.value = true
+        isShowEarth.value = false
     }
 
     const setBackToHome = (value) => {
@@ -110,6 +166,7 @@
 
     // 瀵艰埅鐐瑰嚮
     const handleNavClick = (index) => {
+        showDeviceDetail.value = false;
         switch (index) {
             case 1:
                 startYHGL()
@@ -125,6 +182,12 @@
                 break
         }
     }
+
+    const updateSelectedLayers = (keys) => {
+        userSelectedLayers.value = keys;
+    }
+
+
 
     return {
         // UI 鐘舵��
@@ -144,9 +207,7 @@
         weatherShow,
         barShow,
         deviceShow,
-        showResultAssess,
         showLayerTree,
-        showDangerAssess,
         schemCard,
         backToHome,
         rainFalls,
@@ -154,6 +215,18 @@
         DangerPoint,
         DeviceShowSwitch,
         DangerShowSwitch,
+        waterLegendData,
+        currentInfo,
+        isShowEarth,
+        userSelectedLayers,
+        devices,
+        frameNum,
+        schemWaterInfo,
+        layerDate,
+        rePlayList,
+        selectNWJ,
+        openDia,
+        crossSection,
 
         // 鏂规鐩稿叧鏂规硶
         setSchemCard,
@@ -174,5 +247,6 @@
         startMNFZ,
         startMNPG,
         handleNavClick,
+        updateSelectedLayers
     }
 })
\ No newline at end of file

--
Gitblit v1.9.3