19 lines
621 B
TypeScript
19 lines
621 B
TypeScript
import type { OceanBookingStatus } from './types'
|
|||
|
|
|
||
|
|
export const oceanBookingStatusLabels: Record<OceanBookingStatus, string> = {
|
||
|
|
CONFIRMED: '已确认',
|
||
|
|
RELEASED: '已放舱',
|
||
|
|
CHANGE_PENDING: '变更中',
|
||
|
|
CANCELLED: '已取消',
|
||
|
|
}
|
||
|
|
|
||
|
|
export const oceanBookingStatusOptions = Object.entries(oceanBookingStatusLabels).map(([value, label]) => ({
|
||
|
|
value: value as OceanBookingStatus,
|
||
|
|
label,
|
||
|
|
}))
|
||
|
|
|
||
|
|
export function oceanBookingStatusLabel(status: string | null | undefined, emptyLabel = '未设置') {
|
||
|
|
if (!status) return emptyLabel
|
||
|
|
return oceanBookingStatusLabels[status as OceanBookingStatus] || '未知状态'
|
||
|
|
}
|