删除 Dashboard 页面,将首页改为根目录
- 删除 Dashboard.vue 页面文件 - 修改路由配置:删除 Dashboard 路由,根路径重定向到 /tools - 删除菜单配置中的 dashboard 菜单项 - 删除 AppHeader 中的 Dashboard 标题映射 - 修复禁用账户后跳转问题:反馈提交后跳转到根目录而非 /dashboard
This commit is contained in:
parent
f30502bf7d
commit
423e28c09c
@ -181,7 +181,6 @@ const breadcrumbItems = computed(() => {
|
|||||||
} else {
|
} else {
|
||||||
// 其他页面的标题映射(保留向后兼容)
|
// 其他页面的标题映射(保留向后兼容)
|
||||||
const map: Record<string, string> = {
|
const map: Record<string, string> = {
|
||||||
Dashboard: t('Dashboard'),
|
|
||||||
AgentList: t('Agents'),
|
AgentList: t('Agents'),
|
||||||
AgentDetail: t('Agent Detail'),
|
AgentDetail: t('Agent Detail'),
|
||||||
NodeList: t('Node Management'),
|
NodeList: t('Node Management'),
|
||||||
|
|||||||
@ -29,9 +29,9 @@ const router = createRouter({
|
|||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'dashboard',
|
path: '',
|
||||||
name: 'Dashboard',
|
name: 'Home',
|
||||||
component: () => import('../../views/Dashboard.vue')
|
redirect: '/tools'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'local-jobs',
|
path: 'local-jobs',
|
||||||
|
|||||||
@ -50,7 +50,6 @@ function saveToStorage(items: AppMenuItem[]) {
|
|||||||
// - 非 System User 只能看到工具市场
|
// - 非 System User 只能看到工具市场
|
||||||
function getDefaultMenus(): AppMenuItem[] {
|
function getDefaultMenus(): AppMenuItem[] {
|
||||||
return [
|
return [
|
||||||
{ id: 'dashboard', key: 'Dashboard', label: 'Dashboard', icon: 'tabler:dashboard', routeName: 'Dashboard', order: 1, type: 'route' },
|
|
||||||
{ id: 'work', key: 'work', label: 'Work', icon: 'tabler:device-desktop', type: 'workspace', workspaceName: 'work', url: '/workspace/work', order: 2 },
|
{ id: 'work', key: 'work', label: 'Work', icon: 'tabler:device-desktop', type: 'workspace', workspaceName: 'work', url: '/workspace/work', order: 2 },
|
||||||
{ id: 'design', key: 'design', label: 'Design', icon: 'tabler:pencil', type: 'workspace', workspaceName: 'design', url: '/workspace/design', order: 3 },
|
{ id: 'design', key: 'design', label: 'Design', icon: 'tabler:pencil', type: 'workspace', workspaceName: 'design', url: '/workspace/design', order: 3 },
|
||||||
{ id: 'website', key: 'website', label: 'Website', icon: 'tabler:world', type: 'workspace', workspaceName: 'jsite', url: '/workspace/jsite', order: 4 },
|
{ id: 'website', key: 'website', label: 'Website', icon: 'tabler:world', type: 'workspace', workspaceName: 'jsite', url: '/workspace/jsite', order: 4 },
|
||||||
|
|||||||
@ -1,213 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="dashboard-page">
|
|
||||||
<div class="page-header">
|
|
||||||
<h1 class="page-title">{{ t('Dashboard') }}</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 统计卡片 -->
|
|
||||||
<n-grid :cols="4" :x-gap="16" :y-gap="16" :responsive="'screen'" :item-responsive="true" class="stats-grid">
|
|
||||||
<!-- 原来的4个统计 -->
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Total Agents')" :value="stats.agents" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Total Nodes')" :value="stats.nodes" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Task Queue')" :value="stats.taskQueue" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Scheduled Tasks')" :value="stats.scheduledTasks" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
|
|
||||||
<!-- 新增的5个统计 -->
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Knowledge Base')" :value="stats.knowledgeBase" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Note')" :value="stats.note" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('Event')" :value="stats.event" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('ToDo')" :value="stats.todo" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-card>
|
|
||||||
<n-statistic :label="t('File')" :value="stats.file" />
|
|
||||||
</n-card>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { reactive, onMounted } from 'vue'
|
|
||||||
import {
|
|
||||||
NGrid,
|
|
||||||
NGridItem,
|
|
||||||
NCard,
|
|
||||||
NStatistic
|
|
||||||
} from 'naive-ui'
|
|
||||||
import { t } from '../shared/i18n'
|
|
||||||
import { getCount, getLocalJobCount } from '../shared/api/common'
|
|
||||||
|
|
||||||
const stats = reactive({
|
|
||||||
agents: 0,
|
|
||||||
nodes: 0,
|
|
||||||
taskQueue: 0,
|
|
||||||
scheduledTasks: 0,
|
|
||||||
knowledgeBase: 0,
|
|
||||||
note: 0,
|
|
||||||
event: 0,
|
|
||||||
todo: 0,
|
|
||||||
file: 0
|
|
||||||
})
|
|
||||||
|
|
||||||
// 加载统计数据
|
|
||||||
const loadStats = async () => {
|
|
||||||
try {
|
|
||||||
// 第一行:原来的4个统计
|
|
||||||
// 获取智能体总数
|
|
||||||
const agentsResult = await getCount('Local Ai Agent')
|
|
||||||
if (agentsResult.success) {
|
|
||||||
stats.agents = agentsResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取节点总数
|
|
||||||
const nodesResult = await getCount('Local Ai Node')
|
|
||||||
if (nodesResult.success) {
|
|
||||||
stats.nodes = nodesResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取任务队列数量 - 使用Local Job (虚拟pagetype,使用专用API)
|
|
||||||
const taskQueueResult = await getLocalJobCount()
|
|
||||||
if (taskQueueResult.success) {
|
|
||||||
stats.taskQueue = taskQueueResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取定时任务数量
|
|
||||||
const scheduledTasksResult = await getCount('Local Scheduled Job')
|
|
||||||
if (scheduledTasksResult.success) {
|
|
||||||
stats.scheduledTasks = scheduledTasksResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第二行:新增的5个统计
|
|
||||||
// 获取知识库总数
|
|
||||||
const knowledgeBaseResult = await getCount('Knowledge Base')
|
|
||||||
if (knowledgeBaseResult.success) {
|
|
||||||
stats.knowledgeBase = knowledgeBaseResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取笔记总数
|
|
||||||
const noteResult = await getCount('Note')
|
|
||||||
if (noteResult.success) {
|
|
||||||
stats.note = noteResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取事件总数
|
|
||||||
const eventResult = await getCount('Event')
|
|
||||||
if (eventResult.success) {
|
|
||||||
stats.event = eventResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取待办事项总数
|
|
||||||
const todoResult = await getCount('ToDo')
|
|
||||||
if (todoResult.success) {
|
|
||||||
stats.todo = todoResult.count || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取文件总数
|
|
||||||
const fileResult = await getCount('File')
|
|
||||||
if (fileResult.success) {
|
|
||||||
stats.file = fileResult.count || 0
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载统计数据失败:', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// 加载统计数据
|
|
||||||
loadStats()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.dashboard-page {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-header {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-title {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1f2937;
|
|
||||||
margin: 0 0 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-description {
|
|
||||||
font-size: 16px;
|
|
||||||
color: #6b7280;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats-grid {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 响应式设计 */
|
|
||||||
@media (max-width: 1200px) {
|
|
||||||
.stats-grid {
|
|
||||||
--n-grid-cols: 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.dashboard-page {
|
|
||||||
padding: 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats-grid {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
--n-grid-cols: 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
.dashboard-page {
|
|
||||||
padding: 0 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-title {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats-grid {
|
|
||||||
--n-grid-cols: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1834,7 +1834,7 @@ const handleSubmitFeedback = async () => {
|
|||||||
feedbackNote.value = ''
|
feedbackNote.value = ''
|
||||||
// 延迟跳转
|
// 延迟跳转
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = '/dashboard'
|
window.location.href = '/'
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
feedbackError.value = result.message || t('提交反馈失败')
|
feedbackError.value = result.message || t('提交反馈失败')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user