|
|
|
@ -4,6 +4,13 @@ import {h, ref} from "vue"; |
|
|
|
import {systemSelectParams} from "@/api/alert/model/model/optionsModel"; |
|
|
|
import {formatToDateTime, getDate} from "@/utils/dateUtil"; |
|
|
|
|
|
|
|
|
|
|
|
export const currentTime = ref(Date.now()) |
|
|
|
|
|
|
|
setInterval(() => { |
|
|
|
currentTime.value = Date.now() |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
function toTimestamp(time: string): number { |
|
|
|
if (!time) return 0 |
|
|
|
// 兼容:2026-01-04T09:30:15 / 2026-01-04 09:30:15
|
|
|
|
@ -183,8 +190,7 @@ export const columns: BasicColumn[] = [ |
|
|
|
return h('div', [ |
|
|
|
h('div', record.insertTime), |
|
|
|
// h('div', '--'),
|
|
|
|
h('div', formatToDateTime(record.currentTime)) |
|
|
|
|
|
|
|
h('div', formatToDateTime(currentTime.value)) |
|
|
|
]); |
|
|
|
}, |
|
|
|
|
|
|
|
@ -192,9 +198,10 @@ export const columns: BasicColumn[] = [ |
|
|
|
{ |
|
|
|
title: '持续时长', |
|
|
|
dataIndex: 'timeDiffStr', |
|
|
|
width: 85, |
|
|
|
width: 100, |
|
|
|
customRender: ({ record }) => { |
|
|
|
const diffMs = record.currentTime - toTimestamp(record.insertTime) |
|
|
|
if (!record.insertTime) return '-' |
|
|
|
const diffMs = currentTime.value - toTimestamp(record.insertTime) |
|
|
|
return getDate(diffMs) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|