flow.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import request from '@/utils/request'
  2. const { bpmRunTime, bpmModel } = window.context
  3. export function getTodos(data) {
  4. return request({
  5. url: `${bpmRunTime}/runtime/task/v1/getTodoList`,
  6. method: 'post',
  7. data,
  8. })
  9. }
  10. export function getFillData(data) {
  11. return request({
  12. url: '/flow/todo',
  13. method: 'post',
  14. data,
  15. })
  16. }
  17. export function getStartOften(data) {
  18. return request({
  19. url: '/flow/start/often',
  20. method: 'post',
  21. data,
  22. })
  23. }
  24. //获取审批按钮
  25. export function getApprovalButtons(query, cb) {
  26. const { taskId, leaderId } = query
  27. const url = `${bpmRunTime}/runtime/task/v1/getButtonsBytaskId?taskId=${taskId}&leaderId=${leaderId}&reqParams=`
  28. request.get(url).then((response) => {
  29. cb(response)
  30. })
  31. }
  32. //审批按钮挂起或者取消挂起
  33. export function hangUpOrCancelHangUp(query, cb) {
  34. const { instId, type } = query
  35. const url = `${bpmRunTime}/runtime/instance/v1/${type}?instId=${instId}`
  36. request.get(url).then((response) => {
  37. cb(response)
  38. })
  39. }
  40. //获取流程状态根据defId 实例id,任务id
  41. export function getFlowStatus(query, cb) {
  42. const { instId, taskId } = query
  43. const url = `${bpmRunTime}/runtime/instance/v1/getDefStatus?instId=${instId}&taskId=${taskId}`
  44. request.get(url).then((response) => {
  45. cb(response)
  46. })
  47. }
  48. //获取审批意见通过流程实例id和任务id
  49. export function getBpmSaveOpinionByTeam(instId, taskId, cb) {
  50. const url = `${bpmRunTime}/runtime/task/v1/getBpmSaveOpinionByTeam?instId=${instId}&taskId=${taskId}`
  51. request.get(url).then((response) => {
  52. cb(response)
  53. })
  54. }
  55. //验证当前用户是否有该任务处理权限
  56. export function checkTaskAuth(taskId, cb) {
  57. const url = `${bpmRunTime}/runtime/task/v1/checkTaskAuth?taskId=${taskId}`
  58. return request.get(url)
  59. }
  60. //新增,修改或暂存审批意见
  61. export function savaApprovalComments(data) {
  62. return request({
  63. url: `${bpmRunTime}/runtime/task/v1/createBpmSaveOpinion`,
  64. method: 'post',
  65. data,
  66. })
  67. }
  68. // 根据 taskId 获取任务明细
  69. export function getNotice(taskId) {
  70. const url = `${bpmRunTime}/runtime/task/v1/getNotice?id=${taskId}`
  71. return request.get(url)
  72. }
  73. // 获取流程图
  74. export function getBpmImage(instId, proInstId, defId, cb) {
  75. const url = `${bpmRunTime}/runtime/instance/v1/getBpmImage?taskId=&proInstId=${proInstId}&defId=${defId}&bpmnInstId=${instId}`
  76. request.get(url).then((res) => {
  77. cb(res)
  78. })
  79. }
  80. // 获取流程实例明细
  81. export function instanceFlowImage(data, cb) {
  82. const { instId, nodeId, type, defId } = data
  83. const url = `${bpmRunTime}/runtime/instance/v1/instanceFlowImage?proInstId=${instId}&nodeId=
  84. ${nodeId || ''}&type=${type || ''}&defId=${defId || ''}`
  85. request.get(url).then((res) => {
  86. cb(res)
  87. })
  88. }
  89. // 获取审批意见
  90. export function getNodeOpinions(data, cb) {
  91. const { instId, nodeIds, defId } = data
  92. const url = `${bpmRunTime}/runtime/task/v1/nodeOpinion?instId=${instId}&nodeId=${nodeIds}&defId=${defId}`
  93. request.get(url).then((res) => {
  94. cb(res)
  95. })
  96. }
  97. // 获取我的常用流程
  98. export function getMyOftenFlow() {
  99. const url = `${bpmRunTime}/runtime/instance/v1/getMyOftenFlow`
  100. return request.get(url)
  101. }
  102. // 获取所有流程
  103. export function getHasAuthFlowList(queryFilter = {}) {
  104. const url = `${bpmRunTime}/runtime/instance/v1/getHasAuthFlowList`
  105. return request.post(url, queryFilter)
  106. }
  107. // 保存常用流程
  108. export function saveMyOftenFlow(data) {
  109. const url = `${bpmModel}/bpmModel/BpmOftenFlow/v1/saveMyOftenFlow`
  110. return request.post(url, data)
  111. }
  112. // 当前账号是否有启动该流程的权限
  113. export function flowHasStartRights(defKey) {
  114. const url = `${bpmModel}/flow/def/v1/flowHasStartRights?defKey=${defKey}`
  115. return request.get(url)
  116. }
  117. // 根据当前任务查询是否在第一个节点
  118. export function isTaskFirstNode(taskId) {
  119. return request.get(
  120. `${bpmRunTime}/runtime/task/v1/taskIsFirstNode?taskId=${taskId}`
  121. )
  122. }
  123. // 获取流程全局打印模板
  124. export function getFlowGlobalTemplate(defId) {
  125. return request({
  126. url: `${bpmModel}/flow/wordPrint/v1/getGlobalPrintTemplate?defId=${defId}`,
  127. method: 'get',
  128. })
  129. }
  130. export function getBpmPrintRecordByInstId(instId, nodeId) {
  131. return request({
  132. url: `${bpmRunTime}/runtime/bpmPrintRecord/v1/getByProInstId?procInstId=${instId}&nodeId=${
  133. nodeId || ''
  134. }`,
  135. method: 'get',
  136. })
  137. }
  138. export function getBpmPrintRecord(data) {
  139. return request({
  140. url: `${bpmRunTime}/runtime/bpmPrintRecord/v1/query`,
  141. method: 'post',
  142. data,
  143. })
  144. }
  145. export function getWatermarkByInstId(id){
  146. return request({
  147. url: `${bpmModel}/bpmModel/bpmWatermark/v1/getByInstId?instId=${id}`,
  148. method: 'get',
  149. })
  150. }
  151. export function savePrintRecord(data) {
  152. return request({
  153. url: `${bpmRunTime}/runtime/bpmPrintRecord/v1/printLog`,
  154. data,
  155. method: 'post',
  156. })
  157. }