From 370091ed6ea5838dc9c29f2433b07005e64186e5 Mon Sep 17 00:00:00 2001 From: weicw <594098497@qq.com> Date: Fri, 30 Oct 2026 20:20:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(approval):=20=E5=91=98=E5=B7=A5=E7=AB=AF?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E4=B8=AD=E5=BF=83=E5=85=A5=E5=8F=A3=E4=B8=8E?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E5=AE=8C=E6=88=90=E7=A1=AE=E8=AE=A4=E5=8D=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20(#19)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/approval/attachment/index.ts | 57 ++ src/api/approval/instance/index.ts | 63 +++ src/api/approval/model/index.ts | 149 +++++ src/api/approval/task/index.ts | 16 + src/packageApproval/pages/detail.vue | 441 +++++++++++++++ src/packageApproval/pages/form-completion.vue | 532 ++++++++++++++++++ src/packageApproval/pages/index.vue | 391 +++++++++++++ src/pages.json | 26 + src/pages/user.vue | 121 +++- 9 files changed, 1794 insertions(+), 2 deletions(-) create mode 100644 src/api/approval/attachment/index.ts create mode 100644 src/api/approval/instance/index.ts create mode 100644 src/api/approval/model/index.ts create mode 100644 src/api/approval/task/index.ts create mode 100644 src/packageApproval/pages/detail.vue create mode 100644 src/packageApproval/pages/form-completion.vue create mode 100644 src/packageApproval/pages/index.vue diff --git a/src/api/approval/attachment/index.ts b/src/api/approval/attachment/index.ts new file mode 100644 index 0000000..d9d1591 --- /dev/null +++ b/src/api/approval/attachment/index.ts @@ -0,0 +1,57 @@ +import request from '@/utils/request'; +import type { ApiResult } from '@/api'; +import type { ApprovalAttachment } from '../model'; +import { TENANT_ID, THINK_API_URL } from '@/config/setting'; + +/** + * 上传附件:走审批域端点,header 带登录态与租户 + */ +export function uploadAttachment( + instanceId: number, + filePath: string, + category: string +): Promise { + return new Promise((resolve, reject) => { + const token = uni.getStorageSync('access_token'); + uni.uploadFile({ + url: + THINK_API_URL + + '/approval/attachment/upload?instanceId=' + + instanceId, + name: 'file', + filePath, + formData: { category }, + header: { + TenantId: TENANT_ID, + ...(token ? { Authorization: token } : {}) + }, + success: res => { + try { + const body = + typeof res.data === 'string' ? JSON.parse(res.data) : res.data; + if (body.code === 0 && body.data) { + resolve(body.data as ApprovalAttachment); + return; + } + reject(new Error(body.message || '上传失败')); + } catch (err) { + reject(new Error('上传失败')); + } + }, + fail: () => reject(new Error('上传失败')) + }); + }); +} + +/** + * 逻辑删除附件 + */ +export async function deleteAttachment(id: number) { + const res = await request.delete>( + THINK_API_URL + '/approval/attachment/' + id + ); + if (res.data.code === 0) { + return true; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/src/api/approval/instance/index.ts b/src/api/approval/instance/index.ts new file mode 100644 index 0000000..f34ddc9 --- /dev/null +++ b/src/api/approval/instance/index.ts @@ -0,0 +1,63 @@ +import request from '@/utils/request'; +import type { ApiResult, PageResult } from '@/api'; +import type { + ApprovalCompletionForm, + ApprovalInstance, + ApprovalItem, + ApprovalMineParam +} from '../model'; +import { THINK_API_URL } from '@/config/setting'; + +/** + * 新建或保存业务完成确认单草稿,返回实例id + */ +export async function saveCompletion(data: ApprovalCompletionForm) { + const res = await request.post>( + THINK_API_URL + '/approval/instance/completion', + data + ); + if (res.data.code === 0) { + return res.data.data as number; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 提交或重提 + */ +export async function submitInstance(id: number) { + const res = await request.post>( + THINK_API_URL + '/approval/instance/' + id + '/submit' + ); + if (res.data.code === 0) { + return res.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 单据详情 + */ +export async function getInstance(id: number) { + const res = await request.get>( + THINK_API_URL + '/approval/instance/' + id + ); + if (res.data.code === 0 && res.data.data) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 我发起的 + */ +export async function pageMine(params: ApprovalMineParam) { + const res = await request.get>>( + THINK_API_URL + '/approval/mine/page', + { params } + ); + if (res.data.code === 0 && res.data.data) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/src/api/approval/model/index.ts b/src/api/approval/model/index.ts new file mode 100644 index 0000000..1a0a548 --- /dev/null +++ b/src/api/approval/model/index.ts @@ -0,0 +1,149 @@ +import type { PageParam } from '@/api'; + +/** + * 审批附件 + */ +export interface ApprovalAttachment { + id: number; + fileId: number; + name: string; + url: string; + length: number; + category: string; + categoryName: string; + uploaderId: number; + uploaderName?: string; + createTime?: string; +} + +/** + * 处理记录 + */ +export interface ApprovalRecord { + id: number; + taskId?: number; + nodeKey?: string; + nodeName?: string; + operatorId: number; + operatorName?: string; + action: string; + actionName: string; + opinion?: string; + round: number; + createTime?: string; +} + +/** + * 当前轮存档确认状态 + */ +export interface ApprovalConfirm { + userId: number; + userName?: string; + status: string; + statusName: string; + handleTime?: string; +} + +/** + * 当前用户待办任务 + */ +export interface ApprovalMyTask { + id: number; + nodeKey: string; + nodeType: string; + status: string; +} + +/** + * 详情动作权限 + */ +export interface ApprovalPermissions { + canEdit: boolean; + canSubmit: boolean; + canWithdraw: boolean; + canApprove: boolean; + canReject: boolean; + canConfirm: boolean; + canArchive: boolean; + canDispatch: boolean; + canAssign: boolean; +} + +/** + * 列表行 + */ +export interface ApprovalItem { + id: number; + bizNo?: string; + docType: string; + docTypeName: string; + status: string; + statusName: string; + title?: string; + submitTime?: string; + currentNodeName?: string; + reporterId: number; + reporterName?: string; + reportOrgName?: string; + acceptOrgName?: string; + archiveTime?: string; +} + +/** + * 单据详情 + */ +export interface ApprovalInstance extends ApprovalItem { + flowCode: string; + round: number; + reportOrgId?: number; + acceptOrgId?: number; + currentNodeKey?: string; + currentNodeType?: string; + approveTime?: string; + archivistId?: number; + archivistName?: string; + name?: string; + implementOrg?: string; + fee?: number; + serviceContent?: string; + content?: string; + remark?: string; + dispatchTargetId?: number; + dispatchTargetName?: string; + attachments: ApprovalAttachment[]; + records: ApprovalRecord[]; + confirms: ApprovalConfirm[]; + myTask?: ApprovalMyTask | null; + permissions: ApprovalPermissions; +} + +/** + * 业务完成确认单草稿参数 + */ +export interface ApprovalCompletionForm { + id?: number; + name: string; + implementOrg: string; + fee: number | string; + serviceContent: string; +} + +/** + * 我发起的查询参数 + */ +export interface ApprovalMineParam extends PageParam { + status?: string; + docType?: string; +} + +/** + * 组织 + */ +export interface ApprovalOrganization { + organizationId: number; + parentId?: number; + organizationName: string; + organizationFullName?: string; + organizationCode?: string; + leaderId?: number; +} diff --git a/src/api/approval/task/index.ts b/src/api/approval/task/index.ts new file mode 100644 index 0000000..523577c --- /dev/null +++ b/src/api/approval/task/index.ts @@ -0,0 +1,16 @@ +import request from '@/utils/request'; +import type { ApiResult } from '@/api'; +import { THINK_API_URL } from '@/config/setting'; + +/** + * 待办数量(个人中心红点) + */ +export async function getTodoCount() { + const res = await request.get>( + THINK_API_URL + '/approval/todo/count' + ); + if (res.data.code === 0 && res.data.data !== undefined) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/src/packageApproval/pages/detail.vue b/src/packageApproval/pages/detail.vue new file mode 100644 index 0000000..47c52ed --- /dev/null +++ b/src/packageApproval/pages/detail.vue @@ -0,0 +1,441 @@ + + + + + diff --git a/src/packageApproval/pages/form-completion.vue b/src/packageApproval/pages/form-completion.vue new file mode 100644 index 0000000..07bd0f7 --- /dev/null +++ b/src/packageApproval/pages/form-completion.vue @@ -0,0 +1,532 @@ +