index.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import request from '@/config/axios'
  2. import { ProcessDefinitionVO } from '@/api/bpm/model'
  3. import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
  4. export type Task = {
  5. id: string
  6. name: string
  7. }
  8. export type ProcessInstanceVO = {
  9. id: number
  10. name: string
  11. processDefinitionId: string
  12. category: string
  13. result: number
  14. tasks: Task[]
  15. fields: string[]
  16. status: number
  17. remark: string
  18. businessKey: string
  19. createTime: string
  20. endTime: string
  21. processDefinition?: ProcessDefinitionVO
  22. }
  23. // 用户信息
  24. export type User = {
  25. id: number,
  26. nickname: string,
  27. avatar: string
  28. }
  29. // 审批任务信息
  30. export type ApprovalTaskInfo = {
  31. id: number,
  32. ownerUser: User,
  33. assigneeUser: User,
  34. status: number,
  35. reason: string
  36. }
  37. // 审批节点信息
  38. export type ApprovalNodeInfo = {
  39. id : number
  40. name: string
  41. nodeType: NodeType
  42. status: number
  43. startTime?: Date
  44. endTime?: Date
  45. candidateUserList?: User[]
  46. tasks: ApprovalTaskInfo[]
  47. }
  48. export const getProcessInstanceMyPage = async (params: any) => {
  49. return await request.get({ url: '/bpm/process-instance/my-page', params })
  50. }
  51. export const getProcessInstanceManagerPage = async (params: any) => {
  52. return await request.get({ url: '/bpm/process-instance/manager-page', params })
  53. }
  54. export const createProcessInstance = async (data) => {
  55. return await request.post({ url: '/bpm/process-instance/create', data: data })
  56. }
  57. export const cancelProcessInstanceByStartUser = async (id: number, reason: string) => {
  58. const data = {
  59. id: id,
  60. reason: reason
  61. }
  62. return await request.delete({ url: '/bpm/process-instance/cancel-by-start-user', data: data })
  63. }
  64. export const cancelProcessInstanceByAdmin = async (id: number, reason: string) => {
  65. const data = {
  66. id: id,
  67. reason: reason
  68. }
  69. return await request.delete({ url: '/bpm/process-instance/cancel-by-admin', data: data })
  70. }
  71. export const getProcessInstance = async (id: string) => {
  72. return await request.get({ url: '/bpm/process-instance/get?id=' + id })
  73. }
  74. export const getProcessInstanceCopyPage = async (params: any) => {
  75. return await request.get({ url: '/bpm/process-instance/copy/page', params })
  76. }
  77. // 获取审批详情
  78. export const getApprovalDetail = async (processInstanceId?:string, processDefinitionId?:string) => {
  79. const param = processInstanceId ? '?processInstanceId='+ processInstanceId : '?processDefinitionId='+ processDefinitionId
  80. return await request.get({ url: 'bpm/process-instance/get-approval-detail'+ param })
  81. }
  82. // 获取表单字段权限
  83. export const getFormFieldsPermission = async (params: any) => {
  84. return await request.get({ url: '/bpm/process-instance/get-form-fields-permission', params })
  85. }