2
0

workflow.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. ==============
  2. 工作流相关接口
  3. ==============
  4. --------------
  5. 获取工作流列表
  6. --------------
  7. - url
  8. api/v1.0/workflows
  9. - method
  10. get
  11. - 使用场景
  12. 获取到工作流列表后,用户选择对应的工作流来新建对应的工单。如果需要多级类型,可以在调用方系统保存对应关系。
  13. 如调用方的“权限申请-VPN权限申请“对应loonflow中id为1的workflow,调用方的“权限申请-服务器权限申请“对应loonflow中id为2的workflow
  14. - 请求参数
  15. .. list-table::
  16. :header-rows: 1
  17. * - 参数名
  18. - 类型
  19. - 必填
  20. - 说明
  21. * - page
  22. - int
  23. - 否
  24. - 页码,默认1
  25. * - per_page
  26. - int
  27. - 否
  28. - 每页个数,默认10
  29. * - name
  30. - varchar
  31. - 否
  32. - 支持根据workflow name模糊查询
  33. - 返回数据
  34. ::
  35. {
  36. "code": 0,
  37. "data": {
  38. "total": 2,
  39. "page": 1,
  40. "per_page": 10,
  41. "value": [{
  42. "name": "请假申请",
  43. "creator": "admin",
  44. "description": "请假申请",
  45. "gmt_created": "2018-04-23 20:49:32"
  46. }, {
  47. "name": "vpn申请",
  48. "creator": "admin",
  49. "description": "vpn权限申请",
  50. "gmt_created": "2018-05-06 12:32:36"
  51. }]
  52. },
  53. "msg": ""
  54. }
  55. -----------------
  56. 获取工作流初始状态
  57. -----------------
  58. - url
  59. api/v1.0/workflows/{workflow_id}/init_state
  60. - method
  61. get
  62. - 请求参数
  63. - 使用场景
  64. 用于获取创建工单时对应工作流的初始状态信息,返回内容包括创建工单时需要填写的表单内容,可以执行的提交操作
  65. - 返回数据
  66. ::
  67. {
  68. "msg": "",
  69. "code": 0,
  70. "data": {
  71. "order_id": 0,
  72. "workflow_id": 1,
  73. "name": "新建中",
  74. "participant_type_id": 1,
  75. "distribute_type_id": 1,
  76. "participant": "wangfei",
  77. "is_hidden": false,
  78. "type_id": 1,
  79. "gmt_created": "2018-04-23 20:53:33",
  80. "id": 1,
  81. "transition": [{
  82. "transition_id": 1,
  83. "transition_name": "提交"
  84. }, {
  85. "transition_id": 2,
  86. "transition_name": "保存"
  87. }],
  88. "sub_workflow_id": 0,
  89. "creator": "admin",
  90. "label": {},
  91. "field_list": [{
  92. "order_id": 20,
  93. "field_key": "title",
  94. "field_attribute": 2,
  95. "value": null,
  96. "name": "标题",
  97. "field_type_id": 5
  98. }, {
  99. "order_id": 35,
  100. "field_key": "leave_proxy",
  101. "field_attribute": 2,
  102. "field_type_id": 60,
  103. "field_value": null,
  104. "field_name": "代理人",
  105. "field_choice": {}
  106. }, {
  107. "order_id": 25,
  108. "field_key": "leave_end",
  109. "field_attribute": 2,
  110. "field_type_id": 30,
  111. "field_value": null,
  112. "field_name": "结束时间",
  113. "field_choice": {}
  114. }, {
  115. "order_id": 20,
  116. "field_key": "leave_start",
  117. "field_attribute": 2,
  118. "field_type_id": 30,
  119. "field_value": null,
  120. "field_name": "开始时间",
  121. "field_choice": {}
  122. }, {
  123. "order_id": 40,
  124. "field_key": "leave_type",
  125. "field_attribute": 2,
  126. "field_type_id": 40,
  127. "field_value": null,
  128. "field_name": "请假类型",
  129. "field_choice": {
  130. "1": "年假",
  131. "2": "调休",
  132. "3": "病假",
  133. "4": "婚假"
  134. }
  135. }, {
  136. "order_id": 45,
  137. "field_key": "leave_reason",
  138. "field_attribute": 2,
  139. "field_type_id": 55,
  140. "field_value": null,
  141. "field_name": "请假原因及相关附件",
  142. "field_choice": {}
  143. }, {
  144. "order_id": 30,
  145. "field_key": "leave_days",
  146. "field_attribute": 2,
  147. "field_type_id": 5,
  148. "field_value": null,
  149. "field_name": "请假天数(0.5的倍数)",
  150. "field_choice": {}
  151. }]
  152. }
  153. }
  154. ----------------
  155. 获取工作流状态详情
  156. ----------------
  157. - url
  158. api/v1.0/workflows/states/{state_id}
  159. - method
  160. get
  161. - 请求参数
  162. - 使用场景
  163. - 返回数据
  164. ::
  165. {
  166. "code": 0,
  167. "data": {
  168. "id": 1,
  169. "name": "\u65b0\u5efa\u4e2d",
  170. "workflow_id": 1,
  171. "sub_workflow_id": 0,
  172. "distribute_type_id": 1,
  173. "is_hidden": false,
  174. "order_id": 0,
  175. "type_id": 1,
  176. "participant_type_id": 1,
  177. "participant": "wangfei",
  178. "state_field": {
  179. "title": 2,
  180. "leave_start": 2,
  181. "leave_end": 2,
  182. "leave_days": 2,
  183. "leave_proxy": 2,
  184. "leave_type": 2,
  185. "leave_reason": 2
  186. },
  187. "label": {},
  188. "creator": "admin",
  189. "gmt_created": "2018-04-23 20:53:33"
  190. },
  191. "msg": ""
  192. }
  193. ---------------
  194. 获取工作流状态列表
  195. ---------------
  196. - url
  197. api/v1.0/workflows/{workflow_id}/states
  198. - method
  199. get
  200. - 使用场景
  201. 可用于用户查询工单列表时选择工作流类型后,显示该工作流类型拥有的状态,然后可以再根据工单当前状态来查询。 另外可用于管理员干预工单强制修改状态时 允许选择的目标状态
  202. - 返回数据
  203. ::
  204. {
  205. "code": 0,
  206. "data": {
  207. "value": [{
  208. "id": 1,
  209. "creator": "admin",
  210. "gmt_created": "2018-04-23 20:53:33",
  211. "gmt_modified": "2018-05-13 11:42:11",
  212. "is_deleted": false,
  213. "name": "\u65b0\u5efa\u4e2d",
  214. "workflow_id": 1,
  215. "sub_workflow_id": 0,
  216. "is_hidden": false,
  217. "order_id": 0,
  218. "type_id": 1,
  219. "remember_last_man_enable": false,
  220. "participant_type_id": 1,
  221. "participant": "wangfei",
  222. "distribute_type_id": 1,
  223. "state_field_str": {
  224. "title": 2,
  225. "leave_start": 2,
  226. "leave_end": 2,
  227. "leave_days": 2,
  228. "leave_proxy": 2,
  229. "leave_type": 2,
  230. "leave_reason": 2
  231. },
  232. "label": {},
  233. "participant_info": {
  234. "participant": "wangfei",
  235. "participant_name": "wangfei",
  236. "participant_type_id": 1,
  237. "participant_type_name": "\u4e2a\u4eba",
  238. "participant_alias": "wangfei"
  239. }
  240. }, {
  241. "id": 2,
  242. "creator": "admin",
  243. "gmt_created": "2018-04-30 15:45:48",
  244. "gmt_modified": "2018-05-14 06:44:10",
  245. "is_deleted": false,
  246. "name": "\u53d1\u8d77\u4eba-\u7f16\u8f91\u4e2d1",
  247. "workflow_id": 1,
  248. "sub_workflow_id": 2,
  249. "is_hidden": true,
  250. "order_id": 2,
  251. "type_id": 0,
  252. "remember_last_man_enable": false,
  253. "participant_type_id": 5,
  254. "participant": "creator",
  255. "distribute_type_id": 1,
  256. "state_field_str": {
  257. "leave_end": 3,
  258. "leave_days": 3,
  259. "sn": 1,
  260. "state.state_name": 1,
  261. "leave_proxy": 3,
  262. "title": 3,
  263. "gmt_created": 1,
  264. "creator": 1,
  265. "leave_start": 3,
  266. "leave_reason": 3,
  267. "leave_type": 3
  268. },
  269. "label": {},
  270. "participant_info": {
  271. "participant": "creator",
  272. "participant_name": "creator",
  273. "participant_type_id": 5,
  274. "participant_type_name": "\u53d8\u91cf",
  275. "participant_alias": "\u5de5\u5355\u521b\u5efa\u4eba"
  276. }
  277. }, {
  278. "id": 3,
  279. "creator": "admin",
  280. "gmt_created": "2018-04-30 15:46:42",
  281. "gmt_modified": "2018-11-27 07:20:33",
  282. "is_deleted": false,
  283. "name": "TL\u5ba1\u6279\u4e2d",
  284. "workflow_id": 1,
  285. "sub_workflow_id": 0,
  286. "is_hidden": false,
  287. "order_id": 3,
  288. "type_id": 0,
  289. "remember_last_man_enable": true,
  290. "participant_type_id": 5,
  291. "participant": "creator_tl",
  292. "distribute_type_id": 3,
  293. "state_field_str": {
  294. "leave_reason": 1,
  295. "leave_start": 1,
  296. "leave_type": 1,
  297. "creator": 1,
  298. "gmt_created": 1,
  299. "title": 1,
  300. "leave_proxy": 1,
  301. "sn": 1,
  302. "leave_end": 1,
  303. "leave_days": 1
  304. },
  305. "label": {
  306. "tech_er_in": "qa"
  307. },
  308. "participant_info": {
  309. "participant": "creator_tl",
  310. "participant_name": "creator_tl",
  311. "participant_type_id": 5,
  312. "participant_type_name": "\u53d8\u91cf",
  313. "participant_alias": "\u5de5\u5355\u521b\u5efa\u4eba\u7684tl"
  314. }
  315. }, {
  316. "id": 4,
  317. "creator": "admin",
  318. "gmt_created": "2018-04-30 15:47:58",
  319. "gmt_modified": "2018-05-13 11:42:59",
  320. "is_deleted": false,
  321. "name": "\u4eba\u4e8b\u90e8\u95e8-\u5904\u7406\u4e2d",
  322. "workflow_id": 1,
  323. "sub_workflow_id": 0,
  324. "is_hidden": false,
  325. "order_id": 4,
  326. "type_id": 0,
  327. "remember_last_man_enable": false,
  328. "participant_type_id": 1,
  329. "participant": "admin",
  330. "distribute_type_id": 1,
  331. "state_field_str": {
  332. "sn": 1,
  333. "title": 1,
  334. "leave_start": 1,
  335. "leave_end": 1,
  336. "leave_days": 1,
  337. "leave_proxy": 1,
  338. "leave_type": 1,
  339. "creator": 1,
  340. "gmt_created": 1,
  341. "leave_reason": 1
  342. },
  343. "label": {},
  344. "participant_info": {
  345. "participant": "admin",
  346. "participant_name": "admin",
  347. "participant_type_id": 1,
  348. "participant_type_name": "\u4e2a\u4eba",
  349. "participant_alias": "\u8d85\u7ea7\u7ba1\u7406\u5458"
  350. }
  351. }, {
  352. "id": 5,
  353. "creator": "admin",
  354. "gmt_created": "2018-04-30 15:51:41",
  355. "gmt_modified": "2018-05-11 06:52:39",
  356. "is_deleted": false,
  357. "name": "\u7ed3\u675f",
  358. "workflow_id": 1,
  359. "sub_workflow_id": 0,
  360. "is_hidden": false,
  361. "order_id": 6,
  362. "type_id": 2,
  363. "remember_last_man_enable": false,
  364. "participant_type_id": 0,
  365. "participant": "",
  366. "distribute_type_id": 1,
  367. "state_field_str": {},
  368. "label": {},
  369. "participant_info": {
  370. "participant": "",
  371. "participant_name": "",
  372. "participant_type_id": 0,
  373. "participant_type_name": "",
  374. "participant_alias": ""
  375. }
  376. }],
  377. "per_page": 10,
  378. "page": 1,
  379. "total": 5
  380. },
  381. "msg": ""
  382. }