From b49892e86d4eed9cee644111c77e0cbb9cbe2e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=BB=E5=B7=A5?= Date: Fri, 28 Aug 2026 11:47:27 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=86=E5=88=86=20formatWan=20?= =?UTF-8?q?=E5=90=8C=E5=90=8D=E5=87=BD=E6=95=B0=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=80=BB=E8=A7=88=E9=87=91=E9=A2=9D=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HEL-177 公司端 HTML 版 formatWan 覆盖了 HEL-155 管理端纯数字版, 导致 textContent 赋值处显示原始 span 标签。将公司端重命名为 formatWanHtml 并替换调用,管理端三处恢复纯文本万元显示。 Co-authored-by: Cursor Co-authored-by: multica-agent --- web/app.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/web/app.js b/web/app.js index 39c4036..64ee979 100644 --- a/web/app.js +++ b/web/app.js @@ -3395,7 +3395,7 @@ function yuanToWan(value) { return n / 10000; } -function formatWan(value, { signed = false } = {}) { +function formatWanHtml(value, { signed = false } = {}) { const wan = yuanToWan(value); if (wan === null) return "—"; const abs = Math.abs(wan).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 }); @@ -3472,13 +3472,13 @@ function renderWorkspaceTransfersCard(summary) { const net = $("#wsTfNet"); const pendingEl = $("#wsTfPending"); const netLabel = $("#wsTfNetLabel"); - if (inflow) inflow.innerHTML = formatWan(confirmed.inflow_total, { signed: true }); + if (inflow) inflow.innerHTML = formatWanHtml(confirmed.inflow_total, { signed: true }); if (outflow) { - outflow.innerHTML = formatWan( + outflow.innerHTML = formatWanHtml( confirmed.outflow_total != null ? -Math.abs(Number(confirmed.outflow_total)) : null, { signed: true }, ); - // formatWan with negative value already adds −; ensure unit + // formatWanHtml with negative value already adds −; ensure unit if (confirmed.outflow_total != null) { const wan = yuanToWan(confirmed.outflow_total); const abs = Math.abs(wan).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 }); @@ -3488,12 +3488,12 @@ function renderWorkspaceTransfersCard(summary) { if (netLabel) netLabel.textContent = `${netLabelForWindow(win)}${netMeta.label !== "持平" ? ` · ${netMeta.label}` : ""}`; if (net) { net.className = `ms-value ${netMeta.signedClass}`.trim(); - net.innerHTML = formatWan(confirmed.net_change, { signed: true }); + net.innerHTML = formatWanHtml(confirmed.net_change, { signed: true }); } if (pendingEl) { const pCount = Number(pending.count) || 0; pendingEl.innerHTML = pCount - ? `${formatWan(pending.amount_total)} · ${pCount} 笔` + ? `${formatWanHtml(pending.amount_total)} · ${pCount} 笔` : `0.00万元 · 0 笔`; } } @@ -3564,7 +3564,7 @@ function renderTransfersOverview(summary) { const netFoot = $("#tfStatNetFoot"); const netMeta = netDirectionMeta(confirmed.net_change, confirmed.net_direction); if (companies) companies.innerHTML = `${cps.length}`; - if (inflow) inflow.innerHTML = formatWan(confirmed.inflow_total, { signed: true }); + if (inflow) inflow.innerHTML = formatWanHtml(confirmed.inflow_total, { signed: true }); if (outflow) { const wan = yuanToWan(confirmed.outflow_total); const abs = wan === null ? "—" : Math.abs(wan).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 }); @@ -3575,7 +3575,7 @@ function renderTransfersOverview(summary) { const tag = netMeta.label !== "持平" ? ` ${netMeta.label}` : ""; - net.innerHTML = `${formatWan(confirmed.net_change, { signed: true })}${tag}`; + net.innerHTML = `${formatWanHtml(confirmed.net_change, { signed: true })}${tag}`; } if (netFoot) { netFoot.textContent = win.has_opening @@ -3589,7 +3589,7 @@ function renderTransfersOverview(summary) { const tfPendingCount = $("#tfPendingCount"); const tfPendingAmount = $("#tfPendingAmount"); if (tfConfirmedCount) tfConfirmedCount.textContent = `${confirmedCount} 笔`; - if (tfConfirmedNet) tfConfirmedNet.innerHTML = formatWan(confirmed.net_change, { signed: true }); + if (tfConfirmedNet) tfConfirmedNet.innerHTML = formatWanHtml(confirmed.net_change, { signed: true }); const openingCard = $("#tfStatOpeningCard"); const endingCard = $("#tfStatEndingCard"); const openingEl = $("#tfStatOpening"); @@ -3597,15 +3597,15 @@ function renderTransfersOverview(summary) { if (win.has_opening) { if (openingCard) openingCard.hidden = false; if (endingCard) endingCard.hidden = false; - if (openingEl) openingEl.innerHTML = formatWan(win.opening, { signed: true }); - if (endingEl) endingEl.innerHTML = formatWan(win.ending, { signed: true }); + if (openingEl) openingEl.innerHTML = formatWanHtml(win.opening, { signed: true }); + if (endingEl) endingEl.innerHTML = formatWanHtml(win.ending, { signed: true }); } else { if (openingCard) openingCard.hidden = true; if (endingCard) endingCard.hidden = true; } if (tfPendingCount) tfPendingCount.textContent = `${pCount} 笔`; - if (tfPendingAmount) tfPendingAmount.innerHTML = formatWan(pending.amount_total || 0); + if (tfPendingAmount) tfPendingAmount.innerHTML = formatWanHtml(pending.amount_total || 0); const tbody = $("#transfersCpBody"); const tfoot = $("#transfersCpFoot"); @@ -3706,7 +3706,7 @@ async function openTransfersDetail(companyId, companyName, { keepFilters = false $("#tfDetailCount").innerHTML = `—`; $("#tfDetailCountFoot").textContent = pendingN ? `其中待确认 ${pendingN} 笔(汇总)` : "按筛选加载明细"; if (cp) { - $("#tfDetailIn").innerHTML = formatWan(cp.confirmed_inflow, { signed: true }); + $("#tfDetailIn").innerHTML = formatWanHtml(cp.confirmed_inflow, { signed: true }); const wan = yuanToWan(cp.confirmed_outflow); $("#tfDetailOut").innerHTML = wan === null ? "—"