| | |
| | | |
| | | import { Col, Row } from 'ant-design-vue'; |
| | | |
| | | import { useHomeAccess } from '#/utils/use-home-access'; |
| | | |
| | | defineOptions({ name: 'DashboardKpiCards' }); |
| | | |
| | | const props = defineProps<{ |
| | |
| | | const emit = defineEmits<{ |
| | | navigate: [name: string]; |
| | | }>(); |
| | | |
| | | const { canQuery, canSeeMenu } = useHomeAccess(); |
| | | |
| | | /** 两张卡的数据都来自首页汇总接口,没有该权限时取下的是空值 */ |
| | | 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 = |
| | |
| | | <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"> |
| | |
| | | </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')" |