fix: 改善错误处理和数据校验
This commit is contained in:
@@ -132,17 +132,19 @@ export default {
|
||||
this.total = listResponse.total
|
||||
|
||||
// 处理状态统计
|
||||
const counts = countsResponse.data
|
||||
const counts = countsResponse.data || {}
|
||||
this.tabCounts = {
|
||||
all: counts.all,
|
||||
'0': counts.status0,
|
||||
'1': counts.status1,
|
||||
'2': counts.status2
|
||||
all: counts.all || 0,
|
||||
'0': counts.status0 || 0,
|
||||
'1': counts.status1 || 0,
|
||||
'2': counts.status2 || 0
|
||||
}
|
||||
|
||||
this.loading = false
|
||||
}).catch(() => {
|
||||
}).catch((error) => {
|
||||
this.loading = false
|
||||
console.error('加载数据失败:', error)
|
||||
this.$modal.msgError('加载数据失败,请稍后重试')
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
|
||||
Reference in New Issue
Block a user