feat: 新增记账系统(收支记录、报销跟踪、月度汇总)

This commit is contained in:
root
2026-10-16 10:40:25 +08:00
parent 337b005d52
commit 838753a058
8 changed files with 672 additions and 9 deletions
+20 -1
View File
@@ -66,6 +66,18 @@ export interface Credential {
updated_at: string
}
export interface Transaction {
id?: number
type: string // income | expense
category: string
amount: number // 单位:分
date: string // YYYY-MM-DD
note: string
reimbursable: number // 支出是否需要报销
reimbursed: number // 是否已报销
created_at: string
}
export class WorklogDB extends Dexie {
project!: Table<Project, number>
work_log!: Table<WorkLog, number>
@@ -75,6 +87,7 @@ export class WorklogDB extends Dexie {
setting!: Table<{ key: string; value: string }, string>
memo!: Table<Memo, number>
credential!: Table<Credential, number>
transaction!: Table<Transaction, number>
constructor(dbName = 'intern_worklog') {
super(dbName)
@@ -90,6 +103,9 @@ export class WorklogDB extends Dexie {
memo: '++id, updated_at',
credential: '++id, system, updated_at'
})
this.version(3).stores({
transaction: '++id, date, type, category'
})
}
}
@@ -105,7 +121,10 @@ export function unbindDatabase(): void {
db = undefined
}
export const SCHEMA_VERSION = 2
export const SCHEMA_VERSION = 3
export const EXPENSE_CATEGORIES: string[] = ['餐饮', '交通', '住房', '通讯', '学习', '娱乐', '其他']
export const INCOME_CATEGORIES: string[] = ['工资', '报销', '其他']
export const DEFAULT_LOCATIONS: string[] = ['公司', '客户现场', '出差', '居家办公']