OAFRONT6 压缩长编号展示并修正视觉探针
这个提交包含在:
@@ -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 }),
|
||||
);
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户