index.ts 2.7 KB

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