Compare commits

...

3 Commits

4 changed files with 46 additions and 3 deletions

View File

@ -140,7 +140,7 @@
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, Refresh } from '@element-plus/icons-vue'
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'

View File

@ -138,6 +138,10 @@
{{ formatDateTime(row.finish_at || row.finish_time) }}
</template>
<template #column-pick_duration="{ row }">
<span>{{ row.pick_duration === null || row.pick_duration === undefined ? '—' : row.pick_duration }}</span>
</template>
<template #column-review_start_time="{ row }">
{{ formatDateTime(row.review_start_time) }}
</template>
@ -146,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>
@ -528,6 +536,35 @@ function toNumber(value: unknown, fallback = 0): number {
return Number.isFinite(num) ? num : fallback
}
/** 解析时间值(支持 毫秒/秒级时间戳、ISO/日期字符串),失败返回 null */
function parseDateValue(value: unknown): Date | null {
if (value === null || value === undefined || value === '') return null
const text = String(value)
const ts = Number(text)
if (Number.isFinite(ts) && ts > 0) {
const date = new Date(ts)
if (!Number.isNaN(date.getTime())) return date
}
const date = new Date(text)
if (!Number.isNaN(date.getTime())) return date
return 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) || 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) {
return {
...row,
@ -559,7 +596,11 @@ function normalizePickTaskRow(row: WavePickTaskListItem) {
review_start_time: row.review_start_time || '',
review_finish_time: row.review_finish_time || '',
created_at: row.created_at || row.create_time || '',
update_time: row.update_time || ''
update_time: row.update_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)
}
}

View File

@ -1120,8 +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: '拣货用时', 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' }

View File

@ -192,7 +192,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storewarehouse.store/storeWarehouse'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'