v0.7.1 记账周期统计:按月/按期/自定义三种周期,账期起点多端同步;工具栏精简(回到本期条件显示、自定义隐藏翻页箭头、清除快速记账死代码)
This commit is contained in:
@@ -634,6 +634,19 @@ export async function setTransactionReimbursed(id: number, done: boolean): Promi
|
||||
await commit()
|
||||
}
|
||||
|
||||
// 有账目的月份列表(YYYY-MM,倒序),供周期选择弹窗使用
|
||||
export async function listTransactionMonths(): Promise<string[]> {
|
||||
const all = await db.table('transaction').toArray()
|
||||
const set = new Set<string>()
|
||||
for (const r of all) if (r && r.date) set.add(r.date.slice(0, 7))
|
||||
return Array.from(set).sort((a, b) => (a < b ? 1 : -1))
|
||||
}
|
||||
|
||||
// 某日期之前的账目条数(判断「起点前」是否有数据)
|
||||
export async function countTransactionsBefore(date: string): Promise<number> {
|
||||
return db.table('transaction').where('date').below(date).count()
|
||||
}
|
||||
|
||||
// ---------- 备份 ----------
|
||||
|
||||
export async function exportAll(): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user