R111/A7-A10 统一报销双端发票附件体验

这个提交包含在:
2026-05-08 10:05:38 +08:00
父节点 0ab0740d1a
当前提交 ae054ca497
共修改 8 个文件,包含 908 行新增和 168 行删除
+46 -1
查看文件
@@ -1,4 +1,4 @@
import { apiRequestData } from "./http";
import { apiRequestBlob, apiRequestData } from "./http";
import type { ExpenseStandardCheck, PrecheckResponse, RiskFlag } from "./feeControl";
export type ReimbursementStatus =
@@ -165,6 +165,19 @@ export type ReimbursementDetail = {
originalName: string | null;
linkedItemId: string | null;
}>;
attachments: Array<{
id: string;
originalName: string;
mimeType: string;
fileSize: number;
fileSha256: string;
uploadedBy: {
id: string;
name: string;
employeeNo: string;
} | null;
createdAt: string | null;
}>;
budgetHint: ReimbursementBudgetHint | null;
pendingWorkflow: {
instanceId: string;
@@ -463,6 +476,38 @@ export async function deleteReimbursementItem(reimbursementId: string, itemId: s
);
}
export async function uploadReimbursementAttachments(reimbursementId: string, files: File[]) {
const formData = new FormData();
for (const file of files) {
formData.append("files", file);
}
return apiRequestData<{ items: ReimbursementDetail["attachments"] }>(
`/api/reimbursements/${reimbursementId}/attachments`,
{
method: "POST",
body: formData,
},
);
}
export async function deleteReimbursementAttachment(reimbursementId: string, attachmentId: string) {
return apiRequestData<{ attachmentId: string; outcome: string }>(
`/api/reimbursements/${reimbursementId}/attachments/${attachmentId}`,
{
method: "DELETE",
},
);
}
export function reimbursementAttachmentFileUrl(reimbursementId: string, attachmentId: string) {
return `/api/reimbursements/${reimbursementId}/attachments/${attachmentId}/file`;
}
export async function downloadReimbursementAttachment(reimbursementId: string, attachmentId: string) {
return apiRequestBlob(reimbursementAttachmentFileUrl(reimbursementId, attachmentId));
}
export async function linkReimbursementProject(reimbursementId: string, projectId: string | null) {
return apiRequestData<{ projectId: string | null; project: { id: string; projectNo: string; name: string } | null }>(`/api/reimbursements/${reimbursementId}/link-project`, {