初始化项目

This commit is contained in:
BBIT-Kai
2026-04-30 10:47:26 +08:00
commit c932419c73
147 changed files with 45298 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<template>
<div class="page-shell">
<div class="grid grid-cols-1 gap-4 md:grid-cols-3 lg:grid-cols-4">
<div class="soft-stat"><n-statistic label="可见菜单" :value="visibleMenuTotal" /></div>
<div class="soft-stat"><n-statistic label="可访问页面" :value="visiblePageTotal" /></div>
<div class="soft-stat">
<n-statistic label="权限码数量" :value="authStore.permissions.length" />
</div>
<div class="soft-stat"><n-statistic label="当前状态" :value="currentStatus" /></div>
<div class="soft-stat"><n-statistic label="已打开页签" :value="authStore.tabs.length" /></div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useAuthStore } from '@/stores/auth'
import { statusLabel } from '@/utils/display'
import type { MenuNode } from '@/types/auth'
const authStore = useAuthStore()
function flattenMenus(nodes: MenuNode[]): MenuNode[] {
return nodes.flatMap((item) => [item, ...flattenMenus(item.children ?? [])])
}
const visibleMenus = computed(() => flattenMenus(authStore.menus).filter((item) => item.visible))
const visibleMenuTotal = computed(() => visibleMenus.value.length)
const visiblePageTotal = computed(
() => visibleMenus.value.filter((item) => item.type === 'MENU' && item.path).length
)
const currentStatus = computed(() => statusLabel(authStore.user?.status))
</script>