From b090ecd5f4c3750a6cf108145d509d0b1d47a697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Wed, 10 Jun 2026 12:17:52 +0800 Subject: [PATCH] Restore control center copy --- .../src/views/_core/control-center/index.vue | 91 +++++++++---------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/web/apps/web-ele/src/views/_core/control-center/index.vue b/web/apps/web-ele/src/views/_core/control-center/index.vue index e9ee2a6..0c8d1f4 100644 --- a/web/apps/web-ele/src/views/_core/control-center/index.vue +++ b/web/apps/web-ele/src/views/_core/control-center/index.vue @@ -8,7 +8,7 @@ import type { import type { UserAnnouncement } from '#/api/core/announcement'; import type { Message } from '#/api/core/message'; -import { computed, onMounted, reactive, ref } from 'vue'; +import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'; import { useRouter } from 'vue-router'; import { Page } from '@vben/common-ui'; @@ -39,13 +39,7 @@ import { } from '@vben/icons'; import { useUserStore } from '@vben/stores'; -import { - ElButton, - ElEmpty, - ElProgress, - ElSkeleton, - ElTag, -} from 'element-plus'; +import { ElButton, ElEmpty, ElProgress, ElSkeleton, ElTag } from 'element-plus'; import { getAgentListApi, @@ -73,6 +67,7 @@ const userStore = useUserStore(); const loading = ref(false); const loaded = ref(false); const now = ref(new Date()); +const timer = ref(); const agents = ref([]); const workflows = ref([]); const knowledgeBases = ref([]); @@ -99,26 +94,26 @@ const displayName = computed(() => { ); }); -const hour = computed(() => now.value.getHours()); const greeting = computed(() => { - if (hour.value < 6) return '凌晨好'; - if (hour.value < 12) return '上午好'; - if (hour.value < 18) return '下午好'; + const hour = now.value.getHours(); + if (hour < 6) return '凌晨好'; + if (hour < 12) return '上午好'; + if (hour < 18) return '下午好'; return '晚上好'; }); -const currentTime = computed(() => { - return now.value.toLocaleTimeString('zh-CN', { hour12: false }); -}); +const currentTime = computed(() => + now.value.toLocaleTimeString('zh-CN', { hour12: false }), +); -const currentDate = computed(() => { - return now.value.toLocaleDateString('zh-CN', { +const currentDate = computed(() => + now.value.toLocaleDateString('zh-CN', { day: 'numeric', month: 'long', weekday: 'long', year: 'numeric', - }); -}); + }), +); const publishedAgents = computed( () => agents.value.filter((item) => item.status === 'published').length, @@ -151,7 +146,6 @@ const successRate = computed(() => { const collaborationItems = computed(() => [ { color: 'blue', - desc: '发起需求分诊、任务拆解和角色协作', icon: Send, path: '/ai-platform/agent', title: '我发起的', @@ -159,7 +153,6 @@ const collaborationItems = computed(() => [ }, { color: 'amber', - desc: '待人工确认、待补充上下文的节点', icon: ClipboardList, path: '/ai-platform/workflow-runs', title: '我的待办', @@ -167,7 +160,6 @@ const collaborationItems = computed(() => [ }, { color: 'violet', - desc: '正在运行或最近完成的协作流程', icon: Workflow, path: '/ai-platform/workflow-runs', title: '我的在办', @@ -175,7 +167,6 @@ const collaborationItems = computed(() => [ }, { color: 'cyan', - desc: '已沉淀为可复用的智能体能力', icon: CheckCircle2, path: '/ai-platform/agent', title: '我的已办', @@ -183,7 +174,6 @@ const collaborationItems = computed(() => [ }, { color: 'orange', - desc: '消息、公告和流程通知', icon: Bell, path: '/message/announcement-list', title: '抄送我的', @@ -191,7 +181,6 @@ const collaborationItems = computed(() => [ }, { color: 'green', - desc: '进入编排器创建多 Agent 流程', icon: Play, path: '/ai-platform/workflow', title: '发起流程', @@ -271,28 +260,24 @@ const quickLinks = [ const resourceCards = computed(() => [ { - desc: `${publishedAgents.value} 个已发布,可参与协作`, icon: Bot, label: '智能体', tone: 'blue', value: stats.agentTotal, }, { - desc: `${publishedWorkflows.value} 条已发布,可直接运行`, icon: Workflow, label: '流程', tone: 'cyan', value: stats.workflowTotal, }, { - desc: `${knowledgeBases.value.length} 个最近维护`, icon: BookOpen, label: '知识库', tone: 'amber', value: stats.knowledgeTotal, }, { - desc: `成功 ${completedRuns.value} / 失败 ${failedRuns.value}`, icon: Play, label: '执行记录', tone: 'green', @@ -304,6 +289,7 @@ const serverCards = computed(() => { const overview = serverOverview.value; const realtime = realtimeStats.value; const memory = realtime?.memory_details || overview?.memory_info.virtual; + return [ { desc: `${overview?.cpu_info.total_cores || '-'} 核心`, @@ -323,9 +309,9 @@ const serverCards = computed(() => { value: `${Math.round(realtime?.memory_percent ?? overview?.memory_info.virtual.percent ?? 0)}%`, }, { - desc: `累计 ${formatBytes(overview?.disk_info.total_read_bytes)} / ${formatBytes(overview?.disk_info.total_write_bytes)}`, + desc: `累计读写 ${formatBytes(overview?.disk_info.total_read_bytes)} / ${formatBytes(overview?.disk_info.total_write_bytes)}`, icon: Server, - label: '磁盘读/写', + label: '磁盘读取', tone: 'amber', value: `${formatBytes(realtime?.disk_io.read_speed)}/s`, }, @@ -370,6 +356,7 @@ function getStatusType(status: string) { async function loadDashboard() { loading.value = true; now.value = new Date(); + try { const [ agentRes, @@ -418,10 +405,14 @@ async function loadDashboard() { onMounted(() => { loadDashboard(); - window.setInterval(() => { + timer.value = window.setInterval(() => { now.value = new Date(); }, 1000); }); + +onBeforeUnmount(() => { + if (timer.value) window.clearInterval(timer.value); +});