|
|
@@ -219,7 +219,6 @@
|
|
|
normalized.records = normalized.records.map(row => normalizeMonitoringRecord(row, props.metric, props.monitorType))
|
|
|
page.value = normalized
|
|
|
} catch (error) {
|
|
|
- page.value = {records: [], total: 0}
|
|
|
loadError.value = true
|
|
|
console.warn(`[${props.title}] 数据加载失败`, error)
|
|
|
} finally {
|
|
|
@@ -257,14 +256,18 @@
|
|
|
async function showTrend(row) {
|
|
|
current.value = row
|
|
|
trendVisible.value = true
|
|
|
- await loadTrend()
|
|
|
+ await loadTrend(true)
|
|
|
}
|
|
|
|
|
|
- async function loadTrend() {
|
|
|
+ async function loadTrend(resetTrend = false) {
|
|
|
if (!current.value?.id) return
|
|
|
trendLoading.value = true
|
|
|
trendError.value = false
|
|
|
- trendRecords.value = []
|
|
|
+ if (resetTrend) {
|
|
|
+ trendRecords.value = []
|
|
|
+ chart?.dispose()
|
|
|
+ chart = undefined
|
|
|
+ }
|
|
|
try {
|
|
|
const response = await props.trend(current.value.id, buildTrendQuery(query.value.timeRange))
|
|
|
const data = unwrapResponse(response)
|
|
|
@@ -274,8 +277,10 @@
|
|
|
renderTrend()
|
|
|
} catch (error) {
|
|
|
trendError.value = true
|
|
|
- chart?.dispose()
|
|
|
- chart = undefined
|
|
|
+ if (resetTrend) {
|
|
|
+ chart?.dispose()
|
|
|
+ chart = undefined
|
|
|
+ }
|
|
|
console.warn(`[${props.title}] 趋势数据加载失败`, error)
|
|
|
} finally {
|
|
|
trendLoading.value = false
|