收口报销详情返回与金额展示(07-27-yang-jun-reimbursement-readiness)
这个提交包含在:
@@ -33,6 +33,20 @@ export function formatDisplayDateTime(value: string | null | undefined) {
|
||||
}).format(timestamp);
|
||||
}
|
||||
|
||||
export function formatMoney(value: string | number | null | undefined) {
|
||||
if (value == null || value === "") return "-";
|
||||
|
||||
const amount = typeof value === "number" ? value : Number(value);
|
||||
if (!Number.isFinite(amount)) return "-";
|
||||
|
||||
return new Intl.NumberFormat("zh-CN", {
|
||||
style: "currency",
|
||||
currency: "CNY",
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
}).format(amount);
|
||||
}
|
||||
|
||||
export function formatCompactIdentifier(
|
||||
value: string | number | null | undefined,
|
||||
options: { head?: number; tail?: number; minLength?: number } = {},
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
export type PcDetailNavigationState = {
|
||||
from?: string;
|
||||
};
|
||||
|
||||
export function buildPcDetailSource(pathname: string, search: string) {
|
||||
return `${pathname}${search}`;
|
||||
}
|
||||
|
||||
export function resolvePcDetailSource(value: unknown, currentPath: string) {
|
||||
if (typeof value !== "string" || !value.startsWith("/") || value.startsWith("//") || value.includes("#")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const url = new URL(value, "https://hyb-oa.invalid");
|
||||
const isReimbursementList = url.pathname === "/reimbursements";
|
||||
const isWorkflowTask = /^\/workflow\/tasks\/[^/]+$/.test(url.pathname);
|
||||
if (!isReimbursementList && !isWorkflowTask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const source = `${url.pathname}${url.search}`;
|
||||
return source === currentPath ? null : source;
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户