4 天以前 b7eb1da8220f5b72f6891c3c6471ca386604cce4
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: 'BagCodeHomeBagCodeCards' });
 
const props = defineProps<{
  summary: MesBagCodeHomeApi.Summary;
}>();
 
const emit = defineEmits<{
  navigate: [name: string];
}>();
 
/** 一袋一码卡片配置 */
const cards = [
  {
    gradient: 'linear-gradient(135deg, #0ea5e9, #38bdf8)',
    icon: 'lucide:factory',
    name: '产线',
    routeName: 'MesProLine',
    value: () => props.summary.lineCount,
  },
  {
    gradient: 'linear-gradient(135deg, #f59e0b, #fbbf24)',
    icon: 'lucide:layers',
    name: '生产批次',
    routeName: 'MesProBatch',
    value: () => props.summary.batchCount,
  },
  {
    gradient: 'linear-gradient(135deg, #ec4899, #f472b6)',
    icon: 'lucide:scan-barcode',
    name: '袋码',
    routeName: 'MesProBagCode',
    value: () => props.summary.bagCodeCount,
  },
  {
    gradient: 'linear-gradient(135deg, #14b8a6, #2dd4bf)',
    icon: 'lucide:grid-2x2',
    name: '托盘码',
    routeName: 'MesProPallet',
    value: () => props.summary.palletCount,
  },
];
</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>