Move category filtering to frontend with checkable toggles

This commit is contained in:
2026-05-06 22:02:42 +08:00
parent ef7fef2254
commit 965ef2058d
2 changed files with 247 additions and 238 deletions
+7 -5
View File
@@ -38,8 +38,9 @@ router.get("/overview", (req, res) => {
// 按分类统计支出(用于饼图)
const catWhere = where
? where + " AND d.direction = 'expense' AND d.category IS NOT NULL AND d.category NOT IN ('投资理财','转账红包')"
: "WHERE d.direction = 'expense' AND d.category IS NOT NULL AND d.category NOT IN ('投资理财','转账红包')";
? where +
" AND d.direction = 'expense' AND d.category IS NOT NULL"
: "WHERE d.direction = 'expense' AND d.category IS NOT NULL";
const categoryStats = db
.prepare(
@@ -57,10 +58,11 @@ router.get("/overview", (req, res) => {
)
.all(...params);
// 按分类汇总(收入+支出),排除投资理财、转账红包
// 按分类汇总(收入+支出)
const catBreakWhere = where
? where + " AND d.category IS NOT NULL AND d.category NOT IN ('投资理财','转账红包')"
: "WHERE d.category IS NOT NULL AND d.category NOT IN ('投资理财','转账红包')";
? where +
" AND d.category IS NOT NULL"
: "WHERE d.category IS NOT NULL";
const categoryBreakdown = db
.prepare(