feat(波次拣货): 拣货用时改为 HH:MM:SS 补零格式;新增复核用时列(复核完成-复核开始,同格式)
This commit is contained in:
parent
e5f13c1019
commit
5fffd8bb45
@ -150,6 +150,10 @@
|
||||
{{ formatDateTime(row.review_finish_time) }}
|
||||
</template>
|
||||
|
||||
<template #column-review_duration="{ row }">
|
||||
<span>{{ row.review_duration === null || row.review_duration === undefined ? '—' : row.review_duration }}</span>
|
||||
</template>
|
||||
|
||||
<template #column-created_at="{ row }">
|
||||
{{ formatDateTime(row.created_at || row.create_time) }}
|
||||
</template>
|
||||
@ -546,15 +550,19 @@ function parseDateValue(value: unknown): Date | null {
|
||||
return null
|
||||
}
|
||||
|
||||
/** 拣货用时 = 完成时间 - 开始时间(分钟,保留 2 位小数);起止缺失或解析失败返回 null */
|
||||
function calcPickDurationMinutes(start: unknown, finish: unknown): number | null {
|
||||
/** 时间差格式化为「时:分:秒」(HH:MM:SS 补零);起止缺失/解析失败/结束早于开始时返回 null */
|
||||
function calcDurationHMS(start: unknown, finish: unknown): string | null {
|
||||
const startDate = parseDateValue(start)
|
||||
const finishDate = parseDateValue(finish)
|
||||
if (!startDate || !finishDate) return null
|
||||
const ms = finishDate.getTime() - startDate.getTime()
|
||||
if (!Number.isFinite(ms)) return null
|
||||
const minutes = ms / (60 * 1000)
|
||||
return Number(minutes.toFixed(2))
|
||||
if (!Number.isFinite(ms) || ms < 0) return null
|
||||
const totalSeconds = Math.floor(ms / 1000)
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
const h = Math.floor(totalSeconds / 3600)
|
||||
const m = Math.floor((totalSeconds % 3600) / 60)
|
||||
const s = totalSeconds % 60
|
||||
return `${pad(h)}:${pad(m)}:${pad(s)}`
|
||||
}
|
||||
|
||||
function normalizePickTaskRow(row: WavePickTaskListItem) {
|
||||
@ -589,8 +597,10 @@ function normalizePickTaskRow(row: WavePickTaskListItem) {
|
||||
review_finish_time: row.review_finish_time || '',
|
||||
created_at: row.created_at || row.create_time || '',
|
||||
update_time: row.update_time || '',
|
||||
/** 拣货用时 = 完成时间 - 开始时间(分钟,保留 2 位小数);未完成/缺失时返回 null */
|
||||
pick_duration: calcPickDurationMinutes(row.start_at || row.start_time, row.finish_at || row.finish_time)
|
||||
/** 拣货用时 = 完成时间 - 开始时间(HH:MM:SS 补零);未完成/缺失时返回 null */
|
||||
pick_duration: calcDurationHMS(row.start_at || row.start_time, row.finish_at || row.finish_time),
|
||||
/** 复核用时 = 复核完成 - 复核开始(HH:MM:SS 补零);缺失/未复核完成时返回 null */
|
||||
review_duration: calcDurationHMS(row.review_start_time, row.review_finish_time)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1120,9 +1120,10 @@ export const pickTaskWaveColumns = applyWaveListCopyActions([
|
||||
{ prop: 'device_id', label: '设备ID', minWidth: 140 },
|
||||
{ prop: 'start_at', label: '开始时间', minWidth: 168 },
|
||||
{ prop: 'finish_at', label: '完成时间', minWidth: 168 },
|
||||
{ prop: 'pick_duration', label: '拣货用时(分)', width: 110, align: 'center' },
|
||||
{ prop: 'pick_duration', label: '拣货用时', minWidth: 110, align: 'center' },
|
||||
{ prop: 'review_start_time', label: '复核开始', minWidth: 168 },
|
||||
{ prop: 'review_finish_time', label: '复核完成', minWidth: 168 },
|
||||
{ prop: 'review_duration', label: '复核用时', minWidth: 110, align: 'center' },
|
||||
{ prop: 'created_at', label: '创建时间', minWidth: 168 },
|
||||
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
|
||||
{ prop: 'operation', label: '操作', width: 200, fixed: 'right' }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user