style:设备台账-选择关键件-创建时间时间戳转换

main
黄伟杰 7 days ago
parent ac7e65cec8
commit 5c07f054a3

@ -259,6 +259,9 @@
row-key="id"
@confirm="handleCriticalComponentSelectConfirm"
>
<template #createTime="{ row }">
{{ formatCriticalComponentCreateTime(row?.createTime) }}
</template>
<template #header>
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" min-label-width="68px"
style="margin-bottom: 10px">
@ -1171,12 +1174,21 @@ async function getDetailList() {
}
}
const formatCriticalComponentCreateTime = (value: any) => {
if (value === null || value === undefined || value === '') return ''
const isTimestamp = typeof value === 'number' || /^\d+$/.test(String(value))
const timestamp = isTimestamp ? Number(value) : undefined
const date = timestamp !== undefined
? new Date(timestamp < 1_000_000_000_000 ? timestamp * 1000 : timestamp)
: new Date(value)
return Number.isNaN(date.getTime()) ? String(value) : formatDate(date)
}
const criticalComponentColumns = computed(() => [
{ label: t('EquipmentManagement.EquipmentKeyItems.code'), prop: 'code', minWidth: 140 },
{ label: t('EquipmentManagement.EquipmentKeyItems.name'), prop: 'name', minWidth: 140 },
{ label: t('EquipmentManagement.EquipmentKeyItems.description'), prop: 'description', minWidth: 180 },
{ label: t('EquipmentManagement.EquipmentKeyItems.remark'), prop: 'remark', minWidth: 180 },
{ label: t('EquipmentManagement.EquipmentKeyItems.createTime'), prop: 'createTime', width: 180 }
{ label: t('EquipmentManagement.EquipmentKeyItems.createTime'), slotName: 'createTime', width: 180 }
])
const fetchCriticalComponentPage = async (params: Record<string, any>) => {

Loading…
Cancel
Save