From 3268de7494d5281186bb692635540e38db251e13 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 12 十月 2026 11:53:01 +0800
Subject: [PATCH] feat(dashboard): 添加权限控制和能耗分析功能
---
src/views/dashboard/analytics/index.vue | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/views/dashboard/analytics/index.vue b/src/views/dashboard/analytics/index.vue
index 13794de..907fac8 100644
--- a/src/views/dashboard/analytics/index.vue
+++ b/src/views/dashboard/analytics/index.vue
@@ -4,7 +4,7 @@
import { Page } from '@vben/common-ui';
-import { Card, Col, Row } from 'ant-design-vue';
+import { Col, Row } from 'ant-design-vue';
import { getHomeSummary } from '#/api/mes/home';
@@ -15,11 +15,13 @@
import KpiCards from './modules/kpi-cards.vue';
import ProductionTrend from './modules/production-trend.vue';
import QuickActions from './modules/quick-actions.vue';
+import { useHomeAccess } from './use-home-access';
defineOptions({ name: 'DashboardAnalytics' });
const router = useRouter();
const summary = ref(defaultSummary);
+const { canNavigate, canViewHome } = useHomeAccess();
const greeting = computed(() => {
const hour = new Date().getHours();
@@ -38,10 +40,12 @@
});
function handleNavigate(name: string) {
+ if (!canNavigate(name)) return;
router.push({ name });
}
async function loadSummary() {
+ if (!canViewHome.value) return;
summary.value = await getHomeSummary();
}
@@ -72,19 +76,20 @@
</div>
<!-- MES 鐢熶骇 KPI -->
- <KpiCards :summary="summary" @navigate="handleNavigate" />
+ <KpiCards v-if="canViewHome" :summary="summary" @navigate="handleNavigate" />
<!-- ERP/WMS/BPM 缁忚惀 KPI -->
<BizCards @navigate="handleNavigate" />
<!-- AI 鏅鸿兘鍒嗘瀽 -->
<AiInsights
+ v-if="canViewHome && canNavigate('MesProWorkOrder')"
:active-order-count="summary.workOrderActiveCount"
@navigate="handleNavigate"
/>
<!-- 鐢熶骇瓒嬪娍 + 棰勮闈㈡澘 -->
- <Row :gutter="16" class="mb-4">
+ <Row v-if="canViewHome" :gutter="16" class="mb-4">
<Col :lg="14" :md="24" :sm="24" :xl="14" :xs="24" class="mb-4">
<div class="glass-card rounded-2xl p-5">
<h3 class="mb-4 text-base font-semibold text-gray-800 dark:text-gray-100">
--
Gitblit v1.9.3