| | |
| | | <div> |
| | | <!-- 顶部统计卡片 --> |
| | | <div class="stats-cards"> |
| | | <div v-for="item in statItems" :key="item.name" class="stat-card"> |
| | | <img src="@/assets/BI/icon@2x.png" alt="图标" class="card-icon" /> |
| | | <div v-for="(item, index) in statItems" :key="item.name" class="stat-card"> |
| | | <div class="card-icon" :style="{ color: ICON_COLORS[index % ICON_COLORS.length] }"> |
| | | <!-- 检验单 --> |
| | | <svg v-if="index % 3 === 0" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> |
| | | <rect x="5" y="4" width="14" height="17" rx="2" /> |
| | | <path d="M9 2.5h6v3H9z" /> |
| | | <path d="M9 13l2 2 4-4" /> |
| | | </svg> |
| | | <!-- 待完成:时钟 --> |
| | | <svg v-else-if="index % 3 === 1" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> |
| | | <circle cx="12" cy="12" r="9" /> |
| | | <path d="M12 7v5l3.5 2" /> |
| | | </svg> |
| | | <!-- 已完成:对勾圆环 --> |
| | | <svg v-else width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> |
| | | <circle cx="12" cy="12" r="9" /> |
| | | <path d="M8.5 12.5l2.5 2.5 5-5.5" /> |
| | | </svg> |
| | | </div> |
| | | <div class="card-content"> |
| | | <span class="card-label">{{ item.name }}</span> |
| | | <span class="card-value">{{ item.value }}</span> |
| | |
| | | <script setup> |
| | | import { ref, onMounted } from 'vue' |
| | | import { qualityInspectionCount } from '@/api/viewIndex.js' |
| | | import { BI } from '../theme.js' |
| | | |
| | | const statItems = ref([]) |
| | | |
| | | // 卡片图标点缀色(检验/待完成/已完成) |
| | | const ICON_COLORS = [BI.accentBright, BI.series[3], BI.up] |
| | | |
| | | const formatPercent = (val) => { |
| | | const num = Number(val) || 0 |
| | |
| | | flex: 1; |
| | | display: flex; |
| | | align-items: center; |
| | | background-image: url('@/assets/BI/border@2x.png'); |
| | | background-size: 100% 100%; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background: var(--bi-panel-bg); |
| | | border: 1px solid var(--bi-panel-border); |
| | | border-radius: 8px; |
| | | position: relative; |
| | | overflow: hidden; |
| | | height: 142px; |
| | | } |
| | | |
| | | /* 顶部品牌蓝亮线,替代图片描边 */ |
| | | .stat-card::before { |
| | | content: ''; |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | height: 2px; |
| | | background: linear-gradient(90deg, var(--bi-accent) 0%, transparent 70%); |
| | | } |
| | | |
| | | .card-icon { |
| | | width: 100px; |
| | | height: 100px; |
| | | margin: 20px 20px 0 10px; |
| | | width: 52px; |
| | | height: 52px; |
| | | margin: 0 16px 0 20px; |
| | | border-radius: 8px; |
| | | background: rgba(74, 108, 240, 0.12); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .card-content { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | gap: 8px; |
| | | min-width: 0; |
| | | } |
| | | |
| | | .card-value { |
| | | font-weight: 500; |
| | | font-size: 40px; |
| | | background: linear-gradient(360deg, #008bfd 0%, #ffffff 100%); |
| | | -webkit-background-clip: text; |
| | | -webkit-text-fill-color: transparent; |
| | | background-clip: text; |
| | | font-weight: 600; |
| | | font-size: 36px; |
| | | color: var(--bi-text-strong); |
| | | font-variant-numeric: tabular-nums; |
| | | line-height: 1.1; |
| | | } |
| | | |
| | | .card-label { |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | color: rgba(208, 231, 255, 0.7); |
| | | color: var(--bi-text); |
| | | } |
| | | |
| | | .card-compare { |
| | |
| | | align-items: center; |
| | | gap: 6px; |
| | | font-size: 15px; |
| | | color: #d0e7ff; |
| | | color: var(--bi-text); |
| | | white-space: nowrap; |
| | | flex-wrap: nowrap; |
| | | } |
| | |
| | | |
| | | .compare-value { |
| | | font-weight: 600; |
| | | font-variant-numeric: tabular-nums; |
| | | } |
| | | |
| | | .compare-icon { |
| | |
| | | |
| | | .compare-up .compare-value, |
| | | .compare-up .compare-icon { |
| | | color: #00c853; |
| | | color: var(--bi-up); |
| | | } |
| | | |
| | | .compare-down .compare-value, |
| | | .compare-down .compare-icon { |
| | | color: #ff5252; |
| | | color: var(--bi-down); |
| | | } |
| | | </style> |