import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace ArchiveBorrowApi {
|
/** 借阅单 */
|
export interface Borrow {
|
id?: number; // 借阅单编号
|
no?: string; // 借阅单号(后端生成:JY+yyyyMMdd+6位流水,只读)
|
documentId: number; // 档案 ID
|
documentNo?: string; // 档案编号(快照)
|
documentTitle?: string; // 档案标题(快照)
|
borrowerUserId?: number; // 借阅人用户 ID
|
borrowerName: string; // 借阅人姓名
|
borrowerDept?: string; // 借阅人部门
|
borrowerPhone?: string; // 借阅人联系电话
|
borrowDate: string; // 借阅日期
|
borrowPurpose?: string; // 借阅目的
|
returnDeadline: string; // 归还期限
|
status?: number; // 状态,字典 archive_borrow_status
|
processInstanceId?: string; // BPM 流程实例 ID
|
approveTime?: string; // 审批通过(实际借出)时间
|
returnTime?: string; // 实际归还时间
|
returnConfirmUserId?: number; // 归还确认人用户 ID
|
returnConfirmUserName?: string; // 归还确认人姓名
|
returnRemark?: string; // 归还备注
|
rejectReason?: string; // 驳回原因
|
rejectTime?: string; // 驳回时间
|
remark?: string; // 备注
|
overdue?: boolean; // 是否逾期(后端实时计算)
|
overdueDays?: number; // 逾期天数(后端实时计算)
|
createTime?: string; // 创建时间
|
}
|
|
/** 审批流程定义 */
|
export interface ProcessDefinition {
|
id: string;
|
key: string;
|
name: string;
|
}
|
|
/** 归还登记请求 */
|
export interface ReturnReq {
|
id: number; // 借阅单编号
|
returnRemark?: string; // 归还备注
|
}
|
}
|
|
/** 查询借阅单分页 */
|
export function getBorrowPage(params: PageParam) {
|
return requestClient.get<PageResult<ArchiveBorrowApi.Borrow>>(
|
'/archive/borrow/page',
|
{ params },
|
);
|
}
|
|
/** 查询逾期未还借阅单分页 */
|
export function getOverdueBorrowPage(params: PageParam) {
|
return requestClient.get<PageResult<ArchiveBorrowApi.Borrow>>(
|
'/archive/borrow/overdue-page',
|
{ params },
|
);
|
}
|
|
/** 查询借阅单详情 */
|
export function getBorrow(id: number) {
|
return requestClient.get<ArchiveBorrowApi.Borrow>(
|
`/archive/borrow/get?id=${id}`,
|
);
|
}
|
|
/** 新增借阅单 */
|
export function createBorrow(data: ArchiveBorrowApi.Borrow) {
|
return requestClient.post('/archive/borrow/create', data);
|
}
|
|
/** 修改借阅单 */
|
export function updateBorrow(data: ArchiveBorrowApi.Borrow) {
|
return requestClient.put('/archive/borrow/update', data);
|
}
|
|
/** 删除借阅单 */
|
export function deleteBorrow(id: number) {
|
return requestClient.delete('/archive/borrow/delete', {
|
params: { id },
|
});
|
}
|
|
/** 提交借阅单审批 */
|
export function submitBorrow(id: number, processDefinitionKey?: string) {
|
return requestClient.post('/archive/borrow/submit', null, {
|
params: { id, processDefinitionKey },
|
});
|
}
|
|
/** 获取档案借阅审批流程列表 */
|
export function getBorrowApproveProcessList() {
|
return requestClient.get<ArchiveBorrowApi.ProcessDefinition[]>(
|
'/archive/borrow/approve-process-list',
|
);
|
}
|
|
/** 归还登记 */
|
export function returnBorrow(data: ArchiveBorrowApi.ReturnReq) {
|
return requestClient.post('/archive/borrow/return', data);
|
}
|