mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 13:28:39 +08:00
feat: ops 错误详情弹窗支持自定义时间区间
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user