diff --git a/src/api/module/approval.ts b/src/api/module/approval.ts new file mode 100644 index 0000000..087eb03 --- /dev/null +++ b/src/api/module/approval.ts @@ -0,0 +1,83 @@ +import { Method } from "alova"; +import { alovaInstance } from "@/utils/alova/alova-iview"; + +/** + * 应用内审批接口封装(第三步 T-C4,"我的待审核")。 + * 走本应用后端代理 /api/notice/approval/**(operator=CAS 登录态,前端不传身份); + * 后端经网关调 flow-center,契约=BasePageResult{total,content,...}。 + */ + +const APPROVAL = "/api/notice/approval"; + +function get(url: string, params?: Record): Method { + return new Method("GET", alovaInstance, url, { params }); +} + +function postJSON(url: string, data?: Record): Method { + return new Method( + "POST", + alovaInstance, + url, + { headers: { "Content-Type": "application/json;charset=UTF-8" } }, + data ? JSON.stringify(data) : undefined + ); +} + +export interface ApprovalTodoTask { + taskId: number; + instanceId: number; + instanceVersion: number | null; + bizType: string; + bizId: string; + bizTitle: string; + bizSnapshot: string | null; + nodeId: string; + nodeName: string; + assigneeId: number; + assigneeName: string; + arriveTime: string; +} + +export interface ApprovalInstance { + instanceId: number; + status: number; + version: number; + bizType: string; + bizId: string; + bizTitle: string; + bizUrl: string | null; + submitterName: string; + submitTime: string; + finishTime: string | null; + currentNodes: string; +} + +export interface ApprovalPage { + total: number; + content: T[]; + pageIndex: number; + pageSize: number; + totalPages: number; + hasNext: boolean; +} + +export const approvalApi = { + /** 我的待审核(bizType=notice 固定在后端) */ + todo(page = 1, size = 10): Method> { + return get(`${APPROVAL}/Todo`, { page, size }); + }, + /** 办件视角(status 可空;10 审批中/20 完成/30 拒绝/40 撤回) */ + instances(status?: number, page = 1, size = 10): Method> { + return get(`${APPROVAL}/Instances`, status ? { status, page, size } : { page, size }); + }, + /** 通过(opinion 可选) */ + approve(taskId: number, opinion?: string): Method { + return postJSON(`${APPROVAL}/Approve?taskId=${taskId}`, opinion ? { opinion } : {}); + }, + /** 拒绝(opinion 必填) */ + reject(taskId: number, opinion: string): Method { + return postJSON(`${APPROVAL}/Reject?taskId=${taskId}`, { opinion }); + }, +}; + +export default approvalApi; diff --git a/src/router/routes.ts b/src/router/routes.ts index a2b4091..5734f38 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -72,6 +72,13 @@ const routes: RouteRecordRaw[] = [ component: () => import("@/views/notice/NoticeSetting.vue"), meta: { title: "应用设置", modId: 21 }, }, + // 我的待审核(应用内审批;modId 23 深层页不在菜单树,菜单挂载待后端 GetUserMod 配置) + { + path: "/approval", + name: "notice_approval", + component: () => import("@/views/notice/NoticeApproval.vue"), + meta: { title: "我的待审核", modId: 23, parentId: 2 }, + }, /* ---- 旧版路径兼容重定向(书签、残留的平台模块配置) ---- */ { path: "/accept", redirect: "/" }, diff --git a/src/views/notice/NoticeApproval.vue b/src/views/notice/NoticeApproval.vue new file mode 100644 index 0000000..14d460a --- /dev/null +++ b/src/views/notice/NoticeApproval.vue @@ -0,0 +1,232 @@ + + + + +