From 8151c3253dc287a79914bc08414af17dfb380c96 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 14 十月 2026 14:34:33 +0800
Subject: [PATCH] refactor(首页): 展示模块改为跟随菜单权限自动隐藏

---
 src/views/mes/home/modules/alert-panel.vue |   64 ++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/src/views/mes/home/modules/alert-panel.vue b/src/views/mes/home/modules/alert-panel.vue
index 8584cce..9128c9c 100644
--- a/src/views/mes/home/modules/alert-panel.vue
+++ b/src/views/mes/home/modules/alert-panel.vue
@@ -7,6 +7,10 @@
 
 import { Badge, Card } from 'ant-design-vue';
 
+import { useHomeAccess } from '#/utils/use-home-access';
+
+import { HOME_BLOCK_MENUS } from '../data';
+
 defineOptions({ name: 'MesHomeAlertPanel' });
 
 const props = defineProps<{
@@ -17,37 +21,41 @@
   navigate: [name: string];
 }>();
 
-/** 寰呭姙鎻愰啋鍒楄〃锛氭爣绛俱�佹弿杩般�佸浘鏍囥�佺洰鏍囪矾鐢卞悕绉般�佹暟閲� */
-const alertItems = computed(() => [
-  {
-    count: props.summary.andonActiveCount,
-    desc: '鏈缃殑瀹夌伅鍛煎彨',
-    icon: 'lucide:bell-ring',
-    iconClass: 'bg-red-50 text-red-500',
-    label: '瀹夌伅鎶ヨ',
-    routeName: 'MesProAndonRecord',
-  },
-  {
-    count: props.summary.repairActiveCount,
-    desc: '寰呭鐞嗙殑缁翠慨璁㈠崟',
-    icon: 'lucide:wrench',
-    iconClass: 'bg-orange-50 text-orange-500',
-    label: '璁惧缁翠慨',
-    routeName: 'MesDvRepair',
-  },
-  {
-    count: props.summary.workOrderPrepareCount,
-    desc: '鑽夌鐘舵�佺殑鐢熶骇璁㈠崟',
-    icon: 'lucide:clipboard-list',
-    iconClass: 'bg-blue-50 text-blue-500',
-    label: '寰呮帓浜ц鍗�',
-    routeName: 'MesProWorkOrder',
-  },
-]);
+const { canSeeMenu } = useHomeAccess();
+
+/** 寰呭姙鎻愰啋鍒楄〃锛氭爣绛俱�佹弿杩般�佸浘鏍囥�佺洰鏍囪矾鐢卞悕绉般�佹暟閲忥紱鑿滃崟娌″紑鐨勬潯鐩笉灞曠ず */
+const alertItems = computed(() =>
+  [
+    {
+      count: props.summary.andonActiveCount,
+      desc: '鏈缃殑瀹夌伅鍛煎彨',
+      icon: 'lucide:bell-ring',
+      iconClass: 'bg-red-50 text-red-500',
+      label: '瀹夌伅鎶ヨ',
+      routeName: HOME_BLOCK_MENUS.andon,
+    },
+    {
+      count: props.summary.repairActiveCount,
+      desc: '寰呭鐞嗙殑缁翠慨璁㈠崟',
+      icon: 'lucide:wrench',
+      iconClass: 'bg-orange-50 text-orange-500',
+      label: '璁惧缁翠慨',
+      routeName: HOME_BLOCK_MENUS.repair,
+    },
+    {
+      count: props.summary.workOrderPrepareCount,
+      desc: '鑽夌鐘舵�佺殑鐢熶骇璁㈠崟',
+      icon: 'lucide:clipboard-list',
+      iconClass: 'bg-blue-50 text-blue-500',
+      label: '寰呮帓浜ц鍗�',
+      routeName: HOME_BLOCK_MENUS.workOrder,
+    },
+  ].filter((item) => canSeeMenu(item.routeName)),
+);
 </script>
 
 <template>
-  <Card title="寰呭姙涓庡紓甯�" class="h-full">
+  <Card v-if="alertItems.length" title="寰呭姙涓庡紓甯�" class="h-full">
     <div class="flex flex-col">
       <div
         v-for="item in alertItems"

--
Gitblit v1.9.3