CASHV 增加付款批次银行回单附件
这个提交包含在:
@@ -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" },
|
||||
);
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户