workflow.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import store from '@/store'
  2. import {
  3. State,
  4. Access,
  5. WorkflowState
  6. } from '@/constant'
  7. import request from '@/utils/request'
  8. import {
  9. addTenant,
  10. addUser
  11. } from '@/api/base'
  12. export function getAuditWorkflows (query, options) {
  13. const { pageNum: pageIndex, pageSize } = query
  14. const condition = { status: State.SUBMITTED }
  15. const access = store.getters.access
  16. const isFinal = access.has(Access.REVIEW_RELEASE_FINAL)
  17. if (!isFinal || !__JUMP_REVIEW__) {
  18. const arr = []
  19. if (isFinal) {
  20. arr.push(WorkflowState.FINAL_LEVEL)
  21. }
  22. if (access.has(Access.REVIEW_RELEASE_SECOND)) {
  23. arr.push(WorkflowState.SECOND_LEVEL)
  24. }
  25. if (access.has(Access.REVIEW_RELEASE_FIRST)) {
  26. arr.push(WorkflowState.FIRST_LEVEL)
  27. }
  28. condition.currentSeveralReviewedList = arr
  29. }
  30. return request({
  31. url: '/workflow/pageByPropertis',
  32. method: 'POST',
  33. data: {
  34. pageIndex, pageSize,
  35. param: addTenant({
  36. status: State.SUBMITTED,
  37. ...condition
  38. })
  39. },
  40. ...options
  41. })
  42. }
  43. export function getWorkflowsByUser (query, options) {
  44. const { pageNum: pageIndex, pageSize, ...params } = query
  45. return request({
  46. url: '/workflow/pageByPropertis',
  47. method: 'POST',
  48. data: {
  49. pageIndex, pageSize,
  50. param: addTenant(addUser(params, 'createBy'))
  51. },
  52. ...options
  53. })
  54. }