2023-02-11 00:44:00 +08:00
|
|
|
import request from '@/config/axios'
|
2024-07-20 20:05:42 +08:00
|
|
|
import { ProcessDefinitionVO } from '@/api/bpm/model'
|
2024-10-01 23:35:11 +08:00
|
|
|
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
|
2023-02-11 00:44:00 +08:00
|
|
|
export type Task = {
|
|
|
|
id: string
|
|
|
|
name: string
|
|
|
|
}
|
2023-03-28 08:10:11 +08:00
|
|
|
|
2023-02-11 00:44:00 +08:00
|
|
|
export type ProcessInstanceVO = {
|
|
|
|
id: number
|
|
|
|
name: string
|
|
|
|
processDefinitionId: string
|
|
|
|
category: string
|
|
|
|
result: number
|
|
|
|
tasks: Task[]
|
|
|
|
fields: string[]
|
|
|
|
status: number
|
|
|
|
remark: string
|
|
|
|
businessKey: string
|
|
|
|
createTime: string
|
|
|
|
endTime: string
|
2024-07-20 20:05:42 +08:00
|
|
|
processDefinition?: ProcessDefinitionVO
|
2024-01-17 09:40:05 +08:00
|
|
|
}
|
|
|
|
|
2024-10-01 23:35:11 +08:00
|
|
|
// 用户信息
|
|
|
|
export type User = {
|
|
|
|
id: number,
|
|
|
|
nickname: string,
|
|
|
|
avatar: string
|
|
|
|
}
|
|
|
|
|
|
|
|
// 审批任务信息
|
|
|
|
export type ApprovalTaskInfo = {
|
|
|
|
id: number,
|
|
|
|
ownerUser: User,
|
|
|
|
assigneeUser: User,
|
|
|
|
status: number,
|
|
|
|
reason: string
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 审批节点信息
|
|
|
|
export type ApprovalNodeInfo = {
|
|
|
|
id : number
|
|
|
|
name: string
|
|
|
|
nodeType: NodeType
|
|
|
|
status: number
|
|
|
|
startTime?: Date
|
|
|
|
endTime?: Date
|
|
|
|
candidateUserList?: User[]
|
|
|
|
tasks: ApprovalTaskInfo[]
|
|
|
|
}
|
|
|
|
|
2024-03-22 08:26:26 +08:00
|
|
|
export const getProcessInstanceMyPage = async (params: any) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return await request.get({ url: '/bpm/process-instance/my-page', params })
|
|
|
|
}
|
|
|
|
|
2024-03-22 08:26:26 +08:00
|
|
|
export const getProcessInstanceManagerPage = async (params: any) => {
|
|
|
|
return await request.get({ url: '/bpm/process-instance/manager-page', params })
|
|
|
|
}
|
|
|
|
|
2023-04-05 20:13:35 +08:00
|
|
|
export const createProcessInstance = async (data) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return await request.post({ url: '/bpm/process-instance/create', data: data })
|
|
|
|
}
|
|
|
|
|
2024-03-22 08:26:26 +08:00
|
|
|
export const cancelProcessInstanceByStartUser = async (id: number, reason: string) => {
|
|
|
|
const data = {
|
|
|
|
id: id,
|
|
|
|
reason: reason
|
|
|
|
}
|
|
|
|
return await request.delete({ url: '/bpm/process-instance/cancel-by-start-user', data: data })
|
|
|
|
}
|
|
|
|
|
|
|
|
export const cancelProcessInstanceByAdmin = async (id: number, reason: string) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
const data = {
|
|
|
|
id: id,
|
|
|
|
reason: reason
|
|
|
|
}
|
2024-03-22 08:26:26 +08:00
|
|
|
return await request.delete({ url: '/bpm/process-instance/cancel-by-admin', data: data })
|
2023-02-11 00:44:00 +08:00
|
|
|
}
|
|
|
|
|
2024-03-19 01:31:51 +08:00
|
|
|
export const getProcessInstance = async (id: string) => {
|
2023-02-11 00:44:00 +08:00
|
|
|
return await request.get({ url: '/bpm/process-instance/get?id=' + id })
|
|
|
|
}
|
2024-01-17 09:40:05 +08:00
|
|
|
|
2024-03-17 22:14:28 +08:00
|
|
|
export const getProcessInstanceCopyPage = async (params: any) => {
|
|
|
|
return await request.get({ url: '/bpm/process-instance/copy/page', params })
|
2024-01-17 09:40:05 +08:00
|
|
|
}
|
2024-10-01 23:35:11 +08:00
|
|
|
|
2024-10-02 09:49:07 +08:00
|
|
|
// 获取审批详情
|
2024-10-01 23:35:11 +08:00
|
|
|
export const getApprovalDetail = async (processInstanceId?:string, processDefinitionId?:string) => {
|
|
|
|
const param = processInstanceId ? '?processInstanceId='+ processInstanceId : '?processDefinitionId='+ processDefinitionId
|
|
|
|
return await request.get({ url: 'bpm/process-instance/get-approval-detail'+ param })
|
|
|
|
}
|
2024-10-02 09:49:07 +08:00
|
|
|
|
|
|
|
// 获取表单字段权限
|
|
|
|
export const getFormFieldsPermission = async (params: any) => {
|
|
|
|
return await request.get({ url: '/bpm/process-instance/get-form-fields-permission', params })
|
|
|
|
}
|