fix: 计划费用保存卡顿+月度总览增加回款现金流行

- plan_expense.js: savePlanExpense/deletePlanExpItem改用api()+load()
- 去掉多余的applyUserTenants和手动fetch bootstrap
- plan.js月度总览增加回款和项目现金流两行
- 版本号 v1.0.0.33
This commit is contained in:
mac
2026-07-08 17:45:48 +08:00
parent cfd5137edc
commit 1e82ca73d9
3 changed files with 30 additions and 28 deletions

View File

@@ -1010,26 +1010,29 @@ function renderPlanOverview() {
annualSums.payment += fm[i].payment; annualSums.paid += fm[i].paid;
}
const mLbl = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'];
const LABELS = ['合同金额','确收金额','确收毛利','成本','已付'];
const LABELS = ['合同金额','确收金额','确收毛利','成本','已付','回款','项目现金流'];
// 每行的年度累计 + 12个月值
const annualVals = [
annualSums.sign, annualSums.revenue, annualSums.gross, annualSums.cost, annualSums.paid,
annualSums.payment, annualSums.payment - annualSums.paid,
];
// 字段映射: sign, revenue, gross, cost, profit(=gross-cost), payment, paid, cashflow(=payment-paid)
const fmFields = ['sign','revenue','gross','cost','paid'];
// 字段映射: sign, revenue, gross, cost, paid, payment, cashflow(=payment-paid)
const fmFields = ['sign','revenue','gross','cost','paid','payment',null];
var thead = '<tr class="border-b border-slate-200"><th class="py-2 text-left text-slate-500 whitespace-nowrap">指标</th><th class="py-2 text-right font-semibold text-slate-700 whitespace-nowrap">年度累计</th>';
for (var mi = 0; mi < 12; mi++) { thead += '<th class="py-2 text-right font-semibold text-slate-600 whitespace-nowrap">' + mLbl[mi] + '</th>'; }
thead += '</tr>';
var tbody = '';
for (var ri = 0; ri < 5; ri++) {
for (var ri = 0; ri < 7; ri++) {
var rowHtml = '<tr class="border-b border-slate-100 last:border-0"><td class="py-2 text-left font-semibold text-slate-700 whitespace-nowrap">' + LABELS[ri] + '</td>';
rowHtml += '<td class="py-2 text-right font-semibold text-slate-800 whitespace-nowrap">' + moneyIntL(annualVals[ri]) + '</td>';
for (var mi = 0; mi < 12; mi++) {
var val = 0;
if (fm[mi]) {
var fk = fmFields[ri]; if (fk) val = fm[mi][fk] || 0;
if (ri === 6) { val = (fm[mi].payment || 0) - (fm[mi].paid || 0); }
else { var fk = fmFields[ri]; if (fk) val = fm[mi][fk] || 0; }
}
var cls = 'text-slate-700';
if (ri === 6) cls = val >= 0 ? 'text-green-600' : 'text-red-600';
rowHtml += '<td class="py-2 text-right text-sm whitespace-nowrap ' + cls + '">' + moneyIntL(val) + '</td>';
}
tbody += rowHtml + '</tr>';