feat: 首页重构 — 财务概览转置+部门经营卡片+命名统一

首页:
- 5卡片→表格(行=指标,列=时间),新增已付/现金流/项目利润行,费用行
- 行列对换:8列(年度/季度/季环比/本月/月环比/上季度/上月)×9行
- 新增「部门经营情况」卡片(部门利润/费用/净利)
- 趋势图3→4列,新增月度项目利润折线图(indigo)
- 命名:利润→项目利润,费用→项目费用,月度利润→月度项目利润
- 卡片改名:经营管理→项目管理,财务概览→业务(项目)财务概览
- 指标列统一颜色,去掉行编号

项目模块:
- 利润→项目利润,费用→项目费用,总费用→总项目费用
- 月度回款与费用→月度回款与已付,柱状图→折线图

后端:
- 新增paid/cashflow/profit指标聚合(单/多租户)
- monthly_finance新增paid字段
- helpers.py修复重复return data
This commit is contained in:
mac
2026-07-06 19:10:14 +08:00
parent 340f8bd88c
commit 56feeb0cfe
5 changed files with 155 additions and 53 deletions

View File

@@ -80,13 +80,14 @@ def monthly_finance(conn, tenant="科普·无界"):
"gross": float(b.get("gross") or 0),
"payment": float(b.get("payment") or 0),
"cost": float(b.get("cost") or 0),
"paid": float(b.get("paid") or 0),
}
parsed_budgets.append((pf, budget_map))
data = []
for month in months:
key = month.replace("-", "_")
revenue = gross = payment = cost = sign = 0
revenue = gross = payment = cost = paid = sign = 0
for pf, budget_map in parsed_budgets:
if pf["status"] == "已签约" and (pf.get("sign_month") or "") == month:
sign += float(pf["sign_amount"] or 0)
@@ -96,10 +97,14 @@ def monthly_finance(conn, tenant="科普·无界"):
gross += b["gross"]
payment += b["payment"]
cost += b["cost"]
paid += b["paid"]
data.append({
"month": month, "revenue": revenue,
"labor": 0, "expense": 0, "purchase": 0,
"gross": gross,
"sign": sign, "payment": payment, "cost": cost,
"month": month,
"revenue": round(revenue, 2),
"gross": round(gross, 2),
"payment": round(payment, 2),
"cost": round(cost, 2),
"paid": round(paid, 2),
"sign": round(sign, 2),
})
return data