gaoluyang
8 天以前 6ebcfebf58fe23ea401de1050b15ba85e41763a9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<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' });
 
const emit = defineEmits<{
  navigate: [name: string];
}>();
 
const { canSeeMenu } = useHomeAccess();
 
/** 快捷入口列表,3×3 网格布局与订单状态分布面板等高;菜单没开的不展示 */
const shortcuts = computed(() =>
  HOME_SHORTCUTS.filter((item) => canSeeMenu(item.menu)),
);
</script>
 
<template>
  <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.menu)"
        >
          <div
            class="flex size-12 items-center justify-center rounded-xl text-white"
            :style="{ background: item.bgColor }"
          >
            <IconifyIcon class="size-6" :icon="item.icon" />
          </div>
          <span class="text-sm">{{ item.name }}</span>
        </div>
      </Col>
    </Row>
  </Card>
</template>