优化订单状态颜色展示

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, type DetailFieldItem,
} from './shared' } from './shared'
const FILTERABLE_WORK_ORDER_STATUSES = [
'pending_material',
'unassigned',
'open',
'in_progress',
'pending_acceptance',
'problem',
'accepted',
'cancelled',
] as const
export default function WorkOrdersPanel() { export default function WorkOrdersPanel() {
const { message, modal } = App.useApp() const { message, modal } = App.useApp()
const navigate = useNavigate() const navigate = useNavigate()
@@ -826,14 +837,10 @@ export default function WorkOrdersPanel() {
style={{ width: 150 }} style={{ width: 150 }}
options={[ options={[
{ value: '', label: '全部状态' }, { value: '', label: '全部状态' },
{ value: 'pending_material', label: '待完善' }, ...FILTERABLE_WORK_ORDER_STATUSES.map((item) => ({
{ value: 'unassigned', label: '未分配' }, value: item,
{ value: 'open', label: '待抢单' }, label: <Tag color={resolveStatusColor(item)}>{formatStatus(item)}</Tag>,
{ value: 'in_progress', label: '代练中' }, })),
{ value: 'pending_acceptance', label: '待验收' },
{ value: 'problem', label: '问题单' },
{ value: 'accepted', label: '已验收' },
{ value: 'cancelled', label: '已取消' },
]} ]}
onChange={(nextStatus) => { onChange={(nextStatus) => {
setStatus(nextStatus) setStatus(nextStatus)
@@ -226,11 +226,17 @@ export function formatStatus(status: string) {
} }
export function resolveStatusColor(status: string) { export function resolveStatusColor(status: string) {
if (status === 'accepted') return 'green' const colors: Record<string, string> = {
if (status === 'problem') return 'red' pending_material: 'orange',
if (status === 'pending_acceptance') return 'gold' unassigned: 'cyan',
if (status === 'open') return 'blue' open: 'blue',
return 'default' in_progress: 'geekblue',
pending_acceptance: 'purple',
problem: 'red',
accepted: 'green',
cancelled: 'default',
}
return colors[status] || 'default'
} }
export function formatWorkerStatus(status: string) { export function formatWorkerStatus(status: string) {
@@ -259,4 +265,3 @@ export function resolveSharingShareStatusColor(status: string) {
if (status === 'cancelled') return 'default' if (status === 'cancelled') return 'default'
return 'purple' return 'purple'
} }