feat: application feature navigation.

This commit is contained in:
dalaolala committed 2026-03-02 15:42:41 +08:00
1 parent f9667441b1
commit 838b344219
1 file changed
+23 -1
+23 -1
View File
@@ -57,9 +57,11 @@
<el-tree
:data="serverTree"
node-key="id"
default-expand-all
:default-expanded-keys="expandedKeys"
:expand-on-click-node="false"
@node-click="handleServerClick"
@node-expand="handleNodeExpand"
@node-collapse="handleNodeCollapse"
>
<template #default="{ node, data }">
<div class="tree-node">
@@ -182,6 +184,26 @@ const showEditServerDialog = ref(false)
const editingServerId = ref(null)
const editingServerName = ref('')
// 分组展开状态持久化 (sessionStorage)
const EXPANDED_KEYS_STORAGE_KEY = 'webssh_dashboard_expanded_keys'
const expandedKeys = ref(JSON.parse(sessionStorage.getItem(EXPANDED_KEYS_STORAGE_KEY) || '[]'))
// 监听分组展开
const handleNodeExpand = (data) => {
if (data.type === 'group' && !expandedKeys.value.includes(data.id)) {
expandedKeys.value.push(data.id)
sessionStorage.setItem(EXPANDED_KEYS_STORAGE_KEY, JSON.stringify(expandedKeys.value))
}
}
// 监听分组折叠
const handleNodeCollapse = (data) => {
if (data.type === 'group') {
expandedKeys.value = expandedKeys.value.filter(id => id !== data.id)
sessionStorage.setItem(EXPANDED_KEYS_STORAGE_KEY, JSON.stringify(expandedKeys.value))
}
}
// 计算服务器树形数据
const serverTree = computed(() => {
const groups = {}