99 lines
3.0 KiB
TypeScript
99 lines
3.0 KiB
TypeScript
const orderStatusLabels: Record<string, string> = {
|
|
DRAFT: '草稿',
|
|
SUBMITTED: '待审核',
|
|
APPROVED: '已审核',
|
|
ACCEPTED: '已受理',
|
|
REJECTED: '已驳回',
|
|
PROCESSING: '处理中',
|
|
COMPLETED: '已完成',
|
|
CANCELLED: '已取消',
|
|
PENDING_REVIEW: '待审核',
|
|
WAIT_MEASURE: '待测量数据',
|
|
WAIT_SPLIT: '待分柜',
|
|
LOADING: '装柜中',
|
|
LOADED: '装柜完成',
|
|
DELIVERED: '派送完成',
|
|
}
|
|
|
|
const reviewStatusLabels: Record<string, string> = {
|
|
NOT_SUBMITTED: '未提交',
|
|
UNRECORDED: '未录入',
|
|
PENDING: '待审核',
|
|
APPROVED: '审核通过',
|
|
REJECTED: '审核驳回',
|
|
CONFIRMED: '已确认',
|
|
}
|
|
|
|
const loadingStatusLabels: Record<string, string> = {
|
|
NOT_LOADED: '未配载',
|
|
WAIT_LOADING: '待配载',
|
|
EDITING: '预装柜中',
|
|
LOADING: '配载中',
|
|
LOADED: '已配载',
|
|
COMPLETED: '装柜完成',
|
|
}
|
|
|
|
const historyActionLabels: Record<string, string> = {
|
|
CREATE: '创建订单',
|
|
CREATED: '创建订单',
|
|
SUBMITTED: '提交订单',
|
|
APPROVED: '审核通过',
|
|
ORDER_APPROVED: '订单审核通过',
|
|
REJECTED: '审核驳回',
|
|
MEASURE_APPROVE: '测量审核通过',
|
|
MEASURE_REJECT: '测量审核驳回',
|
|
INBOUND_BEGIN: '开始入库',
|
|
INBOUND_COMPLETE: '入库完成',
|
|
UI_FIXTURE_MEASURE_APPROVE: '测量数据审核通过',
|
|
UI_FIXTURE_INBOUND_BEGIN: '开始入库',
|
|
STATUS_UPDATE: '状态更新',
|
|
DECLARATION_UPDATE: '客户申报资料变更',
|
|
}
|
|
|
|
const fulfillmentRoleLabels: Record<string, string> = {
|
|
REMAINDER: '当前余量',
|
|
ACTIVE_REMAINDER: '当前余量',
|
|
LOADED: '已完成分片',
|
|
COMPLETED_FRAGMENT: '已完成分片',
|
|
SOURCE_COMPLETED: '已完成分片',
|
|
}
|
|
|
|
function normalized(value: string | null | undefined) {
|
|
return value?.trim().toUpperCase() || ''
|
|
}
|
|
|
|
function statusLabel(value: string | null | undefined, labels: Record<string, string>, emptyLabel = '—') {
|
|
const status = normalized(value)
|
|
if (!status) return emptyLabel
|
|
return labels[status] || '未知状态'
|
|
}
|
|
|
|
export function unifiedOrderStatusLabel(value: string | null | undefined, emptyLabel = '—') {
|
|
return statusLabel(value, orderStatusLabels, emptyLabel)
|
|
}
|
|
|
|
export function unifiedOrderReviewStatusLabel(value: string | null | undefined, emptyLabel = '—') {
|
|
return statusLabel(value, reviewStatusLabels, emptyLabel)
|
|
}
|
|
|
|
export function unifiedOrderLoadingStatusLabel(value: string | null | undefined, emptyLabel = '—') {
|
|
return statusLabel(value, loadingStatusLabels, emptyLabel)
|
|
}
|
|
|
|
export function unifiedOrderHistoryActionLabel(value: string | null | undefined) {
|
|
const action = normalized(value)
|
|
if (!action) return '状态更新'
|
|
return historyActionLabels[action] || '状态更新'
|
|
}
|
|
|
|
export function unifiedOrderFulfillmentRoleLabel(value: string | null | undefined) {
|
|
const role = normalized(value)
|
|
if (!role) return '分片'
|
|
return fulfillmentRoleLabels[role] || '未知类型'
|
|
}
|
|
|
|
export function unifiedOrderFulfillmentStatusLabel(status: string | null | undefined, role: string | null | undefined) {
|
|
if (!status) return unifiedOrderFulfillmentRoleLabel(role)
|
|
return unifiedOrderStatusLabel(status)
|
|
}
|