import { reimbursementAmountIntegrityMessage, type ReimbursementAmountSummary } from "./reimbursementWorkspace"; export function resolveReimbursementApprovalBlockReason({ amountIntegrity, detailState, online, snapshotParseStatus, }: { amountIntegrity: ReimbursementAmountSummary["integrity"] | null; detailState: "ready" | "loading" | "error"; online: boolean; snapshotParseStatus: string | null | undefined; }) { if (!online) return "报销审批需联网核对完整报销内容;当前不能通过、退回、驳回或转审。"; if (amountIntegrity && amountIntegrity !== "ready") { return reimbursementAmountIntegrityMessage(amountIntegrity); } if (snapshotParseStatus === "invalid") { return "提交时检查记录无法解析,暂时不能审批;请联系系统管理员核对。"; } if (detailState === "error") return "报销内容未加载完整,暂不能审批,请刷新后重试"; if (detailState === "loading") return "正在加载完整报销内容和票据;加载完成前不能作出审批决定。"; if (snapshotParseStatus !== "ready") { return "提交时检查记录无法解析,暂时不能审批;请联系系统管理员核对。"; } return null; }