|
|
|
@ -103,6 +103,23 @@ const recordGroups = ref<RecordGroup[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
const collectionTimeRange = ref<string[]>([])
|
|
|
|
const collectionTimeRange = ref<string[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const formatDateTime = (date: Date) => {
|
|
|
|
|
|
|
|
const pad = (value: number) => String(value).padStart(2, '0')
|
|
|
|
|
|
|
|
const y = date.getFullYear()
|
|
|
|
|
|
|
|
const m = pad(date.getMonth() + 1)
|
|
|
|
|
|
|
|
const d = pad(date.getDate())
|
|
|
|
|
|
|
|
const h = pad(date.getHours())
|
|
|
|
|
|
|
|
const mi = pad(date.getMinutes())
|
|
|
|
|
|
|
|
const s = pad(date.getSeconds())
|
|
|
|
|
|
|
|
return `${y}-${m}-${d} ${h}:${mi}:${s}`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const buildLastHoursRange = (hours: number) => {
|
|
|
|
|
|
|
|
const end = new Date()
|
|
|
|
|
|
|
|
const start = new Date(end.getTime() - hours * 60 * 60 * 1000)
|
|
|
|
|
|
|
|
return [formatDateTime(start), formatDateTime(end)]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const toGroupMap = (value: any): Record<string, any[]> => {
|
|
|
|
const toGroupMap = (value: any): Record<string, any[]> => {
|
|
|
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
|
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
|
|
return {}
|
|
|
|
return {}
|
|
|
|
@ -206,6 +223,7 @@ watch(
|
|
|
|
if (!visible) {
|
|
|
|
if (!visible) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
collectionTimeRange.value = buildLastHoursRange(4)
|
|
|
|
fetchHistory()
|
|
|
|
fetchHistory()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|