fix: Memory.vue stats fallback and error handling
This commit is contained in:
@@ -208,11 +208,11 @@ async function loadData() {
|
||||
confidenceStats.low = res.data.stats.low || 0
|
||||
confidenceStats.total = res.data.stats.total || 0
|
||||
} else {
|
||||
// Fallback: compute from current page items
|
||||
confidenceStats.high = items.value.filter(i => i.confidence > 50).length
|
||||
confidenceStats.medium = items.value.filter(i => i.confidence >= 10 && i.confidence <= 50).length
|
||||
confidenceStats.low = items.value.filter(i => i.confidence < 10).length
|
||||
confidenceStats.total = total.value
|
||||
// Fallback: stats not available from server, default to 0
|
||||
confidenceStats.high = 0
|
||||
confidenceStats.medium = 0
|
||||
confidenceStats.low = 0
|
||||
confidenceStats.total = 0
|
||||
}
|
||||
} catch (err: any) {
|
||||
ElMessage.error('加载失败')
|
||||
@@ -288,7 +288,9 @@ async function deleteItem(row: any) {
|
||||
await api.delete(`/memory/${row.barcode}`)
|
||||
ElMessage.success('已删除')
|
||||
loadData()
|
||||
} catch {}
|
||||
} catch (err: any) {
|
||||
if (err !== 'cancel') ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function reimport() {
|
||||
|
||||
Reference in New Issue
Block a user