From f2b450b76a1b161728c6008de07671f14631b34d Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期一, 03 三月 2025 10:47:17 +0800
Subject: [PATCH] 模型库菜单

---
 src/views/model/children/childrenModel01.vue |   14 +++++++
 src/components/TreeMenu.vue                  |   41 ++++++--------------
 src/views/model/index.vue                    |    5 --
 src/router/index.ts                          |   18 +++++---
 4 files changed, 38 insertions(+), 40 deletions(-)

diff --git a/src/components/TreeMenu.vue b/src/components/TreeMenu.vue
index ef177b3..f0c0b6b 100644
--- a/src/components/TreeMenu.vue
+++ b/src/components/TreeMenu.vue
@@ -27,7 +27,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, watch,defineProps } from "vue";
+import { ref, watch, defineProps } from "vue";
 import { useRouter } from "vue-router";
 import { Document, FolderOpened } from "@element-plus/icons-vue";
 
@@ -44,37 +44,17 @@
   children?: TreeNode[];
 }
 
-const treeData = ref<TreeNode[]>([
+const modelTreeData = ref<TreeNode[]>([
   {
-    label: "妯″瀷绠$悊",
-    icon: "Document",
-    path: "/model",
-  },
-  {
-    label: "鍙鍖栦豢鐪�",
+    label: "鍨嬪彿",
     icon: "FolderOpened",
     children: [
       {
-        label: "娴嬭瘯浠跨湡",
-        path: "/simulation-test",
-        icon: "FolderOpened",
-        children: [
-          {
-            label: "浠跨湡璇︽儏",
-            path: "/simulation-config",
-            icon: "Document",
-          },
-          {
-            label: "娴嬭瘯鎶ュ憡",
-            path: "/simulation-result",
-            icon: "Document",
-          },
-        ],
+        label: "鍨嬪彿1",
+        path: "/model/childrenModel01",
       },
       {
-        label: "瀹炴椂浠跨湡",
-        path: "/simulation-test",
-        icon: "Document",
+        label: "鍨嬪彿2",
       },
     ],
   },
@@ -85,7 +65,7 @@
   label: "label",
 };
 
-const filteredData = ref(treeData.value);
+const filteredData = ref(modelTreeData.value);
 
 const filterNode = (value: string, data: TreeNode) => {
   if (!value) return true;
@@ -98,11 +78,14 @@
   }
 };
 
-
 watch(
   () => props.menuItem,
   (value) => {
-    console.log(value,'tree');
+    if (value == "/" || value == "/model") {
+      filteredData.value = modelTreeData.value;
+    } else {
+      filteredData.value = []
+    }
   }
 );
 </script>
diff --git a/src/router/index.ts b/src/router/index.ts
index d4ca3cc..a321f8d 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -10,13 +10,17 @@
     {
       path: '/model',
       name: 'model',
-      component: () => import('../views/model/index.vue')
+      redirect: '/model/childrenModel01',
+      component: () => import('../views/model/index.vue'),
+      children: [
+        {
+          path: '/model/childrenModel01',
+          name: 'childrenModel01',
+          component: () => import('../views/model/children/childrenModel01.vue')
+        },
+      ]
     },
-    {
-      path: '/kinematic',
-      name: 'kinematic',
-      component: () => import('../views/model/index.vue')
-    },
+
     {
       path: '/simulation-config',
       name: 'simulationConfig',
@@ -31,7 +35,7 @@
       path: '/simulation-test',
       name: 'simulationTest',
       component: () => import('../views/simulation/test.vue')
-    },  
+    },
     {
       path: '/system/user',
       name: 'systemUser',
diff --git a/src/views/model/children/childrenModel01.vue b/src/views/model/children/childrenModel01.vue
new file mode 100644
index 0000000..dc84061
--- /dev/null
+++ b/src/views/model/children/childrenModel01.vue
@@ -0,0 +1,14 @@
+<template>
+  <div class="kinematic">
+    <h2>鐫�闄嗗櫒妯″瀷搴�</h2>
+  </div>
+</template>
+
+<script setup lang="ts">
+</script>
+
+<style lang="less" scoped>
+.kinematic {
+  padding: 20px;
+}
+</style> 
\ No newline at end of file
diff --git a/src/views/model/index.vue b/src/views/model/index.vue
index 9bd969e..076d6ce 100644
--- a/src/views/model/index.vue
+++ b/src/views/model/index.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="kinematic">
-    <h2>杩愬姩瀛︽ā鍨�</h2>
+    <RouterView />
   </div>
 </template>
 
@@ -8,7 +8,4 @@
 </script>
 
 <style lang="less" scoped>
-.kinematic {
-  padding: 20px;
-}
 </style> 
\ No newline at end of file

--
Gitblit v1.9.1