fix: 修复 transaction 表名与 Dexie 内置方法冲突(导出 JSON 与记账失效)

This commit is contained in:
root
2026-10-16 13:19:54 +08:00
parent f0d30e2c29
commit 5a67b2f59a
10 changed files with 57 additions and 42 deletions
+20 -10
View File
@@ -43,7 +43,11 @@ const title = computed(() => Number(monthRef.value.slice(0, 4)) + ' 年 ' + Numb
async function load() {
loading.value = true
rows.value = await listTransactionsBetween(monthStart.value, monthEnd.value)
try {
rows.value = await listTransactionsBetween(monthStart.value, monthEnd.value)
} catch (e) {
showToast('账目加载失败:' + (e instanceof Error ? e.message : String(e)))
}
loading.value = false
}
onMounted(load)
@@ -124,15 +128,21 @@ async function submit() {
}
if (submitting.value) return
submitting.value = true
await addTransaction({
type: fType.value,
category: fCategory.value,
amount: Math.round(v * 100),
date: fDate.value,
note: fNote.value.trim(),
reimbursable: fType.value === 'expense' && fReimb.value ? 1 : 0,
reimbursed: 0
})
try {
await addTransaction({
type: fType.value,
category: fCategory.value,
amount: Math.round(v * 100),
date: fDate.value,
note: fNote.value.trim(),
reimbursable: fType.value === 'expense' && fReimb.value ? 1 : 0,
reimbursed: 0
})
} catch (e) {
showToast('添加失败:' + (e instanceof Error ? e.message : String(e)))
submitting.value = false
return
}
fAmount.value = ''
fNote.value = ''
fReimb.value = false