CASHV 增加付款批次银行回单附件

这个提交包含在:
2026-05-17 09:35:37 +08:00
父节点 94d2cc8bf9
当前提交 ab80d481cb
共修改 11 个文件,包含 891 行新增和 16 行删除
+53 -1
查看文件
@@ -1,4 +1,4 @@
import { apiRequestData } from "./http";
import { apiRequestBlob, apiRequestData, type ApiBlobResponse } from "./http";
import type { RiskFlag } from "./feeControl";
export type PaymentBatchEntityType = "reimbursement" | "travel_order";
@@ -58,6 +58,20 @@ export type PaymentBatch = {
items: PaymentBatchItem[];
};
export type PaymentBatchReceiptAttachment = {
id: string;
originalName: string;
mimeType: string;
fileSize: number;
fileSha256: string;
uploadedBy: {
id: string;
employeeNo: string;
name: string;
} | null;
createdAt: string | null;
};
export type PaymentBatchListResponse = { items: PaymentBatch[] };
export async function fetchPaymentBatches(query: { entityType?: PaymentBatchEntityType; status?: PaymentBatchStatus } = {}) {
@@ -120,3 +134,41 @@ export async function cancelPaymentBatch(batchId: string) {
body: JSON.stringify({}),
});
}
export async function fetchPaymentBatchReceiptAttachments(batchId: string) {
return apiRequestData<{ items: PaymentBatchReceiptAttachment[] }>(
`/api/payment-batches/${batchId}/receipt-attachments`,
);
}
export async function uploadPaymentBatchReceiptAttachments(batchId: string, files: File[]) {
const formData = new FormData();
for (const file of files) {
formData.append("files", file);
}
return apiRequestData<{ items: PaymentBatchReceiptAttachment[] }>(
`/api/payment-batches/${batchId}/receipt-attachments`,
{
method: "POST",
body: formData,
},
);
}
export function paymentBatchReceiptAttachmentFileUrl(batchId: string, attachmentId: string) {
return `/api/payment-batches/${batchId}/receipt-attachments/${attachmentId}/file`;
}
export async function downloadPaymentBatchReceiptAttachment(
batchId: string,
attachmentId: string,
): Promise<ApiBlobResponse> {
return apiRequestBlob(paymentBatchReceiptAttachmentFileUrl(batchId, attachmentId));
}
export async function deletePaymentBatchReceiptAttachment(batchId: string, attachmentId: string) {
return apiRequestData<{ attachmentId: string; outcome: "deleted" }>(
`/api/payment-batches/${batchId}/receipt-attachments/${attachmentId}`,
{ method: "DELETE" },
);
}