feat: 计划模块 + 待签约迁移 + 表格排序 + 已签约→项目

- 新增计划模块(plan_finances/plan_expense_records, 侧边栏计划tab)
- 待签约项目自动迁移到计划模块(data_fixes 幂等)
- 已签约tab改名为项目(业务+计划两个模块)
- 业务模块表格点击列头排序(月度/季度/总视图)
- 计划与业务侧边栏位置对调
- plan模块CSS修复(使用finance-tab类)
- 版本号 v1.0.0.17
This commit is contained in:
mac
2026-07-08 12:13:06 +08:00
parent e233c294b0
commit d2ea5d0d5d
9 changed files with 1442 additions and 44 deletions

View File

@@ -112,3 +112,31 @@ def migrate_fix_expense_status():
print(f"[migrate] expense_records: {affected} 条记录 status 修正为 '计入费用'")
finally:
conn.close()
def migrate_move_pending_to_plan():
"""迁移业务待签约项目到计划模块(幂等)"""
from db import db
conn = db()
try:
cur = conn.cursor()
# 仅迁移 id 不存在于计划表的待签约项目
cur.execute(
"INSERT INTO plan_finances "
"SELECT * FROM project_finances WHERE status='待签约' "
"AND id NOT IN (SELECT id FROM plan_finances)"
)
moved = cur.rowcount
if moved:
# 删除已迁移的原记录
cur.execute(
"DELETE FROM project_finances WHERE status='待签约' "
"AND id IN (SELECT id FROM plan_finances)"
)
deleted = cur.rowcount
conn.commit()
print(f"[migrate] 待签约项目迁移到计划: {moved} 条 (已删除 {deleted} 条)")
cur.close()
finally:
conn.close()