feat: 费用模块重构 + 项目模块优化 + 数据库迁移

费用模块:
- 字段精简为5个:费用类型(下拉6选)、月份(3年36月下拉)、金额、已发生金额、费用说明(textarea)
- 三视图切换(总/季度/月度),按expense_month筛选,汇总卡片实时更新
- 类型筛选功能,Toolbar+汇总+表格三段式布局
- 删除按钮移至关闭按钮左侧,间距8px
- 费用记录删除合计行,列宽固定200px,居中

项目模块:
- 卡片网格6→7列(14卡片7×2满排),配置驱动 METRIC_CARDS
- 新增费用/利润字段,利润=毛利-费用
- 表格行添加费用、利润列,比率列text-xs→text-sm
- 项目流水tab费用与已付列对调,汇总卡片6→1×6
- 修复月度/季度切换时汇总卡片不更新
- 筛选区统一为卡片,去除'筛选:'前缀

数据库:
- expense_records新增expense_type/expense_month/incurred_amount列
- migrations/columns.py幂等迁移,启动时自动执行
This commit is contained in:
mac
2026-07-06 17:31:34 +08:00
parent 8a78c756b7
commit 7ab0c71b54
6 changed files with 189 additions and 90 deletions

View File

@@ -24,7 +24,7 @@ TABLES = {
"finance": ("finance_records", ["month", "project_name", "record_type", "category", "amount", "occurred_date", "notes", "tenant"]),
"tasks": ("project_tasks", ["project_id", "phase", "milestone", "task", "owner", "due_date", "blockers", "notes", "status", "sort_order", "priority", "tenant"]),
"projectFinances": ("project_finances", ["project_id", "tenant", "business_type", "customer_name", "sign_amount", "sign_month", "status", "sales_person", "owner", "total_rev", "total_gross", "total_payment", "total_cost", "total_paid", "budget_data", "start_date", "end_date", "task_type", "task_count", "service_fee_standard", "project_manager", "task_data", "project_code", "contact_name", "contact_phone", "other_info"]),
"expense": ("expense_records", ["project_name", "purchase_item", "supplier", "amount", "purchase_date", "status", "category", "notes", "tenant"]),
"expense": ("expense_records", ["expense_type", "expense_month", "amount", "incurred_amount", "notes", "tenant"]),
}
# ---------- 鉴权装饰器 ----------