优化日志加载和清理功能,增加流式读取和定期清理日志服务
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s

This commit is contained in:
孙诚
2025-12-30 11:07:14 +08:00
parent 0f52806569
commit 8ba279e957
5 changed files with 287 additions and 39 deletions

View File

@@ -185,10 +185,17 @@ const loadLogs = async (reset = false) => {
total.value = response.total
// 判断是否还有更多数据
if (logList.value.length >= total.value || newLogs.length < pageSize.value) {
finished.value = true
// total = -1 表示总数未知,此时只根据返回数据量判断
if (total.value === -1) {
// 如果返回的数据少于请求的数量,说明没有更多了
finished.value = newLogs.length < pageSize.value
} else {
finished.value = false
// 如果有明确的总数,则判断是否已加载完全部数据
if (logList.value.length >= total.value || newLogs.length < pageSize.value) {
finished.value = true
} else {
finished.value = false
}
}
} else {
showToast(response.message || '获取日志失败')