feat(approval): 员工端待办/已办与通过驳回撤回 (#20)
- 审批中心三个 tab 接入待办/已办接口,支持状态+关键词筛选与下拉刷新 - 详情页新增通过(意见可选)、驳回(意见必填)、撤回(二次确认) - 驳回/撤回后提供修改并重新提交入口,按钮按 permissions 显隐
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { ApprovalInstance } from '../model';
|
||||
import { THINK_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
@@ -14,3 +15,44 @@ export async function getTodoCount() {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过(意见可选)
|
||||
*/
|
||||
export async function approveTask(id: number, opinion?: string) {
|
||||
const res = await request.post<ApiResult<ApprovalInstance>>(
|
||||
THINK_API_URL + '/approval/task/' + id + '/approve',
|
||||
{ opinion }
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回(意见必填)
|
||||
*/
|
||||
export async function rejectTask(id: number, opinion: string) {
|
||||
const res = await request.post<ApiResult<ApprovalInstance>>(
|
||||
THINK_API_URL + '/approval/task/' + id + '/reject',
|
||||
{ opinion }
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回
|
||||
*/
|
||||
export async function withdrawInstance(id: number) {
|
||||
const res = await request.post<ApiResult<ApprovalInstance>>(
|
||||
THINK_API_URL + '/approval/instance/' + id + '/withdraw'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user