fix: 处理错误信息字段的空值和空字符串

更新多个文件以确保错误信息字段在处理时将空字符串和未定义值转换为null,增强数据一致性和展示逻辑。包括前端组件和后端服务的相应调整。
This commit is contained in:
dmy
2026-01-14 21:33:35 +08:00
parent 740c11527f
commit 10565af001
4 changed files with 9 additions and 7 deletions

View File

@@ -26,14 +26,14 @@
</el-table-column>
<el-table-column label="状态" width="100">
<template #default="{ row }">
<el-tag :type="row.error ? 'danger' : (row.count > 0 ? 'success' : 'info')">
{{ row.error ? '出错' : (row.count > 0 ? '正常' : '无数据') }}
<el-tag :type="row.error && row.error.trim() ? 'danger' : (row.count > 0 ? 'success' : 'info')">
{{ row.error && row.error.trim() ? '出错' : (row.count > 0 ? '正常' : '无数据') }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="错误信息" min-width="200">
<template #default="{ row }">
<span v-if="row.error" style="color: #f56c6c">{{ row.error }}</span>
<span v-if="row.error && row.error.trim()" style="color: #f56c6c">{{ row.error }}</span>
<span v-else>-</span>
</template>
</el-table-column>
@@ -100,7 +100,7 @@ const activeSources = computed(() => {
})
const errorSources = computed(() => {
return crawlStats.value.filter(item => item.error).length
return crawlStats.value.filter(item => item.error && item.error.trim()).length
})
const formatDate = (dateStr: string | null) => {