B-44: 返修——375px 超大金额降级与审核弹窗必展字段

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
腾讯WorkBuddy
2026-08-20 01:54:32 +08:00
co-authored by Cursor
parent 1fe073066e
commit 95ad9c939a
4 changed files with 146 additions and 26 deletions
+72 -15
View File
@@ -522,11 +522,57 @@ function eventIsNegative(event) {
return event.posting_kind === "reversal" || Boolean(event.is_repayment);
}
function isCompactAmount(value) {
const num = Number(value);
if (!Number.isFinite(num)) return false;
return String(Math.trunc(Math.abs(num))).length >= 10;
}
function amountWithCurrency(value, currency, { signed = false, negative = false } = {}) {
const abs = fmtAbsMoney(value);
const sign = (signed && (negative || Number(value) < 0)) ? "" : "";
const code = currency ? `<span class="currency-code">${esc(currency)}</span>` : "";
return `<span class="amount-with-currency">${code}${sign}${abs}</span>`;
const compact = isCompactAmount(value) ? " is-compact" : "";
return `<span class="amount-with-currency${compact}">${code}${sign}${abs}</span>`;
}
function cashDirectionLabel(direction) {
if (direction === "outgoing") return "转出";
if (direction === "incoming") return "转入";
return "—";
}
function relatedFlowLabel(relatedId) {
if (relatedId === null || relatedId === undefined || String(relatedId).trim() === "") {
return "无关联流水";
}
return String(relatedId);
}
function auditEvidenceFields(kind, data = {}) {
const amountText = data.amount
? `${fmtAbsMoney(data.amount)}${data.currency ? ` ${data.currency}` : ""}`.trim()
: "—";
if (kind === "subject-review") {
return [
["方向", cashDirectionLabel(data.direction || "outgoing")],
["日期", data.effectiveAt ? fmtDate(data.effectiveAt) : "—"],
["金额", amountText],
["摘要", data.summary || "—"],
];
}
if (kind === "manual-review") {
return [
["对方公司名", data.counterpartyName || "—"],
["方向", cashDirectionLabel(data.direction)],
["关联流水号", relatedFlowLabel(data.relatedSourceRowId)],
["提交人", data.submittedBy || "—"],
["附件", data.attachmentName || "无"],
["摘要", data.summary || "—"],
["金额", amountText],
];
}
return [];
}
function accountCell(chip) {
@@ -1114,6 +1160,7 @@ function appendSubjectReviewRow(item) {
row.dataset.amount = String(item.amount || "");
row.dataset.currency = item.currency || "";
row.dataset.effectiveAt = item.effective_at || "";
row.dataset.direction = "outgoing";
row.innerHTML = `
<td><span class="task-level warning">中</span></td>
<td><strong>${esc(item.payer_company_name)}${esc(item.payee_company_name)}</strong><small>规则建议:${esc(suggestions)}</small></td>
@@ -1140,6 +1187,9 @@ function appendManualRecordReviewRow(record) {
row.dataset.summary = record.summary || "";
row.dataset.amount = String(record.amount || "");
row.dataset.currency = record.currency || "";
row.dataset.direction = record.direction || "";
row.dataset.counterpartyName = record.counterparty_company_name || "";
row.dataset.relatedSourceRowId = record.related_source_row_id == null ? "" : String(record.related_source_row_id);
row.innerHTML = `
<td><span class="task-level warning">中</span></td>
<td><strong>${esc(record.company_name)} · MR-${record.id}</strong><small>${esc(record.direction === "outgoing" ? "付款" : "收款")} ${fmtMoney(record.amount)} ${esc(record.currency)} · ${esc(record.counterparty_company_name)} · ${esc(b44.subjectLabels[record.requested_subject] || "")}</small></td>
@@ -1151,19 +1201,27 @@ function appendManualRecordReviewRow(record) {
tbody.append(row);
}
function appendEvidenceGrid(parent, fields) {
const grid = document.createElement("div");
grid.className = "evidence-grid";
fields.forEach(([label, value]) => {
const wrap = document.createElement("div");
const dt = document.createElement("dt");
dt.textContent = label;
const dd = document.createElement("dd");
dd.textContent = value;
wrap.append(dt, dd);
grid.append(wrap);
});
parent.append(grid);
}
function fillAuditEvidence(evidence, row, cells) {
const heading = document.createElement("strong");
heading.textContent = cells[1].querySelector("strong")?.textContent || "";
evidence.append(heading);
if (row.dataset.recordKind === "subject-review") {
const meta = document.createElement("small");
meta.textContent = `${fmtDate(row.dataset.effectiveAt)} · ${fmtAbsMoney(row.dataset.amount)} ${row.dataset.currency || ""}`.trim();
evidence.append(meta);
if (row.dataset.summary) {
const summary = document.createElement("small");
summary.textContent = `摘要:${row.dataset.summary}`;
evidence.append(summary);
}
appendEvidenceGrid(evidence, auditEvidenceFields("subject-review", row.dataset));
const suggestions = JSON.parse(row.dataset.suggestions || "[]");
const list = document.createElement("ul");
list.className = "candidate-list";
@@ -1182,12 +1240,7 @@ function fillAuditEvidence(evidence, row, cells) {
return;
}
if (row.dataset.recordKind === "manual-review") {
const meta = document.createElement("small");
meta.textContent = `提交人 ${row.dataset.submittedBy || "—"} · 附件 ${row.dataset.attachmentName || "无"}`;
evidence.append(meta);
const summary = document.createElement("small");
summary.textContent = `摘要:${row.dataset.summary || "—"} · ${fmtAbsMoney(row.dataset.amount)} ${row.dataset.currency || ""}`.trim();
evidence.append(summary);
appendEvidenceGrid(evidence, auditEvidenceFields("manual-review", row.dataset));
const reason = document.createElement("p");
reason.className = "reason-full";
reason.textContent = row.dataset.reasonText || cells[1].querySelector("small")?.textContent || "";
@@ -2654,7 +2707,11 @@ if (typeof module !== "undefined" && module.exports) {
cycleTab,
drawerEscAction,
amountWithCurrency,
isCompactAmount,
resultDirection,
accountCell,
cashDirectionLabel,
relatedFlowLabel,
auditEvidenceFields,
};
}