index.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import request from '@/config/axios'
  2. export type ProcessDefinitionVO = {
  3. id: string
  4. version: number
  5. deploymentTIme: string
  6. suspensionState: number
  7. formType?: number
  8. }
  9. export type ModelVO = {
  10. id: number
  11. formName: string
  12. key: string
  13. name: string
  14. description: string
  15. category: string
  16. formType: number
  17. formId: number
  18. formCustomCreatePath: string
  19. formCustomViewPath: string
  20. processDefinition: ProcessDefinitionVO
  21. status: number
  22. remark: string
  23. createTime: string
  24. bpmnXml: string
  25. }
  26. export const getModelList = async (name: string | undefined) => {
  27. return await request.get({ url: '/bpm/model/list', params: { name } })
  28. }
  29. export const getModel = async (id: string) => {
  30. return await request.get({ url: '/bpm/model/get?id=' + id })
  31. }
  32. export const updateModel = async (data: ModelVO) => {
  33. return await request.put({ url: '/bpm/model/update', data: data })
  34. }
  35. // 批量修改流程分类的排序
  36. export const updateModelSortBatch = async (ids: number[]) => {
  37. return await request.put({
  38. url: `/bpm/model/update-sort-batch`,
  39. params: {
  40. ids: ids.join(',')
  41. }
  42. })
  43. }
  44. export const updateModelBpmn = async (data: ModelVO) => {
  45. return await request.put({ url: '/bpm/model/update-bpmn', data: data })
  46. }
  47. // 任务状态修改
  48. export const updateModelState = async (id: number, state: number) => {
  49. const data = {
  50. id: id,
  51. state: state
  52. }
  53. return await request.put({ url: '/bpm/model/update-state', data: data })
  54. }
  55. export const createModel = async (data: ModelVO) => {
  56. return await request.post({ url: '/bpm/model/create', data: data })
  57. }
  58. export const deleteModel = async (id: number) => {
  59. return await request.delete({ url: '/bpm/model/delete?id=' + id })
  60. }
  61. export const deployModel = async (id: number) => {
  62. return await request.post({ url: '/bpm/model/deploy?id=' + id })
  63. }
  64. export const cleanModel = async (id: number) => {
  65. return await request.delete({ url: '/bpm/model/clean?id=' + id })
  66. }
  67. /**
  68. * 查询当前流程实例下是否存在正在进行中的单据
  69. * @param processDefinitionId 流程定义id
  70. * @returns true/false
  71. */
  72. export const getProcessInstance = async (processDefinitionId: string) => {
  73. return await request.get({
  74. url: '/bpm/task/manager-list?processDefinitionId=' + processDefinitionId
  75. })
  76. }