I4processSet.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import { dictFilterArr } from '@/pages/Isystem/I2dict/data'
  2. import store, { AppDispatch } from '@/store'
  3. import http from '@/utils/http'
  4. /**
  5. * 流程设置 - 获取分页列表
  6. */
  7. export const I4_APIgetList = (data: any): any => {
  8. return async (dispatch: AppDispatch) => {
  9. const res = await http.post('cms/flow/pageList', { ...data, pageSize: 99999, pageNum: 1 })
  10. if (res.code === 0) {
  11. const treeData = store.getState().I2dict.dictAll.filter(v => dictFilterArr.includes(v.id))
  12. let list: any[] = res.data.records || []
  13. list.forEach(v => {
  14. const ids: string = v.dictIds || ''
  15. if (ids) {
  16. const arr = ids.split(',')
  17. const ids1: string[] = []
  18. const ids2: string[] = []
  19. arr.forEach(v2 => {
  20. if (dictFilterArr.includes(v2)) ids1.push(v2)
  21. else ids2.push(v2)
  22. })
  23. let txtTemp: any = []
  24. treeData.forEach(v1 => {
  25. if (ids1.includes(v1.id)) {
  26. if (txtTemp[v1.name]) txtTemp[v1.name].push('默认')
  27. else txtTemp[v1.name] = ['默认']
  28. }
  29. if (v1.children) {
  30. v1.children.forEach(v2 => {
  31. if (ids2.includes(v2.id)) {
  32. if (txtTemp[v1.name]) txtTemp[v1.name].push(v2.name)
  33. else txtTemp[v1.name] = [v2.name]
  34. }
  35. })
  36. }
  37. })
  38. let txt = ''
  39. for (const k in txtTemp) {
  40. txt += k + ':'
  41. if (txtTemp[k] && txtTemp[k].length) {
  42. txt += txtTemp[k].join(',') + '<br/>'
  43. }
  44. }
  45. txt = txt.substring(0, txt.length - 5)
  46. v.guanLian = txt
  47. }
  48. })
  49. dispatch({ type: 'I4/getList', payload: list })
  50. }
  51. }
  52. }
  53. /**
  54. * 流程设置 - 删除
  55. */
  56. export const I4_APIdel = (ids: number[]) => {
  57. return http.post('cms/flow/removes', ids)
  58. }
  59. /**
  60. * 流程设置-新增/编辑
  61. */
  62. export const I4_APIsave = (data: any) => {
  63. return http.post('cms/flow/saveEntity', data)
  64. }
  65. /**
  66. * 流程设置-获取详情
  67. */
  68. export const I4_APIgetInfo = (id: number) => {
  69. return http.get(`cms/flow/detail/${id}`)
  70. }
  71. /**
  72. * 流程设置- 环节 - 列表
  73. */
  74. export const I4_APIgetProList = (id: number) => {
  75. return http.get(`cms/flow/process/getList/${id}`)
  76. }
  77. /**
  78. * 流程设置- 环节-获取详情
  79. */
  80. export const I4_APIgetProInfo = (id: number) => {
  81. return http.get(`cms/flow/process/${id}`)
  82. }
  83. /**
  84. * 流程设置- 环节-删除
  85. */
  86. export const I4_APIgetProDel = (id: number) => {
  87. return http.get(`cms/flow/process/remove/${id}`)
  88. }
  89. /**
  90. * 流程设置- 环节-新增/编辑
  91. */
  92. export const I4_APIgetProSave = (data: any) => {
  93. return http.post('cms/flow/process/save', data)
  94. }
  95. /**
  96. * 流程设置- 环节 - 列表
  97. */
  98. export const I4_APIgetProGetUser = (id: number) => {
  99. return http.get(`cms/flow/process/getUser/${id}`)
  100. }