From 8a2832d02126f33596c125c855d7effe96d69da1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 10:02:52 +0800
Subject: [PATCH] refactor(首页): 展示模块跟随菜单权限自动隐藏
---
src/views/dashboard/analytics/modules/kpi-cards.vue | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/src/views/dashboard/analytics/modules/kpi-cards.vue b/src/views/dashboard/analytics/modules/kpi-cards.vue
index 50cab31..4595029 100644
--- a/src/views/dashboard/analytics/modules/kpi-cards.vue
+++ b/src/views/dashboard/analytics/modules/kpi-cards.vue
@@ -8,6 +8,8 @@
import { Col, Row } from 'ant-design-vue';
+import { useHomeAccess } from '#/utils/use-home-access';
+
defineOptions({ name: 'DashboardKpiCards' });
const props = defineProps<{
@@ -17,6 +19,18 @@
const emit = defineEmits<{
navigate: [name: string];
}>();
+
+const { canQuery, canSeeMenu } = useHomeAccess();
+
+/** 涓ゅ紶鍗$殑鏁版嵁閮芥潵鑷椤垫眹鎬绘帴鍙o紝娌℃湁璇ユ潈闄愭椂鍙栦笅鐨勬槸绌哄�� */
+const canViewSummary = computed(() => canQuery('mes:home:query'));
+const showQuality = computed(
+ () => canViewSummary.value && canSeeMenu('MesQcIqc'),
+);
+const showEquipment = computed(
+ () => canViewSummary.value && canSeeMenu('MesDvMachinery'),
+);
+const bothVisible = computed(() => showQuality.value && showEquipment.value);
const qualityRate = computed(() => {
const total =
@@ -59,13 +73,21 @@
<template>
<Row :gutter="16">
<!-- 璐ㄩ噺鍚堟牸鐜� -->
- <Col :lg="12" :md="12" :sm="12" :xl="12" :xs="24" class="mb-4">
+ <Col
+ v-if="showQuality"
+ :lg="bothVisible ? 12 : 24"
+ :md="bothVisible ? 12 : 24"
+ :sm="bothVisible ? 12 : 24"
+ :xl="bothVisible ? 12 : 24"
+ :xs="24"
+ class="mb-4"
+ >
<div
class="glass-tilt group cursor-pointer overflow-hidden rounded-2xl border-0"
:style="tiltStyle('quality')"
@mousemove="(e: MouseEvent) => onMouseMove(e, 'quality')"
@mouseleave="onMouseLeave('quality')"
- @click="emit('navigate', 'MesQcRecord')"
+ @click="emit('navigate', 'MesQcIqc')"
>
<div class="relative z-10 flex items-center gap-4 p-5">
<div class="flex size-12 flex-shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-orange-500 to-amber-400 shadow-lg shadow-orange-500/25 transition-transform duration-300 group-hover:scale-110">
@@ -92,7 +114,15 @@
</Col>
<!-- 璁惧杩愯鐜� -->
- <Col :lg="12" :md="12" :sm="12" :xl="12" :xs="24" class="mb-4">
+ <Col
+ v-if="showEquipment"
+ :lg="bothVisible ? 12 : 24"
+ :md="bothVisible ? 12 : 24"
+ :sm="bothVisible ? 12 : 24"
+ :xl="bothVisible ? 12 : 24"
+ :xs="24"
+ class="mb-4"
+ >
<div
class="glass-tilt group cursor-pointer overflow-hidden rounded-2xl border-0"
:style="tiltStyle('equip')"
--
Gitblit v1.9.3