import type { PageParam, PageResult } from '@vben/request';
|
|
import type { SystemStorageApi } from '#/api/system/storage';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace FinanceReimbursementApi {
|
/** 报销明细行 */
|
export interface ReimbursementItem {
|
id?: number;
|
reimbursementId?: number;
|
expenseType: number; // 费用类型,字典 finance_expense_type
|
invoiceNo?: string; // 发票号码
|
invoiceAmount: number; // 发票金额
|
invoiceDate?: string; // 发票日期 yyyy-MM-dd
|
drawer?: string; // 开票方
|
description?: string; // 费用说明
|
}
|
|
/** 报销单信息 */
|
export interface Reimbursement {
|
id?: number;
|
no?: string; // 报销单号,后端生成
|
title: string; // 报销标题
|
totalAmount: number; // 报销总金额
|
status?: number; // 状态,字典 finance_reimbursement_status
|
applicantId?: number; // 申请人 ID
|
applicantName?: string; // 申请人姓名
|
applyDate: string; // 申请日期 yyyy-MM-dd
|
processInstanceId?: string; // BPM 流程实例 ID
|
archiveTime?: string; // 归档时间
|
archiveDocumentId?: number; // 归档生成的档案 ID(非空即已生成档案)
|
archived?: boolean; // 是否已生成档案
|
remark?: string; // 备注
|
creator?: string; // 创建人 ID
|
creatorName?: string; // 创建人姓名
|
createTime?: string; // 创建时间
|
updateTime?: string; // 更新时间
|
items?: ReimbursementItem[]; // 报销明细
|
attachmentList?: SystemStorageApi.StorageBlob[]; // 发票附件
|
hasAttachment?: boolean; // 是否有发票附件
|
blobIds?: number[]; // 提交时的附件 ID 列表(全量)
|
}
|
|
/** 审批流程定义 */
|
export interface ProcessDefinition {
|
id: string;
|
key: string;
|
name: string;
|
}
|
}
|
|
/** 查询报销单分页 */
|
export function getReimbursementPage(params: PageParam) {
|
return requestClient.get<PageResult<FinanceReimbursementApi.Reimbursement>>(
|
'/finance/reimbursement/page',
|
{ params },
|
);
|
}
|
|
/** 查询报销单详情 */
|
export function getReimbursement(id: number) {
|
return requestClient.get<FinanceReimbursementApi.Reimbursement>(
|
`/finance/reimbursement/get?id=${id}`,
|
);
|
}
|
|
/** 新增报销单 */
|
export function createReimbursement(
|
data: FinanceReimbursementApi.Reimbursement,
|
) {
|
return requestClient.post('/finance/reimbursement/create', data);
|
}
|
|
/** 修改报销单(仅草稿、已驳回可改) */
|
export function updateReimbursement(
|
data: FinanceReimbursementApi.Reimbursement,
|
) {
|
return requestClient.put('/finance/reimbursement/update', data);
|
}
|
|
/** 删除报销单(仅草稿可删) */
|
export function deleteReimbursement(id: number) {
|
return requestClient.delete('/finance/reimbursement/delete', {
|
params: { id },
|
});
|
}
|
|
/** 提交报销单审批 */
|
export function submitReimbursement(id: number, processDefinitionKey: string) {
|
return requestClient.post('/finance/reimbursement/submit', null, {
|
params: { id, processDefinitionKey },
|
});
|
}
|
|
/** 归档报销单(仅已通过可归档),返回生成的档案编号 */
|
export function archiveReimbursement(id: number) {
|
return requestClient.post<string>('/finance/reimbursement/archive', null, {
|
params: { id },
|
});
|
}
|
|
/** 获取报销单审批流程列表 */
|
export function getReimbursementApproveProcessList() {
|
return requestClient.get<FinanceReimbursementApi.ProcessDefinition[]>(
|
'/finance/reimbursement/approve-process-list',
|
);
|
}
|
|
/** 导出报销单 Excel */
|
export function exportReimbursement(params: any) {
|
return requestClient.download('/finance/reimbursement/export-excel', {
|
params,
|
});
|
}
|