index.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import request from '@/config/axios'
  2. import { ProcessDefinitionVO } from '@/api/bpm/model'
  3. import { NodeType, CandidateStrategy } 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. candidateStrategy?: CandidateStrategy
  43. status: number
  44. startTime?: Date
  45. endTime?: Date
  46. candidateUsers?: User[]
  47. tasks: ApprovalTaskInfo[]
  48. }
  49. export const getProcessInstanceMyPage = async (params: any) => {
  50. return await request.get({ url: '/bpm/process-instance/my-page', params })
  51. }
  52. export const getProcessInstanceManagerPage = async (params: any) => {
  53. return await request.get({ url: '/bpm/process-instance/manager-page', params })
  54. }
  55. export const createProcessInstance = async (data) => {
  56. return await request.post({ url: '/bpm/process-instance/create', data: data })
  57. }
  58. export const cancelProcessInstanceByStartUser = async (id: number, reason: string) => {
  59. const data = {
  60. id: id,
  61. reason: reason
  62. }
  63. return await request.delete({ url: '/bpm/process-instance/cancel-by-start-user', data: data })
  64. }
  65. export const cancelProcessInstanceByAdmin = async (id: number, reason: string) => {
  66. const data = {
  67. id: id,
  68. reason: reason
  69. }
  70. return await request.delete({ url: '/bpm/process-instance/cancel-by-admin', data: data })
  71. }
  72. export const getProcessInstance = async (id: string) => {
  73. return await request.get({ url: '/bpm/process-instance/get?id=' + id })
  74. }
  75. export const getProcessInstanceCopyPage = async (params: any) => {
  76. return await request.get({ url: '/bpm/process-instance/copy/page', params })
  77. }
  78. // 获取审批详情
  79. export const getApprovalDetail = async (params: any) => {
  80. return await request.get({ url: 'bpm/process-instance/get-approval-detail' , params })
  81. }
  82. // 获取表单字段权限
  83. export const getFormFieldsPermission = async (params: any) => {
  84. return await request.get({ url: '/bpm/process-instance/get-form-fields-permission', params })
  85. }
  86. // 获取流程实例的 BPMN 模型视图
  87. export const getProcessInstanceBpmnModelView = async (id: string) => {
  88. return await request.get({ url: '/bpm/process-instance/get-bpmn-model-view?id=' + id })
  89. }