ticket.rst 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852
  1. ============
  2. 工单相关接口
  3. ============
  4. ------------
  5. 获取工单列表
  6. ------------
  7. - url
  8. api/v1.0/tickets
  9. - method
  10. get
  11. - 请求参数
  12. .. list-table::
  13. :header-rows: 1
  14. * - 参数名
  15. - 类型
  16. - 必填
  17. - 说明
  18. * - sn
  19. - varchar
  20. - 否
  21. - 流水号,支持根据sn的前几位模糊查询
  22. * - title
  23. - varchar
  24. - 否
  25. - 工单标题,模糊查询
  26. * - create_start
  27. - varchar
  28. - 否
  29. - 创建时间起,如果创建时间起 和创建时间止 都不提供,则只返回最近一年的数据
  30. * - create_end
  31. - varchar
  32. - 否
  33. - 创建时间止,如果创建时间起 和创建时间止 都不提供,则只返回最近一年的数据
  34. * - workflow_ids
  35. - varchar
  36. - 否
  37. - 工作流ids,逗号隔开多个工作流id, 如"1,2,3"
  38. * - state_ids
  39. - varchar
  40. - 否
  41. - 状态ids,逗号隔开多个状态id,如"1,2,3"
  42. * - ticket_ids
  43. - varchar
  44. - 否
  45. - 工单ids, 逗号隔开多个id,如"1,2,3"
  46. * - reverse
  47. - varchar
  48. - 否
  49. - 是否按照创建时间倒序,"0"或者"1",默认倒序
  50. * - page
  51. - int
  52. - 否
  53. - 页码,默认1
  54. * - per_page
  55. - varchar
  56. - 否
  57. - 每页个数,默认10
  58. * - act_state_id
  59. - int
  60. - 否
  61. - 工单的进行状态, 0草稿中(也就是初始状态)、1进行中 2被退回 3被撤回 4已完成 5已关闭
  62. * - parent_ticket_id
  63. - int
  64. - 否
  65. - 父工单id
  66. * - parent_ticket_state_id
  67. - int
  68. - 否
  69. - 父工单状态id
  70. * - category
  71. - varchar
  72. - 是
  73. - 类型('all':所有工单, 'owner':我创建的工单, 'duty':我的待处理工单, 'relation':我的关联工单[包括我新建的、我处理过的、曾经需要我处理过的工单。注意这里只考虑历史状态,工单将来状态的处理人不考虑], 'worked':我处理过的工单)
  74. - 返回数据
  75. ::
  76. {
  77. "msg": "",
  78. "code": 0,
  79. "data": {
  80. "value": [{
  81. "participant_info": {
  82. "participant_type_id": 1,
  83. "participant": "1",
  84. "participant_name": "zhangsan",
  85. "participant_type_name": "个人",
  86. "participant_alias": "张三"
  87. },
  88. "gmt_created": "2018-05-15 07:16:38",
  89. "parent_ticket_state_id": 0,
  90. "state": {
  91. "state_name": "发起人-确认中",
  92. "state_id": 10
  93. },
  94. "creator": "lilei",
  95. "parent_ticket_id": 0,
  96. "title": "vpn申请",
  97. "gmt_modified": "2018-05-22 07:26:54",
  98. "workflow": {
  99. "workflow_name": "vpn申请",
  100. "workflow_id": 2
  101. },
  102. "sn": "loonflow_201805150001",
  103. "id": 17
  104. }],
  105. "total": 1,
  106. "page": 1,
  107. "per_page": 10
  108. }
  109. }
  110. --------
  111. 新建工单
  112. --------
  113. - url
  114. api/v1.0/tickets
  115. - method
  116. post
  117. - 请求参数
  118. .. list-table::
  119. :header-rows: 1
  120. * - 参数名
  121. - 类型
  122. - 必填
  123. - 说明
  124. * - workflow_id
  125. - int
  126. - 是
  127. - 工作流id(工单关联的工作流的id)
  128. * - transition_id
  129. - int
  130. - 是
  131. - 新建工单时候的流转id(通过workflows/{id}/init_state接口可以获取新建工单时允许的transition)
  132. * - parent_ticket_id
  133. - int
  134. - 否
  135. - 父工单的id(用于子工单的逻辑,如果新建的工单是某个工单的子工单需要填写父工单的id)
  136. * - parent_ticket_state_id
  137. - int
  138. - 否
  139. - 父工单的状态(子工单是和父工单的某个状态关联的),如果提供parent_ticket_id,则此参数也必须
  140. * - suggestion
  141. - varchar
  142. - 否
  143. - 处理意见(与处理工单类型,用户在处理工单的时候点击了按钮操作 可以填写附加的一些意见如:麻烦尽快处理)
  144. * - 其他必填字段
  145. - N/A
  146. - 否
  147. - 其他必填字段或可选字段(在配置工作流过程中,会配置工作流初始状态必填和可选的字段。在新建工单时候必须提供必填字段。如请假申请工单,配置了自定义字段请假天数days,工单初始状态也设置了days为必填,那么新建此类工单时候就必选提供days)
  148. - 返回数据
  149. ::
  150. {
  151. "msg": "",
  152. "code": 0,
  153. "data": {
  154. "ticket_id": 1
  155. }
  156. }
  157. ------------
  158. 获取工单详情
  159. ------------
  160. - url
  161. api/v1.0/tickets/{ticket_id}
  162. - method
  163. get
  164. - 请求参数
  165. - 返回数据
  166. ::
  167. {
  168. "code": 0,
  169. "msg": "",
  170. "data": {
  171. "value": {
  172. "workflow_id": 2,
  173. "in_add_node": true,
  174. "gmt_created": "2018-05-15 07:16:38",
  175. "id": 17,
  176. "relation": "guiji,wangwu,lilei",
  177. "title": "vpn\u7533\u8bf72",
  178. "sn": "loonflow_201805150001",
  179. "parent_ticket_id": 0,
  180. "creator": "lilei",
  181. "script_run_last_result": true,
  182. "gmt_modified": "2018-05-22 07:26:54",
  183. "act_state_id": 1,
  184. "multi_all_person": "{}",
  185. "creator_info": {
  186. "email": "lilei@163.com",
  187. "alias": "\u674e\u78ca",
  188. "dept_info": {
  189. "creator_info": {
  190. "creator_id": 1,
  191. "creator_alias": "\u8d85\u7ea7\u7ba1\u7406\u5458"
  192. },
  193. "leader": "lilei",
  194. "parent_dept_info": {
  195. "parent_dept_name": "\u603b\u90e8",
  196. "parent_dept_id": 1
  197. },
  198. "approver_info": [],
  199. "parent_dept_id": 1,
  200. "name": "\u6280\u672f\u90e8",
  201. "is_deleted": false,
  202. "creator": "admin",
  203. "gmt_modified": "2018-05-09 06:45:27",
  204. "label": "",
  205. "id": 2,
  206. "approver": "",
  207. "gmt_created": "2018-04-14 23:37:06",
  208. "leader_info": {
  209. "leader_alias": "\u674e\u78ca",
  210. "leader_username": "lilei"
  211. }
  212. },
  213. "username": "lilei",
  214. "phone": "13888888888",
  215. "is_active": true
  216. },
  217. "participant_type_id": 3,
  218. "state_id": 10,
  219. "is_end": false,
  220. "is_deleted": false,
  221. "field_list": [{
  222. "field_value": "loonflow_201805150001",
  223. "label": {},
  224. "boolean_field_display": {},
  225. "field_type_id": 5,
  226. "field_template": "",
  227. "field_choice": {},
  228. "field_key": "sn",
  229. "field_attribute": 1,
  230. "description": "\u5de5\u5355\u7684\u6d41\u6c34\u53f7",
  231. "default_value": null,
  232. "order_id": 10,
  233. "field_name": "\u6d41\u6c34\u53f7"
  234. }, {
  235. "field_value": "\u53d1\u8d77\u4eba-\u786e\u8ba4\u4e2d",
  236. "label": {},
  237. "boolean_field_display": {},
  238. "field_type_id": 5,
  239. "field_template": "",
  240. "field_choice": {},
  241. "field_key": "state.state_name",
  242. "field_attribute": 1,
  243. "description": "\u5de5\u5355\u5f53\u524d\u72b6\u6001\u7684\u540d\u79f0",
  244. "default_value": null,
  245. "order_id": 41,
  246. "field_name": "\u72b6\u6001\u540d"
  247. }, {
  248. "field_value": "\u603b\u90e8",
  249. "label": {},
  250. "boolean_field_display": {},
  251. "field_type_id": 5,
  252. "field_template": "",
  253. "field_choice": {},
  254. "field_key": "participant_info.participant_name",
  255. "field_attribute": 1,
  256. "description": "\u5de5\u5355\u7684\u5f53\u524d\u5904\u7406\u4eba",
  257. "default_value": null,
  258. "order_id": 50,
  259. "field_name": "\u5f53\u524d\u5904\u7406\u4eba"
  260. }, {
  261. "field_value": "vpn\u7533\u8bf7",
  262. "label": {},
  263. "boolean_field_display": {},
  264. "field_type_id": 5,
  265. "field_template": "",
  266. "field_choice": {},
  267. "field_key": "workflow.workflow_name",
  268. "field_attribute": 1,
  269. "description": "\u5de5\u5355\u6240\u5c5e\u5de5\u4f5c\u6d41\u7684\u540d\u79f0",
  270. "default_value": null,
  271. "order_id": 60,
  272. "field_name": "\u5de5\u4f5c\u6d41\u540d\u79f0"
  273. }],
  274. "parent_ticket_state_id": 0,
  275. "add_node_man": "zhangsan",
  276. "participant": "1",
  277. "state_info": {
  278. "id": 10,
  279. "creator": "admin",
  280. "gmt_created": "2018-04-30 15:47:58",
  281. "gmt_modified": "2018-05-13 11:42:59",
  282. "is_deleted": false,
  283. "name": "\u4eba\u4e8b\u90e8\u95e8-\u5904\u7406\u4e2d",
  284. "workflow_id": 1,
  285. "is_hidden": false,
  286. "order_id": 4,
  287. "type_id": 0,
  288. "enable_retreat": false,
  289. "remember_last_man_enable": false,
  290. "participant_type_id": 1,
  291. "participant": "admin",
  292. "distribute_type_id": 1,
  293. "state_field_str": {
  294. "sn": 1,
  295. "title": 1,
  296. "leave_start": 1,
  297. "leave_end": 1,
  298. "leave_days": 1,
  299. "leave_proxy": 1,
  300. "leave_type": 1,
  301. "creator": 1,
  302. "gmt_created": 1,
  303. "leave_reason": 1
  304. },
  305. "label": {}
  306. }
  307. }
  308. }
  309. }
  310. --------------------
  311. 获取工单可以做的操作
  312. --------------------
  313. - url
  314. api/v1.0/tickets/{ticket_id}/transitions
  315. - method
  316. get
  317. - 请求参数
  318. - 返回数据
  319. ::
  320. {
  321. "msg": "",
  322. "data": {
  323. "value": [
  324. {
  325. "transition_name": "提交",
  326. "field_require_check": true, # 默认为ture,如果此为否时, 不校验表单必填内容
  327. "transition_id": 1,
  328. "is_accept": false, # 不是接单,
  329. "in_add_node": false, # 不处于加签状态下
  330. "enable_alert": false, # 是否弹窗告警,可用于当用户点击此操作的时确定是否弹窗信息
  331. "alert_text": "" # 弹窗中的消息内容
  332. },
  333. {
  334. "transition_name": "保存",
  335. "field_require_check": true, # 默认为ture,如果此为否时, 不校验表单必填内容
  336. "transition_id": 2,
  337. "is_accept": false, # 不是接单,
  338. "in_add_node": false, # 不处于加签状态下
  339. "enable_alert": false, # 是否弹窗告警,可用于当用户点击此操作的时确定是否弹窗信息
  340. "alert_text": "" # 弹窗中的消息内容
  341. }
  342. ]
  343. },
  344. "code": 0
  345. }
  346. 如果当前处理人超过一个人(处理人类型为多人,部门、角色都有可能实际为多个人),且当前状态的分配方式为主动接单,则会要求先接单,返回数据如下。
  347. 处理时需要处理人先接单(点击接单按钮时 调用接单接口).
  348. ::
  349. {
  350. "msg": "",
  351. "code": 0,
  352. "data": {
  353. "value": [
  354. {
  355. "transition_id": 0,
  356. "transition_name": "接单",
  357. "is_accept": true, # 接单,
  358. "in_add_node": false,
  359. "field_require_check": false
  360. }
  361. ]
  362. }
  363. }
  364. 当工单当前处于加签状态下,返回格式如下。 则用户点击“完成”按钮时,需要调用完成加签操作接口
  365. ::
  366. {
  367. "msg": "",
  368. "code": 0,
  369. "data": {
  370. "value": [
  371. {
  372. "transition_id": 0,
  373. "transition_name": "完成",
  374. "is_accept": false,
  375. "in_add_node": true, # 处于加签状态
  376. "field_require_check": false
  377. }
  378. ]
  379. }
  380. }
  381. --------
  382. 接单
  383. --------
  384. - url
  385. api/v1.0/tickets/{ticket_id}/accept
  386. - method
  387. post
  388. - 请求参数
  389. - 使用场景
  390. 使用接口获取工单当前可以做的的操作后,如果data.value.is_accept==true,则需要用户先接单才能处理,即页面显示接单按钮,
  391. 用户点击后调用接单接口,将工单的当前处理人设置该用户
  392. - 返回数据
  393. ::
  394. {
  395. "data": {},
  396. "code": 0,
  397. "msg": ""
  398. }
  399. --------
  400. 转交
  401. --------
  402. - url
  403. api/v1.0/tickets/{ticket_id}/deliver
  404. - method
  405. post
  406. - 请求参数
  407. .. list-table::
  408. :header-rows: 1
  409. * - 参数名
  410. - 类型
  411. - 必填
  412. - 说明
  413. * - target_username
  414. - varchar
  415. - 是
  416. - 转交对象的用户名
  417. * - suggestion
  418. - varchar
  419. - 否
  420. - 转交意见
  421. * - from_admin
  422. - boolß
  423. - 否
  424. - 是否管理员强制转交,此参数用于对应工作流管理员或者超级管理员强制转交工单,传了from_admin,loonflow会校验用户是否是超级管理员或者该工作流的管理员
  425. - 使用场景
  426. 在工单处理界面可以显示一个按钮“转交”,当用户认为当前工单自己处理不了时,可以将工单转交给合适的人处理。 另外作为管理员可以强制(即非工单当前处理人的情况下)将工单转交给别人ß
  427. - 返回数据
  428. ::
  429. {
  430. "data": true,
  431. "code": 0,
  432. "msg": ""
  433. }
  434. --------
  435. 加签
  436. --------
  437. - url
  438. api/v1.0/tickets/{ticket_id}/add_node
  439. - method
  440. post
  441. - 请求参数
  442. .. list-table::
  443. :header-rows: 1
  444. * - 参数名
  445. - 类型
  446. - 必填
  447. - 说明
  448. * - target_username
  449. - varchar
  450. - 是
  451. - 加签对象的用户名
  452. * - suggestion
  453. - varchar
  454. - 否
  455. - 加签意见
  456. - 使用场景
  457. 当用户A提交了一个权限申请工单,达到运维人员处理人中状态,作为运维人员的B在处理过程中发现需要C先处理或者提供一些必要的信息,B才能处理。
  458. 那么B在处理工单界面可以点击”加签“按钮,弹窗中选择C。 系统调用loonflow的加签接口将工单加签给C。C处理完后点击”完成“按钮,
  459. 系统调用loonflow的加签完成接口, 工单处理人将回到B. 那么B就可以按照之前既定流程正常流转下去
  460. - 返回数据
  461. ::
  462. {
  463. "data": {},
  464. "code": 0,
  465. "msg": ""
  466. }
  467. -----------
  468. 加签处理完成
  469. -----------
  470. - url
  471. api/v1.0/tickets/{ticket_id}/add_node_end
  472. - method
  473. post
  474. - 请求参数
  475. .. list-table::
  476. :header-rows: 1
  477. * - 参数名
  478. - 类型
  479. - 必填
  480. - 说明
  481. * - suggestion
  482. - varchar
  483. - 否
  484. - 加签完成意见
  485. - 使用场景
  486. 使用场景 当A将工单加签给B.B在处理工单时候,界面将只显示“完成“按钮,点击后后端调用此接口,将工单基础表中的is_add_node设置为false
  487. - 返回数据
  488. ::
  489. {
  490. "data": {},
  491. "code": 0,
  492. "msg": ""
  493. }
  494. -----------
  495. 处理工单
  496. -----------
  497. - url
  498. api/v1.0/tickets/{ticket_id}
  499. - method
  500. patch
  501. - 请求参数
  502. .. list-table::
  503. :header-rows: 1
  504. * - 参数名
  505. - 类型
  506. - 必填
  507. - 说明
  508. * - transition_id
  509. - int
  510. - 是
  511. - 流转id
  512. * - suggestion
  513. - varchar
  514. - 否
  515. - 处理意见(与处理工单类型,用户在处理工单的时候点击了按钮操作 可以填写附加的一些意见如:麻烦尽快处理)
  516. * - 其他必填字段
  517. - N/A
  518. - 否
  519. - 其他必填字段或可选字段(在配置工作流过程中,会配置工作流每个状态的必填和可选的字段。在处理工单时候必须提供必填字段。如请假申请工单,配置了自定义字段请假天数days,工单初始状态也设置了days为必填,那么处理此类工单时候就必选提供days)。工单详情接口中有当前处理是时必选的字段
  520. - 返回数据
  521. ::
  522. {
  523. "msg": "",
  524. "data": {},
  525. "code": 0
  526. }
  527. ----------------
  528. 获取工单流转记录
  529. ----------------
  530. - url
  531. api/v1.0/tickets/{ticket_id}/flowlogs
  532. - method
  533. get
  534. - 请求参数
  535. .. list-table::
  536. :header-rows: 1
  537. * - 参数名
  538. - 类型
  539. - 必填
  540. - 说明
  541. * - ticket_data
  542. - string
  543. - 否
  544. - 是否返回每个操作时工单的所有字段信息,取值"1"/"0",默认"0"(否)
  545. * - desc
  546. - string
  547. - 否
  548. - 是否按照时间降序返回记录,取值"1"/"0",默认"1"(是)
  549. - 返回数据(ticket_data未传或ticket_data传0)
  550. ::
  551. {
  552. "msg": "",
  553. "data": {
  554. "total": 4,
  555. "value": [
  556. {
  557. "state": {
  558. "state_name": "发起人-确认中",
  559. "state_id": 5
  560. },
  561. "transition": {
  562. "transition_name": "确认完成",
  563. "transition_id": 5,
  564. "attribute_type_id": 3
  565. },
  566. "ticket_id": 1,
  567. "participant_info": {
  568. "participant_email": "lilei@163.com",
  569. "participant_alias": "李磊",
  570. "participant_phone": "13888888888",
  571. "participant": "lilei",
  572. "participant_type_id": 1
  573. },
  574. "gmt_modified": "2018-04-30 15:57:26",
  575. "gmt_created": "2018-04-30 15:56:02",
  576. "suggestion": "已经生效,感谢"
  577. },
  578. {
  579. "state": {
  580. "state_name": "技术人员-处理中",
  581. "state_id": 4
  582. },
  583. "transition": {
  584. "transition_name": "处理完成",
  585. "transition_id": 4
  586. },
  587. "ticket_id": 1,
  588. "participant_info": {
  589. "participant_email": "lilei@163.com",
  590. "participant_alias": "李磊",
  591. "participant_phone": "13888888888",
  592. "participant": "lilei",
  593. "participant_type_id": 1
  594. },
  595. "gmt_modified": "2018-04-30 15:57:14",
  596. "gmt_created": "2018-04-30 15:55:32",
  597. "suggestion": "处理完成"
  598. },
  599. {
  600. "state": {
  601. "state_name": "TL审批中",
  602. "state_id": 3
  603. },
  604. "transition": {
  605. "transition_name": "同意",
  606. "transition_id": 3
  607. },
  608. "ticket_id": 1,
  609. "participant_info": {
  610. "participant_email": "lilei@163.com",
  611. "participant_alias": "李磊",
  612. "participant_phone": "13888888888",
  613. "participant": "lilei",
  614. "participant_type_id": 1
  615. },
  616. "gmt_modified": "2018-04-30 15:57:00",
  617. "gmt_created": "2018-04-30 15:53:19",
  618. "suggestion": "同意处理"
  619. },
  620. {
  621. "state": {
  622. "state_name": "新建中",
  623. "state_id": 1
  624. },
  625. "transition": {
  626. "transition_name": "提交",
  627. "transition_id": 1
  628. },
  629. "ticket_id": 1,
  630. "gmt_modified": "2018-04-30 15:52:35",
  631. "gmt_created": "2018-04-10 17:39:33",
  632. "suggestion": "请尽快处理,谢谢"
  633. }],
  634. "page": 1,
  635. "per_page": 10
  636. },
  637. "code": 0
  638. }
  639. - 返回数据(ticket_data传1)
  640. ::
  641. {
  642. "msg": "",
  643. "data": {
  644. "total": 4,
  645. "value": [{
  646. "state": {
  647. "state_name": "发起人-确认中",
  648. "state_id": 5
  649. },
  650. "transition": {
  651. "transition_name": "确认完成",
  652. "transition_id": 5,
  653. "attribute_type_id": 3
  654. },
  655. "ticket_id": 1,
  656. "participant_info": {
  657. "participant_email": "lilei@163.com",
  658. "participant_alias": "李磊",
  659. "participant_phone": "13888888888",
  660. "participant": "lilei",
  661. "participant_type_id": 1
  662. },
  663. "gmt_modified": "2018-04-30 15:57:26",
  664. "gmt_created": "2018-04-30 15:56:02",
  665. "suggestion": "已经生效,感谢",
  666. "ticket_data": {
  667. "title": "xxx",
  668. "sn": "xxxxx",
  669. "state_id": 1,
  670. "ticket_id": 1,
  671. "gmt_modified": "2018-04-30 15:57:26",
  672. "gmt_created": "2018-04-30 15:56:02",
  673. "xxxx": "....."
  674. }
  675. },
  676. {
  677. "state": {
  678. "state_name": "技术人员-处理中",
  679. "state_id": 4
  680. },
  681. "transition": {
  682. "transition_name": "处理完成",
  683. "transition_id": 4
  684. },
  685. "ticket_id": 1,
  686. "participant_info": {
  687. "participant_email": "lilei@163.com",
  688. "participant_alias": "李磊",
  689. "participant_phone": "13888888888",
  690. "participant": "lilei",
  691. "participant_type_id": 1
  692. },
  693. "gmt_modified": "2018-04-30 15:57:14",
  694. "gmt_created": "2018-04-30 15:55:32",
  695. "suggestion": "处理完成",
  696. "ticket_data": {
  697. "title": "xxx",
  698. "sn": "xxxxx",
  699. "state_id": 1,
  700. "ticket_id": 1,
  701. "gmt_modified": "2018-04-30 15:57:26",
  702. "gmt_created": "2018-04-30 15:56:02",
  703. "xxxx": "....."
  704. }
  705. },
  706. {
  707. "state": {
  708. "state_name": "TL审批中",
  709. "state_id": 3
  710. },
  711. "transition": {
  712. "transition_name": "同意",
  713. "transition_id": 3
  714. },
  715. "ticket_id": 1,
  716. "participant_info": {
  717. "participant_email": "lilei@163.com",
  718. "participant_alias": "李磊",
  719. "participant_phone": "13888888888",
  720. "participant": "lilei",
  721. "participant_type_id": 1
  722. },
  723. "gmt_modified": "2018-04-30 15:57:00",
  724. "gmt_created": "2018-04-30 15:53:19",
  725. "suggestion": "同意处理",
  726. "ticket_data": {
  727. "title": "xxx",
  728. "sn": "xxxxx",
  729. "state_id": 1,
  730. "ticket_id": 1,
  731. "gmt_modified": "2018-04-30 15:57:26",
  732. "gmt_created": "2018-04-30 15:56:02",
  733. "xxxx": "....."
  734. }
  735. },
  736. {
  737. "state": {
  738. "state_name": "新建中",
  739. "state_id": 1
  740. },
  741. "transition": {
  742. "transition_name": "提交",
  743. "transition_id": 1
  744. },
  745. "ticket_id": 1,
  746. "gmt_modified": "2018-04-30 15:52:35",
  747. "gmt_created": "2018-04-10 17:39:33",
  748. "suggestion": "请尽快处理,谢谢",
  749. "ticket_data": {
  750. "title": "xxx",
  751. "sn": "xxxxx",
  752. "state_id": 1,
  753. "ticket_id": 1,
  754. "gmt_modified": "2018-04-30 15:57:26",
  755. "gmt_created": "2018-04-30 15:56:02",
  756. "xxxx": "....."
  757. }
  758. }
  759. ],
  760. "page": 1,
  761. "per_page": 10
  762. },
  763. "code": 0
  764. }
  765. ----------------
  766. 工单处理步骤记录
  767. ----------------
  768. - url
  769. api/v1.0/tickets/{ticket_id}/flowsteps
  770. - method
  771. get
  772. - 请求参数
  773. - 返回数据
  774. ::
  775. {
  776. "data": {
  777. "current_state_id": 2 //工单当前状态id
  778. "value": [{
  779. "state_id": 17,
  780. "state_flow_log_list": [],
  781. "order_id": 0,
  782. "state_name": "test11111"
  783. }, {
  784. "state_id": 18,
  785. "state_flow_log_list": [],
  786. "order_id": 0,
  787. "state_name": "2233222"
  788. }, {
  789. "state_id": 6,
  790. "state_flow_log_list": [{
  791. "gmt_created": "2018-05-15 07:16:38",
  792. "participant_info": {
  793. "participant_alias": "李磊",
  794. "participant_type_id": 1,
  795. "participant": "lilei",
  796. "participant_phone": "13888888888",
  797. "participant_email": "lilei@163.com"
  798. },
  799. "suggestion": "",
  800. "participant": "lilei",
  801. "state_id": 6,
  802. "participant_type_id": 1,
  803. "transition": {
  804. "transition_name": "提交",
  805. "transition_id": 7
  806. },
  807. "id": 32,
  808. "intervene_type_id": 0
  809. }],
  810. "order_id": 1,
  811. "state_name": "发起人-新建中"
  812. }, {
  813. "state_id": 7,
  814. "state_flow_log_list": [{
  815. "gmt_created": "2018-05-15 07:20:40",
  816. "participant_info": {
  817. "participant_alias": "李磊",
  818. "participant_type_id": 1,
  819. "participant": "lilei",
  820. "participant_phone": "13888888888",
  821. "participant_email": "lilei@163.com"
  822. },
  823. "suggestion": "同意申请",
  824. "participant": "lilei",
  825. "state_id": 7,
  826. "participant_type_id": 1,
  827. "transition": {
  828. "transition_name": "同意",
  829. "transition_id": 8
  830. },
  831. "id": 33,
  832. "intervene_type_id": 0
  833. }],
  834. "order_id": 2,
  835. "state_name": "发起人tl-审批中"
  836. }, {
  837. "state_id": 8,
  838. "state_flow_log_list": [{
  839. "gmt_created": "2018-05-16 06:42:00",
  840. "participant_info": {
  841. "participant_alias": "轨迹",
  842. "participant_type_id": 1,
  843. "participant": "guiji",
  844. "participant_phone": "13888888888",
  845. "participant_email": "guiji@163.com"
  846. },
  847. "suggestion": "接单处理",
  848. "participant": "guiji",
  849. "state_id": 8,
  850. "participant_type_id": 1,
  851. "transition": {
  852. "transition_name": "未知操作",
  853. "transition_id": 0
  854. },
  855. "id": 36,
  856. "intervene_type_id": 0
  857. }, {
  858. "gmt_created": "2018-05-16 06:49:55",
  859. "participant_info": {
  860. "participant_alias": "轨迹",
  861. "participant_type_id": 1,
  862. "participant": "guiji",
  863. "participant_phone": "13888888888",
  864. "participant_email": "guiji@163.com"
  865. },
  866. "suggestion": "同意",
  867. "participant": "guiji",
  868. "state_id": 8,
  869. "participant_type_id": 1,
  870. "transition": {
  871. "transition_name": "同意",
  872. "transition_id": 9
  873. },
  874. "id": 37,
  875. "intervene_type_id": 0
  876. }, {
  877. "gmt_created": "2018-05-16 06:57:31",
  878. "participant_info": {
  879. "participant_alias": "轨迹",
  880. "participant_type_id": 1,
  881. "participant": "guiji",
  882. "participant_phone": "13888888888",
  883. "participant_email": "guiji@163.com"
  884. },
  885. "suggestion": "接单处理",
  886. "participant": "guiji",
  887. "state_id": 8,
  888. "participant_type_id": 1,
  889. "transition": {
  890. "transition_name": "未知操作",
  891. "transition_id": 0
  892. },
  893. "id": 38,
  894. "intervene_type_id": 0
  895. }, {
  896. "gmt_created": "2018-05-16 06:57:36",
  897. "participant_info": {
  898. "participant_alias": "轨迹",
  899. "participant_type_id": 1,
  900. "participant": "guiji",
  901. "participant_phone": "13888888888",
  902. "participant_email": "guiji@163.com"
  903. },
  904. "suggestion": "同意",
  905. "participant": "guiji",
  906. "state_id": 8,
  907. "participant_type_id": 1,
  908. "transition": {
  909. "transition_name": "同意",
  910. "transition_id": 9
  911. },
  912. "id": 39,
  913. "intervene_type_id": 0
  914. }, {
  915. "gmt_created": "2018-05-16 06:58:41",
  916. "participant_info": {
  917. "participant_alias": "轨迹",
  918. "participant_type_id": 1,
  919. "participant": "guiji",
  920. "participant_phone": "13888888888",
  921. "participant_email": "guiji@163.com"
  922. },
  923. "suggestion": "同意",
  924. "participant": "guiji",
  925. "state_id": 8,
  926. "participant_type_id": 1,
  927. "transition": {
  928. "transition_name": "同意",
  929. "transition_id": 9
  930. },
  931. "id": 40,
  932. "intervene_type_id": 0
  933. }, {
  934. "gmt_created": "2018-05-16 07:01:53",
  935. "participant_info": {
  936. "participant_alias": "轨迹",
  937. "participant_type_id": 1,
  938. "participant": "guiji",
  939. "participant_phone": "13888888888",
  940. "participant_email": "guiji@163.com"
  941. },
  942. "suggestion": "同意",
  943. "participant": "guiji",
  944. "state_id": 8,
  945. "participant_type_id": 1,
  946. "transition": {
  947. "transition_name": "同意",
  948. "transition_id": 9
  949. },
  950. "id": 41,
  951. "intervene_type_id": 0
  952. }, {
  953. "gmt_created": "2018-05-16 07:03:34",
  954. "participant_info": {
  955. "participant_alias": "轨迹",
  956. "participant_type_id": 1,
  957. "participant": "guiji",
  958. "participant_phone": "13888888888",
  959. "participant_email": "guiji@163.com"
  960. },
  961. "suggestion": "同意",
  962. "participant": "guiji",
  963. "state_id": 8,
  964. "participant_type_id": 1,
  965. "transition": {
  966. "transition_name": "同意",
  967. "transition_id": 9
  968. },
  969. "id": 43,
  970. "intervene_type_id": 0
  971. }, {
  972. "gmt_created": "2018-05-16 07:04:45",
  973. "participant_info": {
  974. "participant_alias": "轨迹",
  975. "participant_type_id": 1,
  976. "participant": "guiji",
  977. "participant_phone": "13888888888",
  978. "participant_email": "guiji@163.com"
  979. },
  980. "suggestion": "同意",
  981. "participant": "guiji",
  982. "state_id": 8,
  983. "participant_type_id": 1,
  984. "transition": {
  985. "transition_name": "同意",
  986. "transition_id": 9
  987. },
  988. "id": 45,
  989. "intervene_type_id": 0
  990. }, {
  991. "gmt_created": "2018-05-16 07:31:29",
  992. "participant_info": {
  993. "participant_alias": "轨迹",
  994. "participant_type_id": 1,
  995. "participant": "guiji",
  996. "participant_phone": "13888888888",
  997. "participant_email": "guiji@163.com"
  998. },
  999. "suggestion": "同意",
  1000. "participant": "guiji",
  1001. "state_id": 8,
  1002. "participant_type_id": 1,
  1003. "transition": {
  1004. "transition_name": "同意",
  1005. "transition_id": 9
  1006. },
  1007. "id": 47,
  1008. "intervene_type_id": 0
  1009. }, {
  1010. "gmt_created": "2018-05-16 23:21:00",
  1011. "participant_info": {
  1012. "participant_alias": "轨迹",
  1013. "participant_type_id": 1,
  1014. "participant": "guiji",
  1015. "participant_phone": "13888888888",
  1016. "participant_email": "guiji@163.com"
  1017. },
  1018. "suggestion": "同意",
  1019. "participant": "guiji",
  1020. "state_id": 8,
  1021. "participant_type_id": 1,
  1022. "transition": {
  1023. "transition_name": "同意",
  1024. "transition_id": 9
  1025. },
  1026. "id": 49,
  1027. "intervene_type_id": 0
  1028. }, {
  1029. "gmt_created": "2018-05-16 23:24:03",
  1030. "participant_info": {
  1031. "participant_alias": "轨迹",
  1032. "participant_type_id": 1,
  1033. "participant": "guiji",
  1034. "participant_phone": "13888888888",
  1035. "participant_email": "guiji@163.com"
  1036. },
  1037. "suggestion": "同意",
  1038. "participant": "guiji",
  1039. "state_id": 8,
  1040. "participant_type_id": 1,
  1041. "transition": {
  1042. "transition_name": "同意",
  1043. "transition_id": 9
  1044. },
  1045. "id": 51,
  1046. "intervene_type_id": 0
  1047. }, {
  1048. "gmt_created": "2018-05-16 23:24:44",
  1049. "participant_info": {
  1050. "participant_alias": "轨迹",
  1051. "participant_type_id": 1,
  1052. "participant": "guiji",
  1053. "participant_phone": "13888888888",
  1054. "participant_email": "guiji@163.com"
  1055. },
  1056. "suggestion": "同意",
  1057. "participant": "guiji",
  1058. "state_id": 8,
  1059. "participant_type_id": 1,
  1060. "transition": {
  1061. "transition_name": "同意",
  1062. "transition_id": 9
  1063. },
  1064. "id": 53,
  1065. "intervene_type_id": 0
  1066. }, {
  1067. "gmt_created": "2018-05-16 23:33:26",
  1068. "participant_info": {
  1069. "participant_alias": "轨迹",
  1070. "participant_type_id": 1,
  1071. "participant": "guiji",
  1072. "participant_phone": "13888888888",
  1073. "participant_email": "guiji@163.com"
  1074. },
  1075. "suggestion": "同意",
  1076. "participant": "guiji",
  1077. "state_id": 8,
  1078. "participant_type_id": 1,
  1079. "transition": {
  1080. "transition_name": "同意",
  1081. "transition_id": 9
  1082. },
  1083. "id": 55,
  1084. "intervene_type_id": 0
  1085. }],
  1086. "order_id": 3,
  1087. "state_name": "运维人员-审批中"
  1088. }, {
  1089. "state_id": 9,
  1090. "state_flow_log_list": [{
  1091. "gmt_created": "2018-05-16 07:01:54",
  1092. "participant_info": {
  1093. "participant_phone": "",
  1094. "participant_alias": "demo_script.py",
  1095. "participant_email": "",
  1096. "participant_type_id": 6,
  1097. "participant": "demo_script.py"
  1098. },
  1099. "suggestion": "False\n",
  1100. "participant": "demo_script.py",
  1101. "state_id": 9,
  1102. "participant_type_id": 6,
  1103. "transition": {
  1104. "transition_name": "脚本执行完成",
  1105. "transition_id": 10
  1106. },
  1107. "id": 42,
  1108. "intervene_type_id": 0
  1109. }, {
  1110. "gmt_created": "2018-05-16 07:03:34",
  1111. "participant_info": {
  1112. "participant_phone": "",
  1113. "participant_alias": "demo_script.py",
  1114. "participant_email": "",
  1115. "participant_type_id": 6,
  1116. "participant": "demo_script.py"
  1117. },
  1118. "suggestion": "False\n",
  1119. "participant": "demo_script.py",
  1120. "state_id": 9,
  1121. "participant_type_id": 6,
  1122. "transition": {
  1123. "transition_name": "脚本执行完成",
  1124. "transition_id": 10
  1125. },
  1126. "id": 44,
  1127. "intervene_type_id": 0
  1128. }, {
  1129. "gmt_created": "2018-05-16 07:04:45",
  1130. "participant_info": {
  1131. "participant_phone": "",
  1132. "participant_alias": "demo_script.py",
  1133. "participant_email": "",
  1134. "participant_type_id": 6,
  1135. "participant": "demo_script.py"
  1136. },
  1137. "suggestion": "False\n",
  1138. "participant": "demo_script.py",
  1139. "state_id": 9,
  1140. "participant_type_id": 6,
  1141. "transition": {
  1142. "transition_name": "脚本执行完成",
  1143. "transition_id": 10
  1144. },
  1145. "id": 46,
  1146. "intervene_type_id": 0
  1147. }, {
  1148. "gmt_created": "2018-05-16 07:31:29",
  1149. "participant_info": {
  1150. "participant_phone": "",
  1151. "participant_alias": "demo_script.py",
  1152. "participant_email": "",
  1153. "participant_type_id": 6,
  1154. "participant": "demo_script.py"
  1155. },
  1156. "suggestion": "lilei\n",
  1157. "participant": "demo_script.py",
  1158. "state_id": 9,
  1159. "participant_type_id": 6,
  1160. "transition": {
  1161. "transition_name": "脚本执行完成",
  1162. "transition_id": 10
  1163. },
  1164. "id": 48,
  1165. "intervene_type_id": 0
  1166. }, {
  1167. "gmt_created": "2018-05-16 23:21:00",
  1168. "participant_info": {
  1169. "participant_phone": "",
  1170. "participant_alias": "demo_script.py",
  1171. "participant_email": "",
  1172. "participant_type_id": 6,
  1173. "participant": "demo_script.py"
  1174. },
  1175. "suggestion": "lilei\n",
  1176. "participant": "demo_script.py",
  1177. "state_id": 9,
  1178. "participant_type_id": 6,
  1179. "transition": {
  1180. "transition_name": "脚本执行完成",
  1181. "transition_id": 10
  1182. },
  1183. "id": 50,
  1184. "intervene_type_id": 0
  1185. }, {
  1186. "gmt_created": "2018-05-16 23:24:03",
  1187. "participant_info": {
  1188. "participant_phone": "",
  1189. "participant_alias": "demo_script.py",
  1190. "participant_email": "",
  1191. "participant_type_id": 6,
  1192. "participant": "demo_script.py"
  1193. },
  1194. "suggestion": "lilei\n",
  1195. "participant": "demo_script.py",
  1196. "state_id": 9,
  1197. "participant_type_id": 6,
  1198. "transition": {
  1199. "transition_name": "脚本执行完成",
  1200. "transition_id": 10
  1201. },
  1202. "id": 52,
  1203. "intervene_type_id": 0
  1204. }, {
  1205. "gmt_created": "2018-05-16 23:24:44",
  1206. "participant_info": {
  1207. "participant_phone": "",
  1208. "participant_alias": "demo_script.py",
  1209. "participant_email": "",
  1210. "participant_type_id": 6,
  1211. "participant": "demo_script.py"
  1212. },
  1213. "suggestion": "lilei\n",
  1214. "participant": "demo_script.py",
  1215. "state_id": 9,
  1216. "participant_type_id": 6,
  1217. "transition": {
  1218. "transition_name": "脚本执行完成",
  1219. "transition_id": 10
  1220. },
  1221. "id": 54,
  1222. "intervene_type_id": 0
  1223. }, {
  1224. "gmt_created": "2018-05-16 23:33:26",
  1225. "participant_info": {
  1226. "participant_phone": "",
  1227. "participant_alias": "demo_script.py",
  1228. "participant_email": "",
  1229. "participant_type_id": 6,
  1230. "participant": "demo_script.py"
  1231. },
  1232. "suggestion": "lilei\n",
  1233. "participant": "demo_script.py",
  1234. "state_id": 9,
  1235. "participant_type_id": 6,
  1236. "transition": {
  1237. "transition_name": "脚本执行完成",
  1238. "transition_id": 10
  1239. },
  1240. "id": 56,
  1241. "intervene_type_id": 0
  1242. }],
  1243. "order_id": 4,
  1244. "state_name": "授权脚本-自动执行中"
  1245. }, {
  1246. "state_id": 10,
  1247. "state_flow_log_list": [{
  1248. "gmt_created": "2018-05-17 06:45:58",
  1249. "participant_info": {
  1250. "participant_alias": "李磊",
  1251. "participant_type_id": 1,
  1252. "participant": "lilei",
  1253. "participant_phone": "13888888888",
  1254. "participant_email": "lilei@163.com"
  1255. },
  1256. "suggestion": "请处理",
  1257. "participant": "lilei",
  1258. "state_id": 10,
  1259. "participant_type_id": 1,
  1260. "transition": {
  1261. "transition_name": "转交操作",
  1262. "transition_id": 0
  1263. },
  1264. "id": 57,
  1265. "intervene_type_id": 1
  1266. }, {
  1267. "gmt_created": "2018-05-17 06:47:46",
  1268. "participant_info": {
  1269. "participant_alias": "张三",
  1270. "participant_type_id": 1,
  1271. "participant": "zhangsan",
  1272. "participant_phone": "13888888888",
  1273. "participant_email": "zhangsan@163.com"
  1274. },
  1275. "suggestion": "请协助处理",
  1276. "participant": "zhangsan",
  1277. "state_id": 10,
  1278. "participant_type_id": 1,
  1279. "transition": {
  1280. "transition_name": "加签操作",
  1281. "transition_id": 0
  1282. },
  1283. "id": 58,
  1284. "intervene_type_id": 2
  1285. }],
  1286. "order_id": 6,
  1287. "state_name": "发起人-确认中"
  1288. }, {
  1289. "state_id": 11,
  1290. "state_flow_log_list": [],
  1291. "order_id": 7,
  1292. "state_name": "结束"
  1293. }]
  1294. },
  1295. "msg": "",
  1296. "code": 0
  1297. }
  1298. ----------------
  1299. 修改工单状态
  1300. ----------------
  1301. - url
  1302. api/v1.0/tickets/{ticket_id}/state
  1303. - method
  1304. put
  1305. - 请求参数
  1306. .. list-table::
  1307. :header-rows: 1
  1308. * - 参数名
  1309. - 类型
  1310. - 必填
  1311. - 说明
  1312. * - state_id
  1313. - int
  1314. - 是
  1315. - 目标状态id
  1316. * - suggestion
  1317. - varchar
  1318. - 否
  1319. - 处理意见
  1320. - 使用场景
  1321. 用于干预工单的当前状态,可以直接将工单状态修改为指定状态,系统会根据state_id获取对应的处理人信息
  1322. - 返回格式
  1323. ::
  1324. {
  1325. "msg": "",
  1326. "data": {},
  1327. "code": 0
  1328. }
  1329. ----------------
  1330. 批量获取工单状态
  1331. ----------------
  1332. - url
  1333. api/v1.0/tickets/states
  1334. - method
  1335. get
  1336. - 请求参数
  1337. .. list-table::
  1338. :header-rows: 1
  1339. * - 参数名
  1340. - 类型
  1341. - 必填
  1342. - 说明
  1343. * - ticket_ids
  1344. - varchar
  1345. - 是
  1346. - 工单ids,逗号隔开的字符串
  1347. - 使用场景
  1348. 调用方自己保存工单基础信息 并根据loonflow中工单id关联,在显示工单列表时直接从自己后端获取工单列表。 但是工单状态需要实时从loonflow中获取,那么可以
  1349. 通过此接口获取一页工单列表每个工单的状态
  1350. - 返回数据
  1351. ::
  1352. {
  1353. "code": 0,
  1354. "data": {
  1355. "1": {
  1356. "state_id": 1,
  1357. "state_name": "发起人-编辑中"
  1358. },
  1359. 2: {
  1360. "state_id": 2,
  1361. "state_name": "新建中"
  1362. }
  1363. },
  1364. "msg": ""
  1365. }
  1366. ----------------
  1367. 修改工单字段的值
  1368. ----------------
  1369. - url
  1370. api/v1.0/tickets/{ticket_id}/fields
  1371. - method
  1372. patch
  1373. - 请求参数
  1374. .. list-table::
  1375. :header-rows: 1
  1376. * - 参数名
  1377. - 类型
  1378. - 必填
  1379. - 说明
  1380. * - 需要修改值的字段的key1
  1381. - varchar
  1382. - 是
  1383. - 如需要修改标题,则就是title
  1384. * - 需要修改值的字段的key2
  1385. - varchar
  1386. - 是
  1387. - 如需要修改标题,则就是title
  1388. * - 其他需要修改的字段的字段标识
  1389. - varchar
  1390. - 是
  1391. - 如需要修改标题,则就是title
  1392. - 返回数据
  1393. ::
  1394. {
  1395. "msg": "",
  1396. "data": {},
  1397. "code": 0
  1398. }
  1399. --------------------
  1400. 重试工单脚本/hook任务
  1401. --------------------
  1402. - url
  1403. api/v1.0/tickets/{ticket_id}/retry_script
  1404. - method
  1405. post
  1406. - 请求参数
  1407. - 使用场景
  1408. 当工单的脚本(或者hook[v0.3.17版本支持])执行失败后,工单详情接口中获取的数据中script_run_last_result为false.
  1409. 这时可以在工单详情界面 step图中此状态下显示有个”重试按钮“,用户点击此按钮后,可以调用此接口重新执行或重新触发hook
  1410. - 返回数据
  1411. ::
  1412. {
  1413. "msg": "Ticket script or hook retry start successful",
  1414. "data": {},
  1415. "code": 0
  1416. }
  1417. --------------------
  1418. 新增工单评论/注释
  1419. --------------------
  1420. - url
  1421. api/v1.0/tickets/{ticket_id}/comments
  1422. - method
  1423. post
  1424. - 请求参数
  1425. .. list-table::
  1426. :header-rows: 1
  1427. * - 参数名
  1428. - 类型
  1429. - 必填
  1430. - 说明
  1431. * - suggestion
  1432. - varchar
  1433. - 是
  1434. - 处理意见(与处理工单类型,用户在处理工单的时候点击了按钮操作 可以填写附加的一些意见如:麻烦尽快处理)
  1435. - 返回数据
  1436. ::
  1437. {
  1438. "code": 0,
  1439. "msg": "",
  1440. "data": {}
  1441. }
  1442. --------------------
  1443. 工单hook回调
  1444. --------------------
  1445. - url
  1446. api/v1.0/tickets/{ticket_id}/hook_call_back
  1447. - method
  1448. post
  1449. - 请求参数
  1450. .. list-table::
  1451. :header-rows: 1
  1452. * - 参数名
  1453. - 类型
  1454. - 必填
  1455. - 说明
  1456. * - result
  1457. - boolean
  1458. - 是
  1459. - hook任务执行是否成功, false, true
  1460. * - msg
  1461. - varchar
  1462. - 是
  1463. - hook执行输出信息,可留空''
  1464. * - field_value
  1465. - dict object
  1466. - 否
  1467. - 需要修改值的字段. 这些字段需要在状态表单设置中为可选或者必填
  1468. - 使用场景
  1469. 当工作流状态设置处理人类型为hook,工单到达此状态时,会触发hook请求,被请求方可以执行一些操作,执行完成后回调用loonflow,
  1470. 告知loonflow任务执行结果,以触发loonflow中工单状态的流转(当hook配置中wait为false时,无需回调,hook发出后会立即触发流转,wait为true会等待
  1471. 回调)。回调参数如果result为false,那么loonflow会标记该工单的script_run_last_result为False(获取工单详情接口也会返回此标识,前端可以根据这
  1472. 个标识来显示一个重试的按钮,用户点击这个重试按钮后调用"重试工单脚本/hook任务"接口),同时也会将msg(你可以传失败的原因)中的内容记录到工单流转记录中。
  1473. - 返回数据
  1474. ::
  1475. {
  1476. "code": 0,
  1477. "msg": "",
  1478. "data": {}
  1479. }
  1480. --------------------
  1481. 工单当前的参与人详情
  1482. --------------------
  1483. - url
  1484. api/v1.0/tickets/{ticket_id}/participant_info
  1485. - method
  1486. get
  1487. - 使用场景
  1488. 此接口将返回该工单当前的参与人详细信息,如果是部门或角色会返回对应部门角色下所有用户。调用方可基于此提供工单催办的功能。
  1489. 用户在前端点击催办按钮,前端弹窗要求用户选择通知的类型:短信、邮件、微信、钉钉等等 以及需要的备注信息,
  1490. 然后调用方后端发送相应的通知消息给工单的当前处理人
  1491. - 返回数据
  1492. ::
  1493. {
  1494. "msg": "",
  1495. "data": {
  1496. "participant_info_list": [{
  1497. "alias": "\u8d85\u7ea7\u7ba1\u7406\u5458",
  1498. "username": "admin",
  1499. "phone": "13888888888",
  1500. "email": "blackholll@163.com"
  1501. }, {
  1502. "alias": "\u8f68\u8ff9",
  1503. "username": "guiji",
  1504. "phone": "13888888888",
  1505. "email": "guiji@163.com"
  1506. }, {
  1507. "alias": "\u674e\u78ca",
  1508. "username": "lilei",
  1509. "phone": "13888888888",
  1510. "email": "lilei@163.com"
  1511. }, {
  1512. "alias": "\u5f20\u4e09",
  1513. "username": "zhangsan",
  1514. "phone": "13888888888",
  1515. "email": "zhangsan@163.com"
  1516. }, {
  1517. "alias": "\u674e\u56db",
  1518. "username": "lisi",
  1519. "phone": "13888888888",
  1520. "email": "lisi@163.com"
  1521. }, {
  1522. "alias": "\u738b\u4e94",
  1523. "username": "wangwu",
  1524. "phone": "13888888888",
  1525. "email": "wangwu@163.com"
  1526. }, {
  1527. "alias": "\u6770\u514b",
  1528. "username": "jack",
  1529. "phone": "13888888888",
  1530. "email": "jack@163.com"
  1531. }],
  1532. "participant_username_list": ["admin", "guiji", "lilei", "zhangsan", "lisi", "wangwu", "jack"]
  1533. },
  1534. "code": 0
  1535. }
  1536. --------------------
  1537. 强制关闭工单
  1538. --------------------
  1539. - url
  1540. api/v1.0/tickets/{ticket_id}/close
  1541. - method
  1542. post
  1543. - 请求参数
  1544. .. list-table::
  1545. :header-rows: 1
  1546. * - 参数名
  1547. - 类型
  1548. - 必填
  1549. - 说明
  1550. * - suggestion
  1551. - varchar
  1552. - 否
  1553. - 关闭原因
  1554. - 使用场景
  1555. 超级管理员在查看工单详情时,可以在界面上显示一个强制关闭工单的按钮,点击后调用关闭工单按钮,实现强制关闭工单。
  1556. 另外工单创建人在工单处于初始状态下(创建人撤回、退回到初始状态等情况工单状态会处于初始状态)也可以强制关闭工单。
  1557. - 返回数据
  1558. ::
  1559. {
  1560. "code": 0,
  1561. "msg": "",
  1562. "data": {}
  1563. }
  1564. --------------------
  1565. 撤回工单
  1566. --------------------
  1567. - url
  1568. api/v1.0/tickets/{ticket_id}/retreat
  1569. - method
  1570. post
  1571. - 请求参数
  1572. .. list-table::
  1573. :header-rows: 1
  1574. * - 参数名
  1575. - 类型
  1576. - 必填
  1577. - 说明
  1578. * - suggestion
  1579. - varchar
  1580. - 否
  1581. - 撤回原因
  1582. - 使用场景
  1583. 在配置工作流状态时,可以指定某些状态下允许创建人撤回工单,那么当工单处于这些状态时,创建人可以撤回该工单(调用方前端在这个情况下显示一个撤回按钮)
  1584. - 返回数据
  1585. ::
  1586. {
  1587. "code": 0,
  1588. "msg": "",
  1589. "data": {}
  1590. }