import type { PageParam, PageResult } from '#/packages/effects/request/src';
|
|
import { requestClient } from '#/api/request';
|
import type { SystemStorageApi } from '#/api/system/storage';
|
|
export namespace HrmResignationApi {
|
/** 离职申请 */
|
export interface Resignation {
|
id?: number;
|
employeeId?: number;
|
employeeName?: string;
|
deptName?: string;
|
postName?: string;
|
resignationType?: number;
|
expectedDate?: string;
|
reason?: string;
|
handoverUserId?: number;
|
handoverUserName?: string;
|
handoverStatus?: number;
|
blobIds?: number[];
|
attachmentList?: SystemStorageApi.StorageBlob[];
|
status?: number;
|
// 以下为审核派生字段,由后端在审核时写入,前端只读展示
|
reviewerId?: number; // 审核人ID(实际执行审核的用户)
|
reviewerName?: string; // 审核人姓名
|
reviewTime?: string; // 审核时间
|
reviewRemark?: string; // 审核意见(审核通过时的意见 / 审核不通过时的原因)
|
remark?: string;
|
createTime?: string;
|
}
|
}
|
|
/** 查询离职申请分页列表 */
|
export function getResignationPage(params: PageParam) {
|
return requestClient.get<PageResult<HrmResignationApi.Resignation>>(
|
'/hrm/resignation/page',
|
{ params },
|
);
|
}
|
|
/** 查询离职申请详情 */
|
export function getResignation(id: number) {
|
return requestClient.get<HrmResignationApi.Resignation>(
|
`/hrm/resignation/get?id=${id}`,
|
);
|
}
|
|
/** 新增离职申请(草稿) */
|
export function createResignation(data: HrmResignationApi.Resignation) {
|
return requestClient.post('/hrm/resignation/create', data);
|
}
|
|
/** 更新离职申请 */
|
export function updateResignation(data: HrmResignationApi.Resignation) {
|
return requestClient.put('/hrm/resignation/update', data);
|
}
|
|
/** 删除离职申请 */
|
export function deleteResignation(id: number) {
|
return requestClient.delete(`/hrm/resignation/delete?id=${id}`);
|
}
|
|
/**
|
* 提交离职申请审批(草稿 / 审核不通过 → 审批中)
|
*
|
* 审批人由「系统管理 - 审批配置」按业务类型(hrm_resignation_approve)统一配置,提交时无需指定。
|
*/
|
export function submitResignation(id: number) {
|
return requestClient.put('/hrm/resignation/submit', null, { params: { id } });
|
}
|
|
/** 撤销离职申请 */
|
export function cancelResignation(id: number) {
|
return requestClient.post(`/hrm/resignation/cancel?id=${id}`);
|
}
|
|
/** 更新交接状态 */
|
export function updateHandoverStatus(id: number, handoverStatus: number) {
|
return requestClient.put('/hrm/resignation/handover', { id, handoverStatus });
|
}
|
|
/** 获得离职申请的审批人编号集合,供列表页判断是否展示审核按钮 */
|
export function getResignationApproverIds() {
|
return requestClient.get<number[]>('/hrm/resignation/approver-ids');
|
}
|
|
/**
|
* 审核离职申请(审批中 → 审核通过 / 审核不通过)
|
*
|
* 仅审批配置中的审批人可调用(多人时或签);pass=false 时 reviewRemark(不通过原因)必填。
|
*/
|
export function auditResignation(
|
id: number,
|
pass: boolean,
|
reviewRemark?: string,
|
) {
|
return requestClient.put('/hrm/resignation/audit', {
|
id,
|
pass,
|
reviewRemark,
|
});
|
}
|