import React from 'react'; import { Tag } from 'antd'; import { CheckCircleOutlined, ClockCircleOutlined, CloseCircleOutlined, MinusCircleOutlined, PauseCircleOutlined, QuestionCircleOutlined, SyncOutlined, WarningOutlined, } from '@ant-design/icons'; type StatusType = | 'pending' | 'inspecting' | 'released' | 'abnormal' | 'idle' | 'running' | 'paused' | 'completed' | 'online' | 'offline'; interface StatusBadgeProps { status: StatusType; type?: 'badge' | 'tag'; } export const StatusBadge: React.FC = ({ status, type = 'badge' }) => { const config = (() => { switch (status) { case 'pending': return { color: 'warning', text: '待查验', icon: }; case 'inspecting': case 'running': return { color: 'processing', text: '查验中', icon: }; case 'released': case 'completed': return { color: 'success', text: '已放行', icon: }; case 'abnormal': return { color: 'error', text: '异常', icon: }; case 'idle': return { color: 'default', text: '空闲', icon: }; case 'paused': return { color: 'warning', text: '已暂停', icon: }; case 'online': return { color: 'success', text: '在线', icon: }; case 'offline': return { color: 'error', text: '离线', icon: }; default: return { color: 'default', text: '未知', icon: }; } })(); if (type === 'tag') { return {config.text}; } return ( {config.icon} {config.text} ); };