fix: 改善错误处理和数据校验

This commit is contained in:
wkc
2026-02-28 09:44:44 +08:00
parent 628ca483e7
commit ed45239b46

View File

@@ -132,17 +132,19 @@ export default {
this.total = listResponse.total this.total = listResponse.total
// 处理状态统计 // 处理状态统计
const counts = countsResponse.data const counts = countsResponse.data || {}
this.tabCounts = { this.tabCounts = {
all: counts.all, all: counts.all || 0,
'0': counts.status0, '0': counts.status0 || 0,
'1': counts.status1, '1': counts.status1 || 0,
'2': counts.status2 '2': counts.status2 || 0
} }
this.loading = false this.loading = false
}).catch(() => { }).catch((error) => {
this.loading = false this.loading = false
console.error('加载数据失败:', error)
this.$modal.msgError('加载数据失败,请稍后重试')
}) })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */