Compare commits

...

1 Commits

2 changed files with 9 additions and 8 deletions

View File

@@ -377,6 +377,9 @@ def bootstrap():
"monthly_revenue": revenue_month,
"monthly_net_profit": revenue_month - cost_month,
"upcoming_products": len([x for x in products if x["status"] in ["规划中", "设计中", "开发中", "测试中"]]),
"total_projects": len(operations),
"total_proposals": len(proposals),
"total_products": len(products),
# Extended finance metrics
"signed_amount": signed_amount,
"signed_annual": signed_annual,

View File

@@ -115,16 +115,14 @@ function renderHome() {
const tblCard = (title, rows) => card(`<h3 class="text-sm font-bold text-slate-700 mb-3">${title}</h3><table class="w-full text-sm"><tbody>${rows.map(([label, value]) => `<tr class="border-b border-slate-100 last:border-0"><td class="py-2 pr-4 text-slate-500">${label}</td><td class="py-2 text-right font-semibold text-slate-800">${value}</td></tr>`).join("")}</tbody></table>`, "p-4");
document.querySelector("#home").innerHTML = `
<div class="grid gap-5">
<div class="grid grid-cols-4 gap-3">
<div class="grid grid-cols-6 gap-3">
${[
["P0 客户数", m.p0_customers, "projects"],
["跟进中销售机会", m.active_sales, "projects"],
["已签约执行项目", m.execution_projects, "projects"],
["有风险项目", m.risk_projects, "projects"],
["本月收入", money(m.monthly_revenue), "finance"],
["重点项目", m.total_projects, "projects"],
["业务方案", m.total_proposals, "proposals"],
["产品版本", m.total_products, "products"],
["本月确收", money(m.monthly_revenue), "finance"],
["本月毛利", money(m.monthly_gross || m.monthly_net_profit), "finance"],
["本月净利", money(m.monthly_net_profit), "finance"],
["即将上线版本", m.upcoming_products, "products"],
["已签约未执行", money(m.signed_not_executed), "finance"],
].map(([label, value, tab]) => `<button class="metric-card" onclick="switchTab('${tab}')"><span class="flex items-center gap-2 text-xs text-slate-500"><i data-lucide="gauge"></i>${label}</span><strong class="mt-2 block text-2xl">${value}</strong></button>`).join("")}
</div>
<div class="grid grid-cols-3 gap-5">${tblCard("合同金额", rows1)}${tblCard("确收金额", rows2)}${tblCard("确收毛利", rows3)}</div>