OAFRONT6 压缩长编号展示并修正视觉探针

这个提交包含在:
2026-05-25 19:58:23 +08:00
父节点 15db07a799
当前提交 971d5311e3
共修改 12 个文件,包含 249 行新增和 36 行删除
+32
查看文件
@@ -30,3 +30,35 @@ export function formatDisplayDateTime(value: string | null | undefined) {
minute: "2-digit",
}).format(timestamp);
}
export function formatCompactIdentifier(
value: string | number | null | undefined,
options: { head?: number; tail?: number; minLength?: number } = {},
) {
const text = String(value ?? "").trim();
if (!text) return "-";
const head = options.head ?? 10;
const tail = options.tail ?? 4;
const minLength = options.minLength ?? 18;
if (text.length <= minLength || text.length <= head + tail + 1) {
return text;
}
return `${text.slice(0, head)}…${text.slice(-tail)}`;
}
export function isCompactedIdentifier(value: string | number | null | undefined, displayValue: string) {
const text = String(value ?? "").trim();
return Boolean(text) && text !== displayValue;
}
export function formatTextWithCompactLongNumbers(value: string | number | null | undefined) {
const text = String(value ?? "").trim();
if (!text) return "-";
return text.replace(/\b20[0-9]{12,}\b/g, (match) =>
formatCompactIdentifier(match, { head: 10, tail: 4, minLength: 14 }),
);
}