4 天以前 91c82965b2d987452ca276e3a03b48c8dcda2ae9
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<script lang="ts" setup>
import type { MesBagCodeHomeApi } from '#/api/mes/bag-code-home';
 
import { CountTo } from '@vben/common-ui';
import { IconifyIcon } from '@vben/icons';
 
import { Card, Col, Row } from 'ant-design-vue';
 
defineOptions({ name: 'BagCodeHomeBasicCards' });
 
const props = defineProps<{
  summary: MesBagCodeHomeApi.Summary;
}>();
 
const emit = defineEmits<{
  navigate: [name: string];
}>();
 
/** 基础数据卡片配置 */
const cards = [
  {
    gradient: 'linear-gradient(135deg, #409eff, #66b1ff)',
    icon: 'lucide:package',
    name: '品种总数',
    routeName: 'MdmItem',
    value: () => props.summary.mdmItemCount,
  },
  {
    gradient: 'linear-gradient(135deg, #67c23a, #85ce61)',
    icon: 'lucide:box',
    name: 'MES 品种',
    routeName: 'MesMdItem',
    value: () => props.summary.mesItemCount,
  },
  {
    gradient: 'linear-gradient(135deg, #e6a23c, #ebb563)',
    icon: 'lucide:folder-tree',
    name: '品种分类',
    routeName: 'MesMdItemType',
    value: () => props.summary.itemTypeCount,
  },
  {
    gradient: 'linear-gradient(135deg, #7c3aed, #9461f5)',
    icon: 'lucide:ruler',
    name: '计量单位',
    routeName: 'MdmUnit',
    value: () => props.summary.unitMeasureCount,
  },
];
</script>
 
<template>
  <Row :gutter="16">
    <Col v-for="card in cards" :key="card.name" :lg="6" :md="12" :sm="12" :xl="6" :xs="24" class="mb-4">
      <Card
        class="kpi-card cursor-pointer transition-all hover:-translate-y-1 hover:shadow-lg"
        @click="emit('navigate', card.routeName)"
      >
        <div class="flex items-center gap-4">
          <div
            class="flex size-14 flex-shrink-0 items-center justify-center rounded-xl text-white"
            :style="{ background: card.gradient }"
          >
            <IconifyIcon class="size-7" :icon="card.icon" />
          </div>
          <div>
            <div class="text-muted-foreground mb-1 text-sm">{{ card.name }}</div>
            <CountTo class="text-2xl font-bold leading-tight" :end-val="card.value()" :duration="1500" />
          </div>
        </div>
      </Card>
    </Col>
  </Row>
</template>