黄陂项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.8 KiB

2 months ago
  1. import request from '@/utils/request'
  2. import qs from 'qs'
  3. export function getSupplier() {
  4. return request({
  5. url: 'api/supplier/dropdown-list',
  6. method: 'get'
  7. })
  8. }
  9. export function add(data) {
  10. const url = getUrl(data, 'add')
  11. return request({
  12. url: url,
  13. method: 'post',
  14. data
  15. })
  16. }
  17. export function del(data) {
  18. return request({
  19. url: '/api/device/delete',
  20. method: 'delete',
  21. data
  22. })
  23. }
  24. export function edit(data) {
  25. const url = getUrl(data, 'edit')
  26. return request({
  27. url: url,
  28. method: 'put',
  29. data
  30. })
  31. }
  32. export function getDeviceType() {
  33. return request({
  34. url: 'api/device/type',
  35. method: 'get'
  36. })
  37. }
  38. export function getDeviceById(params) {
  39. return request({
  40. url: 'api/device/state',
  41. method: 'get',
  42. params
  43. })
  44. }
  45. export function getDesecabinetById(params) {
  46. return request({
  47. url: 'api/desecabinet/query',
  48. method: 'get',
  49. params
  50. })
  51. }
  52. export function getRotarycabinetById(params) {
  53. return request({
  54. url: 'api/rotarycabinet/query',
  55. method: 'get',
  56. params
  57. })
  58. }
  59. function getUrl(data, optTYpe) {
  60. let url = 'api/desecabinet/'
  61. if (data.deviceTypeId.name === '密集架') {
  62. url = 'api/desecabinet/'
  63. } else if (data.deviceTypeId.name === '回转柜') {
  64. url = 'api/rotarycabinet/'
  65. } else if (data.deviceTypeId.name === '摄像头') {
  66. url = 'api/camera/'
  67. } else if (data.deviceTypeId.name === '空调' || data.deviceTypeId.name === '桌面式RFID读写器' || data.deviceTypeId.name === '盘点机' || data.deviceTypeId.name === '恒湿机' || data.deviceTypeId.name === '漏水传感器' || data.deviceTypeId.name === '温湿度感应器' || data.deviceTypeId.name === '空气质量检测设备' || data.deviceTypeId.name === '漏水传感器') {
  68. url = 'api/insidedevices/'
  69. } else if (data.deviceTypeId.name === '通道门' || data.deviceTypeId.name === '手持式RFID读写器') {
  70. url = 'api/outsidedevices/'
  71. } else if (data.deviceTypeId.name === '条码打印机') {
  72. url = 'api/device/'
  73. }
  74. if (optTYpe === 'add') {
  75. url += 'create'
  76. } else if (optTYpe === 'edit') {
  77. url += 'update'
  78. }
  79. return url
  80. }
  81. export function getDeviceList(params) {
  82. return request({
  83. url: 'api/device/list',
  84. method: 'get',
  85. params
  86. })
  87. }
  88. // 根据设备id查看设备是否在线
  89. export function FetchIsOnline(params) {
  90. return request({
  91. url: 'api/device/isOnline' + '?' + qs.stringify(params, { indices: false }),
  92. method: 'get'
  93. })
  94. }
  95. // 根据区列获取在库已借数
  96. export function FetchInBorrowByQuCol(params) {
  97. return request({
  98. url: 'api/tag/getInBorrowByQuCol',
  99. method: 'get',
  100. params
  101. })
  102. }
  103. export function unbind(data) {
  104. return request({
  105. url: 'api/displayconfig/unbind',
  106. method: 'post',
  107. data
  108. })
  109. }
  110. // 打开架体具体某一列
  111. export function FetchCallExternalOpenCol(params) {
  112. return request({
  113. url: 'api/callExternal/openCol',
  114. method: 'get',
  115. params
  116. })
  117. }
  118. // 密集架合架
  119. export function FetchCallExternalResetCol(params) {
  120. return request({
  121. url: 'api/callExternal/reset',
  122. method: 'get',
  123. params
  124. })
  125. }
  126. // 密集架通风
  127. export function FetchCallExternalVent(params) {
  128. return request({
  129. url: 'api/callExternal/vent',
  130. method: 'get',
  131. params
  132. })
  133. }
  134. // 停止移动
  135. export function FetchCallExternalStopMove(params) {
  136. return request({
  137. url: 'api/callExternal/stopMove',
  138. method: 'get',
  139. params
  140. })
  141. }
  142. export default { add, edit, del, getSupplier, getDeviceType, getDeviceById, getDesecabinetById, getRotarycabinetById, getDeviceList, FetchIsOnline, FetchInBorrowByQuCol, unbind, FetchCallExternalOpenCol, FetchCallExternalResetCol, FetchCallExternalVent, FetchCallExternalStopMove }