examine.ts 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * @Author: tengmingxue 1473375109@qq.com
  3. * @Date: 2023-09-11 19:36:34
  4. * @LastEditors: tengmingxue 1473375109@qq.com
  5. * @LastEditTime: 2023-09-25 21:47:12
  6. * @FilePath: \xld-gis-admin\src\api\resource\examine.ts
  7. * @Description: 流程配置信息api
  8. */
  9. import { defHttp } from '/@/utils/http/axios';
  10. enum Api {
  11. SelectFlowInfo = '/base-center/flow/selectFlowInfo', //查询流程信息
  12. SaveFlowInfo = '/base-center/flow/saveFlowInfo', //新增、更新流程信息
  13. SaveFlowInfoAll = '/base-center/flow/insertFlowInfoAll', //新增流程、节点、节点人员信息
  14. DelFLowInfo = '/base-center/flow/deleteFlowInfo', //删除流程
  15. SelectLowConfig = '/base-center/flow/selectFlowInfoAll', //查询流程、节点、节点人员信息
  16. SubmitExamine = '/base-center/flow/saveBussinfo',//发起申请
  17. SubminExamineResult = '/base-center/flow/submitBussinfo',//审核操作
  18. GetFlowInfoAll = '/base-center/flow/getFlowInfoAll',//获取所有业务
  19. }
  20. /**
  21. * @description: 查询流程信息
  22. * @param: page:页数 must
  23. * @param: rows:每页数据条数 must
  24. * @param: keyStr:模糊查询关键字
  25. * @param: id:流程id
  26. */
  27. export const queryFlowInfoPage = (params) => {
  28. params['rows'] = params?.pageSize ? params?.pageSize : 10
  29. return new Promise<void>((resolve) => {
  30. defHttp.post({ url: Api.SelectFlowInfo, params: params }).then((res) => {
  31. const result = res.resp_code === 0 ? res.datas.pageData : []
  32. result.forEach(item => {
  33. item['id'] = item['ID']
  34. });
  35. resolve(result)
  36. })
  37. })
  38. };
  39. /**
  40. * @description:根据流程业务id查询流程配置所有信息
  41. * @param: ids:字符串数组
  42. */
  43. export const queryFlowInfoById = (param) => {
  44. const data = param.toString()
  45. // const dataFrom = new FormData()
  46. // dataFrom.append('',data)
  47. return new Promise<void>((resolve) => {
  48. defHttp.post({
  49. url: Api.SelectLowConfig,
  50. data,
  51. headers: {
  52. 'Content-Type': 'application/json;charset=UTF-8'
  53. },
  54. }).then((res) => {
  55. const result = (res.resp_code === 0 && res.datas.length > 0) ? res.datas[0] : null
  56. resolve(result)
  57. })
  58. })
  59. }
  60. /**
  61. * @description:根据流程业务查询流程配置所有信息
  62. * @param: ids:字符串数组
  63. */
  64. export const queryFlowInfo = async(params) => {
  65. return new Promise<void>((resolve) => {
  66. defHttp.post({
  67. url: Api.SelectLowConfig,
  68. params,
  69. headers: {
  70. 'Content-Type': 'application/json;charset=UTF-8',
  71. },
  72. }).then((res) => {
  73. const result = (res.resp_code === 0) ? res.datas : null
  74. resolve(result)
  75. })
  76. })
  77. }
  78. /**
  79. * @description: 一次提交流程配置信息
  80. * @param: flowInfo:流程信息 must
  81. * @param: flowNode:流程步骤结点信息 must
  82. * @param: flowNodePerson:流程审核人信息 must
  83. *
  84. */
  85. export const addFlowInfoAll = (params) => {
  86. return new Promise<void>((resolve) => {
  87. defHttp.post({ url: Api.SaveFlowInfoAll, params }).then((res) => {
  88. resolve(res)
  89. })
  90. })
  91. };
  92. /**
  93. * @description: 批量删除流程信息
  94. * @param: ids:流程信息id must
  95. *
  96. */
  97. export const delFlowInfo = (params) => {
  98. const data = params.toString()
  99. return new Promise<void>((resolve) => {
  100. defHttp.post({
  101. url: Api.DelFLowInfo, data, headers: {
  102. 'Content-Type': 'application/json;charset=UTF-8'
  103. },
  104. }).then((res) => {
  105. resolve(res)
  106. })
  107. })
  108. };
  109. /**
  110. * 根据业务类型名称获取流程配置
  111. */
  112. export const getFlowConfigByBusinessName = async (name) => {
  113. return new Promise<void>(async(resolve) => {
  114. const params = {
  115. page:1,
  116. pageSize:200,
  117. }
  118. const list = await queryFlowInfoPage(params)
  119. let result = null
  120. if(list.length > 0){
  121. const obj = list.find(item=>item['FLOWNAME']===name)
  122. if(obj){
  123. const data = {
  124. flowInfo:{
  125. id:obj['ID']
  126. }
  127. }
  128. result = await queryFlowInfo(data)
  129. }
  130. else result = null
  131. }
  132. else{
  133. result = null
  134. }
  135. resolve(result)
  136. })
  137. }
  138. /**
  139. * @description: 提交审核信息
  140. * @param: bussInfo:流程信息 must
  141. * @param: bussInfo.bussname 业务名称(流程名称)
  142. * @param: bussInfo.flowid 流程id
  143. * @param: bussInfo.serverids 资源id
  144. *
  145. */
  146. export const submitExamine = (params) => {
  147. return new Promise<void>((resolve) => {
  148. defHttp.post({ url: Api.SubmitExamine, params }).then((res) => {
  149. resolve(res)
  150. })
  151. })
  152. };
  153. /**
  154. * @description: 提交审核结果
  155. * @param: bussInfoId: 业务id
  156. * @param: ispass 是否通过
  157. * @param: opinion 意见 required:false
  158. * @param: userId 用户ID required:false
  159. *
  160. */
  161. export const subminExamineResult = (params) => {
  162. return new Promise<void>((resolve) => {
  163. defHttp.post({ url: Api.SubminExamineResult, params }).then((res) => {
  164. resolve(res)
  165. })
  166. })
  167. };
  168. /**
  169. * @description: 查询发起的业务信息
  170. * @param: page:页数 must
  171. * @param: rows:每页数据条数 must
  172. * @param: keyStr:模糊查询关键字
  173. * @param: userId:用户id
  174. */
  175. export const queryTaskInfoPage = (params) => {
  176. // params['rows'] = params?.pageSize ? params?.pageSize : 10
  177. return new Promise<void>((resolve) => {
  178. defHttp.post({ url: Api.GetFlowInfoAll, params: params }).then((res) => {
  179. // const result = res.resp_code === 0 ? res.datas.pageData : []
  180. // result.forEach(item => {
  181. // item['id'] = item['ID']
  182. // });
  183. // resolve(result)
  184. resolve(res)
  185. })
  186. })
  187. };