earlyWarning.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. import request from '@/utils/request'
  2. /**
  3. * 设备预警管理 API
  4. * 数据源:early_warning 预警体系(/warning/*)
  5. * 处置人分配复用新增工单接口:addManholeWorkOrder(basic.js)
  6. */
  7. // 预警综合搜索(名称/编号/类型/级别/状态/位置/发布人/权属单位/时间范围)
  8. export function getWarningSearchData(query) {
  9. return request({
  10. url: '/warning/search',
  11. method: 'get',
  12. params: query
  13. })
  14. }
  15. // 待办预警列表(当前用户)
  16. export function getWarningTodoListData(query) {
  17. return request({
  18. url: '/warning/todo/list',
  19. method: 'get',
  20. params: query
  21. })
  22. }
  23. // 预警完整详情(基本信息+GIS+处置历史+附件+归档+关联报警)
  24. export function getWarningFullDetailData(warningId) {
  25. return request({
  26. url: `/warning/detail/full/${warningId}`,
  27. method: 'get'
  28. })
  29. }
  30. // 发布预警
  31. export function publishWarningData(warningId, data = {}) {
  32. return request({
  33. url: `/warning/publish/${warningId}`,
  34. method: 'post'
  35. , params: data
  36. })
  37. }
  38. export function uploadWarningReportData(warningId, files) {
  39. const data = new FormData()
  40. ;(files || []).forEach(file => data.append('files', file))
  41. return request({ url: `/warning/report/${warningId}`, method: 'post', data })
  42. }
  43. // 接收预警(PENDING → RECEIVED)
  44. export function confirmWarningData(data) {
  45. return request({
  46. url: '/warning/confirm',
  47. method: 'post',
  48. params: data
  49. })
  50. }
  51. export function startWarningProcessData(data) {
  52. return request({
  53. url: '/warning/start-process',
  54. method: 'post',
  55. params: data
  56. })
  57. }
  58. export function misreportWarningData(data) {
  59. return request({
  60. url: '/warning/misreport',
  61. method: 'post',
  62. params: data
  63. })
  64. }
  65. export function submitWarningProcessData(data) {
  66. const formData = new FormData()
  67. formData.append('process', JSON.stringify({
  68. warningId: data.warningId,
  69. processContent: data.processContent
  70. }))
  71. ;(data.files || []).forEach(file => formData.append('files', file))
  72. return request({
  73. url: '/warning/process',
  74. method: 'post',
  75. data: formData
  76. })
  77. }
  78. export function clearWarningData(data) {
  79. return request({
  80. url: '/warning/clear',
  81. method: 'post',
  82. params: data
  83. })
  84. }
  85. export function getWarningSupervisionListData(warningId) {
  86. return request({
  87. url: `/warning/supervision/${warningId}`,
  88. method: 'get'
  89. })
  90. }
  91. // 解除预警(误报/工单完成)
  92. export function resolveWarningData(data) {
  93. return request({
  94. url: '/warning/resolve',
  95. method: 'post',
  96. params: data
  97. })
  98. }
  99. // 预警升级
  100. export function upgradeWarningData(data) {
  101. return request({
  102. url: '/warning/upgrade',
  103. method: 'post',
  104. params: data
  105. })
  106. }
  107. // 预警退回重办
  108. export function returnWarningData(data) {
  109. return request({
  110. url: '/warning/return',
  111. method: 'post',
  112. params: data
  113. })
  114. }
  115. // 预警督办
  116. export function supervisionWarningData(data) {
  117. return request({
  118. url: '/warning/supervision',
  119. method: 'post',
  120. params: data
  121. })
  122. }
  123. // 领导批示
  124. export function instructionWarningData(data) {
  125. return request({
  126. url: '/warning/instruction',
  127. method: 'post',
  128. params: data
  129. })
  130. }
  131. // 处置历史记录
  132. export function getWarningDisposalHistoryData(warningId) {
  133. return request({
  134. url: `/warning/disposal/history/${warningId}`,
  135. method: 'get'
  136. })
  137. }
  138. // 附件列表
  139. export function getWarningAttachmentsData(warningId) {
  140. return request({
  141. url: `/warning/attachments/${warningId}`,
  142. method: 'get'
  143. })
  144. }
  145. export function getWarningAttachmentPreviewData(attachmentId) {
  146. return request({
  147. url: `/warning/attachments/${attachmentId}/preview`,
  148. method: 'get',
  149. responseType: 'blob'
  150. })
  151. }
  152. export function getWarningAttachmentDownloadData(attachmentId) {
  153. return request({
  154. url: `/warning/attachments/${attachmentId}/download`,
  155. method: 'get',
  156. responseType: 'blob'
  157. })
  158. }
  159. // 流程可视化数据(路线图节点+边)
  160. export function getWarningDiagramData(warningId) {
  161. return request({
  162. url: `/warning/diagram/${warningId}`,
  163. method: 'get'
  164. })
  165. }
  166. // 仪表盘统计(总数/类型分布/级别分布/近7天趋势)
  167. export function getWarningDashboardStatisticsData() {
  168. return request({
  169. url: '/warning/dashboard/statistics',
  170. method: 'get'
  171. })
  172. }
  173. // 处置中预警列表
  174. export function getWarningProcessingListData(query) {
  175. return request({
  176. url: '/warning/processing/list',
  177. method: 'get',
  178. params: query
  179. })
  180. }
  181. // 已完成预警列表
  182. export function getWarningCompletedListData(query) {
  183. return request({
  184. url: '/warning/completed/list',
  185. method: 'get',
  186. params: query
  187. })
  188. }
  189. // 预警归档信息
  190. export function getWarningArchiveData(warningId) {
  191. return request({
  192. url: `/warning/archive/${warningId}`,
  193. method: 'get'
  194. })
  195. }
  196. // 修改预警(处理反馈时上传附件:warning JSON + files)
  197. export function updateWarningData(data) {
  198. const formData = new FormData()
  199. const warning = data.warning || {}
  200. if (warning.warningId) {
  201. formData.append('warning', JSON.stringify(warning))
  202. } else {
  203. const { warningId, ...rest } = warning
  204. formData.append('warning', JSON.stringify(rest))
  205. }
  206. formData.append('alarmIds', JSON.stringify(data.alarmIds || []))
  207. ;(data.files || []).forEach((file) => {
  208. formData.append('files', file)
  209. })
  210. return request({
  211. url: '/warning/update',
  212. method: 'put',
  213. data: formData
  214. })
  215. }