feat: 审批 API 支持通用草稿保存与回填;附件分类扩为三档(#46)

This commit is contained in:
weicw
2026-10-31 06:33:50 +08:00
parent 590825d288
commit 03e4dc8f9b
4 changed files with 36 additions and 2 deletions
+14
View File
@@ -38,6 +38,20 @@ export async function saveCoordination(data: ApprovalCoordinationForm) {
return Promise.reject(new Error(res.data.message));
}
/**
* 新建或保存任意单据草稿(按流程编码路由),返回实例id
*/
export async function saveDocument(flowCode: string, data: Record<string, any>) {
const res = await request.post<ApiResult<number>>(
THINK_API_URL + '/approval/instance/' + flowCode,
data
);
if (res.data.code === 0) {
return res.data.data as number;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 提交或重提
*/
+20 -2
View File
@@ -19,10 +19,28 @@ export async function getTodoCount() {
/**
* 通过(意见可选)
*/
export async function approveTask(id: number, opinion?: string) {
export async function approveTask(
id: number,
opinion?: string,
fields?: Record<string, string>
) {
const res = await request.post<ApiResult<ApprovalInstance>>(
THINK_API_URL + '/approval/task/' + id + '/approve',
{ opinion }
{ opinion, fields }
);
if (res.data.code === 0 && res.data.data) {
return res.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 回填(只写字段,不推进节点)
*/
export async function backfillTask(id: number, fields: Record<string, string>) {
const res = await request.post<ApiResult<ApprovalInstance>>(
THINK_API_URL + '/approval/task/' + id + '/backfill',
{ fields }
);
if (res.data.code === 0 && res.data.data) {
return res.data;
@@ -115,6 +115,7 @@ import { showError, showSuccess } from '@/utils/app';
const userStore = useUserStore();
const categories = [
{ value: 'SIGNED', label: '签字件' },
{ value: 'VOUCHER', label: '凭证' },
{ value: 'OTHER', label: '其他' }
];
@@ -126,6 +126,7 @@ import { showError, showSuccess } from '@/utils/app';
const userStore = useUserStore();
const categories = [
{ value: 'SIGNED', label: '签字件' },
{ value: 'VOUCHER', label: '凭证' },
{ value: 'OTHER', label: '其他' }
];