feat:网元切换清除缓存数据
This commit is contained in:
@@ -140,7 +140,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
|
import { ref, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
|
||||||
import * as echarts from 'echarts/core'
|
import * as echarts from 'echarts/core'
|
||||||
import { LineChart } from 'echarts/charts'
|
import { LineChart } from 'echarts/charts'
|
||||||
import { GridComponent } from 'echarts/components'
|
import { GridComponent } from 'echarts/components'
|
||||||
@@ -259,6 +259,15 @@ async function onImsNeChange() {
|
|||||||
// 切换网元时,先清空旧数据
|
// 切换网元时,先清空旧数据
|
||||||
imsRealtimeRawData.value = []
|
imsRealtimeRawData.value = []
|
||||||
|
|
||||||
|
// 强制触发Vue响应式更新,确保所有计算值立即更新为默认状态
|
||||||
|
await nextTick()
|
||||||
|
|
||||||
|
// 立即更新所有图表为空状态,清除上一个网元的数据显示
|
||||||
|
updateActiveCallsChart()
|
||||||
|
updateFailedCallsChart()
|
||||||
|
updateActiveRegistrationsChart()
|
||||||
|
updateFailedRegistrationsChart()
|
||||||
|
|
||||||
// 先获取历史数据,再订阅实时数据
|
// 先获取历史数据,再订阅实时数据
|
||||||
await fetchHistoryData(selectedImsNeId.value)
|
await fetchHistoryData(selectedImsNeId.value)
|
||||||
subscribeImsRealtime(selectedImsNeId.value)
|
subscribeImsRealtime(selectedImsNeId.value)
|
||||||
@@ -348,6 +357,13 @@ function updateActiveCallsChart() {
|
|||||||
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 清除所有旧标注,即使在无数据时也要清理
|
||||||
|
const chartContainer = callsChartRef.value
|
||||||
|
if (chartContainer) {
|
||||||
|
const existingLabels = chartContainer.querySelectorAll('.chart-label')
|
||||||
|
existingLabels.forEach(label => label.remove())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,6 +528,13 @@ function updateFailedCallsChart() {
|
|||||||
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 清除所有旧标注,即使在无数据时也要清理
|
||||||
|
const chartContainer = failedCallsChartRef.value
|
||||||
|
if (chartContainer) {
|
||||||
|
const existingLabels = chartContainer.querySelectorAll('.chart-label')
|
||||||
|
existingLabels.forEach(label => label.remove())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,6 +695,13 @@ function updateActiveRegistrationsChart() {
|
|||||||
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 清除所有旧标注,即使在无数据时也要清理
|
||||||
|
const chartContainer = regChartRef.value
|
||||||
|
if (chartContainer) {
|
||||||
|
const existingLabels = chartContainer.querySelectorAll('.chart-label')
|
||||||
|
existingLabels.forEach(label => label.remove())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,6 +864,13 @@ function updateFailedRegistrationsChart() {
|
|||||||
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
areaStyle: { color: 'rgba(217,217,217,0.1)' } // 淡灰色填充
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 清除所有旧标注,即使在无数据时也要清理
|
||||||
|
const chartContainer = failedRegChartRef.value
|
||||||
|
if (chartContainer) {
|
||||||
|
const existingLabels = chartContainer.querySelectorAll('.chart-label')
|
||||||
|
existingLabels.forEach(label => label.remove())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user