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,
};
}
+22 -10
View File
@@ -220,7 +220,7 @@ main { width: min(1560px, 100%); margin: 0 auto; padding: 12px 32px 58px; }
.company-row.is-warning .company-row-mark { background: var(--color-warning-wash); color: var(--color-warning); }
.company-row.is-danger .company-row-mark { background: var(--color-danger-wash); color: var(--color-danger); }
.company-row-body { display: flex; flex-direction: column; min-width: 0; }
.company-row-body strong { font-size: 14px; }
.company-row-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.company-row-body small { color: var(--color-ink-muted); font-size: 11px; }
.company-row-figure { display: flex; flex-direction: column; align-items: flex-end; text-align: right; min-width: 92px; }
.company-row-figure strong { font: 600 14px var(--font-data); color: var(--color-ink); }
@@ -261,8 +261,9 @@ main { width: min(1560px, 100%); margin: 0 auto; padding: 12px 32px 58px; }
.company-ledger summary:hover { background: rgba(255, 255, 255, 0.035); }
.company-ledger summary > svg { transition: transform var(--duration-standard) var(--ease-out); }
.company-ledger[open] summary > svg { transform: rotate(180deg); }
.company-name { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; column-gap: 10px; }
.company-name { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; column-gap: 10px; min-width: 0; }
.company-name i { width: 36px; height: 36px; grid-row: 1 / 3; display: grid; place-items: center; border-radius: 12px; background: var(--color-primary-wash); color: var(--color-primary); font-style: normal; font-weight: 800; }
.company-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.company-name small { color: var(--color-ink-muted); }
.amount { font: 600 13px var(--font-data); }
.amount.debit { color: var(--color-positive); }
@@ -744,6 +745,7 @@ body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-event
.amount-neutral { color: var(--color-ink-muted); }
.currency-code { font-size: 10px; color: var(--color-ink-muted); margin-right: 4px; }
.amount-with-currency { white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount-with-currency.is-compact { font-size: 11px; }
.account-cell { white-space: nowrap; }
.summary-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.candidate-list { margin: 8px 0 0; padding: 0; list-style: none; color: var(--color-ink-soft); font-size: 12px; }
@@ -756,12 +758,13 @@ body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-event
/* Balance directory: 公司 | 借方 | 贷方 | 期末结果 | 未决 | 截止日 | ▸ */
.ledger-head.is-balances, .company-ledger.is-balances summary {
grid-template-columns: minmax(180px, 1.3fr) minmax(100px, 0.7fr) minmax(100px, 0.7fr) minmax(150px, 0.9fr) minmax(110px, 0.7fr) minmax(96px, 0.55fr) 24px;
grid-template-columns: minmax(180px, 1.3fr) minmax(0, 0.7fr) minmax(0, 0.7fr) minmax(0, 0.9fr) minmax(0, 0.7fr) minmax(96px, 0.55fr) 24px;
}
.company-ledger.is-balances summary { min-height: 72px; }
.company-ledger.is-balances summary .company-name { min-width: 96px; }
.company-ledger.is-balances summary .ledger-cutoff { color: var(--color-ink-muted); font-size: 11px; white-space: nowrap; }
.company-ledger.is-balances .ledger-result { display: flex; align-items: center; gap: 7px; min-width: 0; }
.company-ledger.is-balances .ledger-result b { font: 600 14px var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.company-ledger.is-balances .ledger-result b { font: 600 14px var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }
.company-ledger.is-balances .ledger-unresolved { font-size: 11px; white-space: nowrap; }
.company-ledger.is-balances .ledger-unresolved.is-empty { color: var(--color-ink-muted); }
.company-ledger.is-balances .ledger-unresolved.is-active { color: var(--color-warning); }
@@ -770,25 +773,32 @@ body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-event
@media (max-width: 900px) {
.ledger-head.is-balances { display: grid; }
}
@media (max-width: 768px) {
@media (max-width: 1179px) {
.ledger-head.is-balances, .company-ledger.is-balances summary {
grid-template-columns: minmax(140px, 1.2fr) minmax(140px, 0.9fr) minmax(110px, 0.7fr) minmax(96px, 0.55fr) 24px;
grid-template-columns: minmax(120px, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.7fr) minmax(96px, 0.55fr) 24px;
}
.ledger-head.is-balances .ledger-hide-md,
.company-ledger.is-balances summary .ledger-hide-md { display: none; }
.company-ledger.is-balances summary .amount-with-currency .currency-code { display: none; }
}
@media (max-width: 375px) {
.ledger-head.is-balances { display: none; }
.company-ledger.is-balances summary {
grid-template-columns: minmax(0, 1fr) minmax(0, auto) 24px;
grid-template-columns: minmax(88px, 1fr) minmax(0, max-content) 24px;
grid-template-rows: auto auto;
align-items: center;
column-gap: 10px;
row-gap: 4px;
}
.company-ledger.is-balances summary .company-name { grid-column: 1; grid-row: 1; }
.company-ledger.is-balances summary .ledger-result { grid-column: 2; grid-row: 1; justify-self: end; }
.company-ledger.is-balances summary .ledger-unresolved { grid-column: 1; grid-row: 2; }
.company-ledger.is-balances summary .company-name { grid-column: 1; grid-row: 1; min-width: 88px; }
.company-ledger.is-balances summary .ledger-result {
grid-column: 2; grid-row: 1; justify-self: end;
flex-direction: column; align-items: flex-end; gap: 2px;
}
.company-ledger.is-balances summary .ledger-result .currency-code { display: none; }
.company-ledger.is-balances summary .ledger-unresolved {
grid-column: 1; grid-row: 2; min-width: 0; white-space: normal;
}
.company-ledger.is-balances summary .ledger-cutoff { grid-column: 2; grid-row: 2; justify-self: end; }
.company-ledger.is-balances summary > svg { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.company-ledger.is-balances summary .ledger-hide-md { display: none; }
@@ -807,6 +817,7 @@ body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-event
.pair-balance-line.is-six div:nth-child(5), .pair-balance-line.is-six div:nth-child(6) { border-top: 1px solid var(--color-line); }
}
.amount-with-currency { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-with-currency.is-compact { font-size: 11px; }
.amount-with-currency .currency-code { margin-right: 4px; color: var(--color-ink-muted); font-size: 10px; font-weight: 500; }
/* Evidence drawer: <768 full, 7681179 480px, >=1180 640px */
@@ -825,6 +836,7 @@ body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-event
.drawer .pair-balance-line { border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 16px; }
.drawer .pair-balance-line div { min-height: 64px; min-width: 0; overflow: hidden; }
.drawer .pair-balance-line strong { overflow-wrap: anywhere; }
.drawer .pair-balance-line .amount-with-currency.is-compact { white-space: normal; overflow-wrap: anywhere; }
.drawer .pair-balance-line .pair-cutoff,
.drawer .pair-balance-line strong.amount-neutral { white-space: nowrap; }
.drawer .pair-balance-line.is-six {