device.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. import request from '@/utils/request'
  2. // 查询设备分组
  3. export function listDeviceGroup(userId) {
  4. return request({
  5. url: '/iot/group/list?pageSize=30&pageNum=1&userId='+userId,
  6. method: 'get'
  7. })
  8. }
  9. // 查询设备
  10. export function listDevice(pageNum,deviceName,deptId) {
  11. let url = '/iot/device/shortList?pageNum='+pageNum+'&pageSize=12';
  12. if(deviceName){
  13. url = url +"&deviceName="+encodeURIComponent(deviceName)
  14. }
  15. if(deptId){
  16. url = url +"&deptId="+deptId
  17. }
  18. return request({
  19. url: url,
  20. method: 'get'
  21. })
  22. }
  23. //获取设备详情
  24. export function getDetail(id){
  25. return request({
  26. url: '/iot/device/'+id,
  27. method: 'get'
  28. })
  29. }
  30. //获取设备状态
  31. export function getDeviceStatus(id,childId){
  32. let url = '/iot/device/runningStatus/'+id;
  33. if(childId){
  34. url = url+"?childId="+childId;
  35. }
  36. return request({
  37. url: url,
  38. method: 'get'
  39. })
  40. }
  41. //物模型缓存
  42. export function cacheJsonThingsModel(id){
  43. let url = '/iot/model/cache/'+id;
  44. return request({
  45. url: url,
  46. method: 'get'
  47. })
  48. }
  49. //获取设备消息列表
  50. export function getDeviceMsg(){
  51. let url = '/iot/configqrcode/list?pageSize=10';
  52. return request({
  53. url: url,
  54. method: 'get'
  55. })
  56. }
  57. //绑定设备码
  58. export function bindDeviceQrcode(qrcode,deviceNo){
  59. let url = '/iot/device/bind?deviceNo='+deviceNo+"&qrcode="+qrcode;
  60. return request({
  61. url: url,
  62. method: 'get',
  63. })
  64. }
  65. //获取警报列表
  66. export function getAlertList(pageNum,pageSize){
  67. let url = '/iot/alertLog/list?pageNum='+pageNum+'&pageSize='+pageSize;
  68. return request({
  69. url: url,
  70. method: 'get',
  71. })
  72. }
  73. //处理报警
  74. export function handleAlert(alertLog){
  75. return request({
  76. url: '/iot/alertLog',
  77. data:alertLog,
  78. method: 'put',
  79. })
  80. }
  81. //查询详情
  82. export function getAlertLog(id){
  83. return request({
  84. url: '/iot/alertLog/'+id,
  85. method: 'get',
  86. })
  87. }
  88. //根据二维码找到设备详情
  89. export function getDevcieByQrcode(id){
  90. return request({
  91. url: '/iot/device/getDeviceByQrcode?qrcode='+id,
  92. method: 'get',
  93. })
  94. }
  95. //绑定设备
  96. export function bindDevice(device){
  97. return request({
  98. url: '/iot/device/bindDevice',
  99. data:device,
  100. method: 'post',
  101. })
  102. }
  103. //注销设备
  104. export function resetDevice(device){
  105. return request({
  106. url: '/iot/device/resetDevice',
  107. data:device,
  108. method: 'post',
  109. })
  110. }
  111. export function bingDeviceDept(device){
  112. return request({
  113. url: '/iot/device',
  114. data:device,
  115. method: 'put',
  116. })
  117. }
  118. //根据二维码找到设备详情
  119. export function editDeviceName(device){
  120. return request({
  121. url: '/iot/device/editDevice',
  122. data:device,
  123. method: 'post',
  124. })
  125. }
  126. //主动上报错误
  127. export function reportError(err){
  128. return request({
  129. url: '/iot/desc',
  130. data:err,
  131. method: 'post',
  132. })
  133. }
  134. /**
  135. * 主动上报列表
  136. * @param pageNum
  137. * @param pageSize
  138. * @returns {*}
  139. */
  140. export function errorList(pageNum,pageSize){
  141. let url = '/iot/desc/list?pageNum='+pageNum+'&pageSize='+pageSize;
  142. return request({
  143. url: url,
  144. method: 'get',
  145. })
  146. }
  147. //设备注销记录
  148. export function resetList(pageNum,pageSize,deviceName){
  149. let url = '/iot/reset/list?pageNum='+pageNum+'&pageSize='+pageSize;
  150. if(deviceName){
  151. url = url +"&deviceName="+encodeURIComponent(deviceName)
  152. }
  153. return request({
  154. url: url,
  155. method: 'get',
  156. })
  157. }
  158. //获取设备运行时间统计
  159. export function getDeviceRunTime(deviceid){
  160. let url = '/iot/device/getDeviceRunTime/'+deviceid
  161. return request({
  162. url: url,
  163. method: 'get',
  164. })
  165. }
  166. //获取所有runtime事件排序
  167. export function getAllDeviceRunTime(){
  168. let url = '/iot/device/rankRunTime'
  169. return request({
  170. url: url,
  171. method: 'get',
  172. })
  173. }
  174. // 查询设备最新固件
  175. export function getLatestFirmware(deviceId) {
  176. return request({
  177. url: '/iot/firmware/getLatest/' + deviceId,
  178. method: 'get'
  179. })
  180. }