优化
This commit is contained in:
@@ -48,8 +48,22 @@ export function lastMileOrderTypeLabel(value: unknown) {
|
||||
export function formatOverseasDateTime(value: unknown) {
|
||||
const raw = String(value ?? '').trim()
|
||||
if (!raw) return '—'
|
||||
const date = new Date(raw)
|
||||
return Number.isNaN(date.getTime()) ? raw : date.toLocaleString('zh-CN', { hour12: false })
|
||||
const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(raw)
|
||||
const date = value instanceof Date
|
||||
? new Date(value.getTime())
|
||||
: typeof value === 'number'
|
||||
? new Date(value)
|
||||
: dateOnly
|
||||
? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3]))
|
||||
: new Date(raw)
|
||||
if (Number.isNaN(date.getTime())) return raw
|
||||
const pad = (part: number) => String(part).padStart(2, '0')
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
}
|
||||
|
||||
export function palletMergeLabel(value: unknown) {
|
||||
const code = String(value ?? '').trim()
|
||||
return ({ REQUIRED: '待合托', MERGED: '已合托' } as Record<string, string>)[code] || (code ? text(code) : '未标记')
|
||||
}
|
||||
|
||||
export function toLastMileOrderListItem(dto: LastMileOrderSummaryDto): LastMileOrderListItem {
|
||||
@@ -69,6 +83,7 @@ export function toLastMileOrderListItem(dto: LastMileOrderSummaryDto): LastMileO
|
||||
containerStatus: text(dto.containerStatus),
|
||||
abnormal: yesNo(dto.abnormal),
|
||||
held: yesNo(dto.detained),
|
||||
detained: dto.detained === true,
|
||||
pallets: count(dto.palletCount),
|
||||
cartons: count(dto.packageCount),
|
||||
volume: count(dto.volumeCbm),
|
||||
@@ -82,7 +97,8 @@ export function toLastMileOrderListItem(dto: LastMileOrderSummaryDto): LastMileO
|
||||
dispatchOrderNo: text(dto.deliveryOrderNo),
|
||||
relabelOrderNo: text(dto.relabelOrderNo),
|
||||
relabelStatus: lastMileStatusLabel(dto.relabelStatus),
|
||||
consolidated: text(dto.palletMergeFlag),
|
||||
consolidated: palletMergeLabel(dto.palletMergeFlag),
|
||||
palletMergeFlag: String(dto.palletMergeFlag ?? '').trim(),
|
||||
status: lastMileStatusLabel(dto.currentStatus),
|
||||
internalRemark: text(dto.privateRemark),
|
||||
customerRemark: text(dto.customerRemark),
|
||||
|
||||
Reference in New Issue
Block a user