device.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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';
  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 bingDeviceDept(device){
  97. return request({
  98. url: '/iot/device',
  99. data:device,
  100. method: 'put',
  101. })
  102. }
  103. //主动上报错误
  104. export function reportError(err){
  105. return request({
  106. url: '/iot/desc',
  107. data:err,
  108. method: 'post',
  109. })
  110. }
  111. /**
  112. * 主动上报列表
  113. * @param pageNum
  114. * @param pageSize
  115. * @returns {*}
  116. */
  117. export function errorList(pageNum,pageSize){
  118. let url = '/iot/desc/list?pageNum='+pageNum+'&pageSize='+pageSize;
  119. return request({
  120. url: url,
  121. method: 'get',
  122. })
  123. }
  124. //设备注销记录
  125. export function resetList(pageNum,pageSize,deviceName){
  126. let url = '/iot/reset/list?pageNum='+pageNum+'&pageSize='+pageSize;
  127. if(deviceName){
  128. url = url +"&deviceName="+encodeURIComponent(deviceName)
  129. }
  130. return request({
  131. url: url,
  132. method: 'get',
  133. })
  134. }
  135. //获取设备运行时间统计
  136. export function getDeviceRunTime(deviceid){
  137. let url = '/iot/device/getDeviceRunTime/'+deviceid
  138. return request({
  139. url: url,
  140. method: 'get',
  141. })
  142. }