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/shortcuts.vue | 73 +++++++-----------------------------
1 files changed, 14 insertions(+), 59 deletions(-)
diff --git a/src/views/mes/home/modules/shortcuts.vue b/src/views/mes/home/modules/shortcuts.vue
index 09a6c38..f1e81a9 100644
--- a/src/views/mes/home/modules/shortcuts.vue
+++ b/src/views/mes/home/modules/shortcuts.vue
@@ -1,7 +1,13 @@
锘�<script lang="ts" setup>
+import { computed } from 'vue';
+
import { IconifyIcon } from '@vben/icons';
import { Card, Col, Row } from 'ant-design-vue';
+
+import { useHomeAccess } from '#/utils/use-home-access';
+
+import { HOME_SHORTCUTS } from '../data';
defineOptions({ name: 'MesHomeShortcuts' });
@@ -9,72 +15,21 @@
navigate: [name: string];
}>();
-/** 蹇嵎鍏ュ彛鍒楄〃锛�3脳3 缃戞牸甯冨眬涓庤鍗曠姸鎬佸垎甯冮潰鏉跨瓑楂� */
-const shortcuts = [
- {
- bgColor: '#409EFF',
- icon: 'lucide:file-text',
- name: '鐢熶骇璁㈠崟',
- routeName: 'MesProWorkOrder',
- },
- {
- bgColor: '#67C23A',
- icon: 'lucide:edit',
- name: '鐢熶骇鎶ュ伐',
- routeName: 'MesProFeedback',
- },
- {
- bgColor: '#E6A23C',
- icon: 'lucide:search',
- name: '璐ㄩ噺妫�楠�',
- routeName: 'MesQcIqc',
- },
- {
- bgColor: '#F56C6C',
- icon: 'lucide:box',
- name: '搴撳瓨鏌ヨ',
- routeName: 'MesWmMaterialStock',
- },
- {
- bgColor: '#7c3aed',
- icon: 'lucide:cpu',
- name: '璁惧绠$悊',
- routeName: 'MesDvMachinery',
- },
- {
- bgColor: '#0ea5e9',
- icon: 'lucide:list',
- name: '鐢熶骇浠诲姟',
- routeName: 'MesProTask',
- },
- {
- bgColor: '#14b8a6',
- icon: 'lucide:truck',
- name: '鍒拌揣閫氱煡',
- routeName: 'MesWmArrivalNotice',
- },
- {
- bgColor: '#f59e0b',
- icon: 'lucide:settings-2',
- name: '璁惧缁翠慨',
- routeName: 'MesDvRepair',
- },
- {
- bgColor: '#ec4899',
- icon: 'lucide:tickets',
- name: '娴佽浆鍗�',
- routeName: 'MesProCard',
- },
-];
+const { canSeeMenu } = useHomeAccess();
+
+/** 蹇嵎鍏ュ彛鍒楄〃锛�3脳3 缃戞牸甯冨眬涓庤鍗曠姸鎬佸垎甯冮潰鏉跨瓑楂橈紱鑿滃崟娌″紑鐨勪笉灞曠ず */
+const shortcuts = computed(() =>
+ HOME_SHORTCUTS.filter((item) => canSeeMenu(item.menu)),
+);
</script>
<template>
- <Card title="蹇嵎鍏ュ彛" class="h-full">
+ <Card v-if="shortcuts.length" title="蹇嵎鍏ュ彛" class="h-full">
<Row :gutter="16">
<Col v-for="item in shortcuts" :key="item.name" :span="8" class="mb-4">
<div
class="hover:bg-accent flex cursor-pointer flex-col items-center gap-2 rounded-lg py-3 transition-all hover:-translate-y-0.5"
- @click="emit('navigate', item.routeName)"
+ @click="emit('navigate', item.menu)"
>
<div
class="flex size-12 items-center justify-center rounded-xl text-white"
--
Gitblit v1.9.3