fix: 拆分 formatWan 同名函数,修复管理总览金额标签泄漏
HEL-177 公司端 HTML 版 formatWan 覆盖了 HEL-155 管理端纯数字版, 导致 textContent 赋值处显示原始 span 标签。将公司端重命名为 formatWanHtml 并替换调用,管理端三处恢复纯文本万元显示。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
fe6b4e59ec
commit
b49892e86d
+13
-13
@@ -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)}<span class="unit"> · ${pCount} 笔</span>`
|
||||
? `${formatWanHtml(pending.amount_total)}<span class="unit"> · ${pCount} 笔</span>`
|
||||
: `0.00<span class="unit">万元 · 0 笔</span>`;
|
||||
}
|
||||
}
|
||||
@@ -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}<span class="unit">家</span>`;
|
||||
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 !== "持平"
|
||||
? ` <span class="xfer-dir-tag ${netMeta.className}">${netMeta.label}</span>`
|
||||
: "";
|
||||
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
|
||||
? "—"
|
||||
|
||||
Reference in New Issue
Block a user