优化订单状态颜色展示

This commit is contained in:
yml2213
2026-08-15 16:04:36 +08:00
parent 1756cfb262
commit 521cbe9d38
2 changed files with 26 additions and 14 deletions
@@ -115,6 +115,17 @@ import {
type DetailFieldItem,
} from './shared'
const FILTERABLE_WORK_ORDER_STATUSES = [
'pending_material',
'unassigned',
'open',
'in_progress',
'pending_acceptance',
'problem',
'accepted',
'cancelled',
] as const
export default function WorkOrdersPanel() {
const { message, modal } = App.useApp()
const navigate = useNavigate()
@@ -826,14 +837,10 @@ export default function WorkOrdersPanel() {
style={{ width: 150 }}
options={[
{ value: '', label: '全部状态' },
{ value: 'pending_material', label: '待完善' },
{ value: 'unassigned', label: '未分配' },
{ value: 'open', label: '待抢单' },
{ value: 'in_progress', label: '代练中' },
{ value: 'pending_acceptance', label: '待验收' },
{ value: 'problem', label: '问题单' },
{ value: 'accepted', label: '已验收' },
{ value: 'cancelled', label: '已取消' },
...FILTERABLE_WORK_ORDER_STATUSES.map((item) => ({
value: item,
label: <Tag color={resolveStatusColor(item)}>{formatStatus(item)}</Tag>,
})),
]}
onChange={(nextStatus) => {
setStatus(nextStatus)
@@ -226,11 +226,17 @@ export function formatStatus(status: string) {
}
export function resolveStatusColor(status: string) {
if (status === 'accepted') return 'green'
if (status === 'problem') return 'red'
if (status === 'pending_acceptance') return 'gold'
if (status === 'open') return 'blue'
return 'default'
const colors: Record<string, string> = {
pending_material: 'orange',
unassigned: 'cyan',
open: 'blue',
in_progress: 'geekblue',
pending_acceptance: 'purple',
problem: 'red',
accepted: 'green',
cancelled: 'default',
}
return colors[status] || 'default'
}
export function formatWorkerStatus(status: string) {
@@ -259,4 +265,3 @@ export function resolveSharingShareStatusColor(status: string) {
if (status === 'cancelled') return 'default'
return 'purple'
}