feat: ops 错误详情弹窗支持自定义时间区间

This commit is contained in:
feitianbubu
2026-05-01 14:16:49 +08:00
parent 48912014a1
commit 5e72deb7d4
2 changed files with 16 additions and 1 deletions
@@ -114,6 +114,8 @@
<OpsErrorDetailsModal
:show="showErrorDetails"
:time-range="timeRange"
:custom-start-time="customStartTime"
:custom-end-time="customEndTime"
:platform="platform"
:group-id="groupId"
:error-type="errorDetailsType"
@@ -9,6 +9,8 @@ import { opsAPI, type OpsErrorLog } from '@/api/admin/ops'
interface Props {
show: boolean
timeRange: string
customStartTime?: string | null
customEndTime?: string | null
platform?: string
groupId?: number | null
errorType: 'request' | 'upstream'
@@ -96,6 +98,17 @@ async function fetchErrorLogs() {
view: viewMode.value
}
if (props.timeRange === 'custom') {
if (props.customStartTime && props.customEndTime) {
params.start_time = props.customStartTime
params.end_time = props.customEndTime
delete params.time_range
} else {
// Safety fallback: avoid sending time_range=custom (backend doesn't support it)
params.time_range = '1h'
}
}
const platform = String(props.platform || '').trim()
if (platform) params.platform = platform
if (typeof props.groupId === 'number' && props.groupId > 0) params.group_id = props.groupId
@@ -147,7 +160,7 @@ watch(
)
watch(
() => [props.timeRange, props.platform, props.groupId] as const,
() => [props.timeRange, props.customStartTime, props.customEndTime, props.platform, props.groupId] as const,
() => {
if (!props.show) return
page.value = 1