device.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. //根据二维码ID找到设备详情
  96. export function getDevcieByQrcodeID(id){
  97. return request({
  98. url: '/iot/device/getDeviceByQrcodeId?qrcodeId='+id,
  99. method: 'get',
  100. })
  101. }
  102. //绑定设备
  103. export function bindDevice(device){
  104. return request({
  105. url: '/iot/device/bindDevice',
  106. data:device,
  107. method: 'post',
  108. })
  109. }
  110. //注销设备
  111. export function resetDevice(device){
  112. return request({
  113. url: '/iot/device/resetDevice',
  114. data:device,
  115. method: 'post',
  116. })
  117. }
  118. export function bingDeviceDept(device){
  119. return request({
  120. url: '/iot/device',
  121. data:device,
  122. method: 'put',
  123. })
  124. }
  125. //根据二维码找到设备详情
  126. export function editDeviceName(device){
  127. return request({
  128. url: '/iot/device/editDevice',
  129. data:device,
  130. method: 'post',
  131. })
  132. }
  133. //主动上报错误
  134. export function reportError(err){
  135. return request({
  136. url: '/iot/desc',
  137. data:err,
  138. method: 'post',
  139. })
  140. }
  141. /**
  142. * 主动上报列表
  143. * @param pageNum
  144. * @param pageSize
  145. * @returns {*}
  146. */
  147. export function errorList(pageNum,pageSize){
  148. let url = '/iot/desc/list?pageNum='+pageNum+'&pageSize='+pageSize;
  149. return request({
  150. url: url,
  151. method: 'get',
  152. })
  153. }
  154. //设备注销记录
  155. export function resetList(pageNum,pageSize,deviceName){
  156. let url = '/iot/reset/list?pageNum='+pageNum+'&pageSize='+pageSize;
  157. if(deviceName){
  158. url = url +"&deviceName="+encodeURIComponent(deviceName)
  159. }
  160. return request({
  161. url: url,
  162. method: 'get',
  163. })
  164. }
  165. //获取设备运行时间统计
  166. export function getDeviceRunTime(deviceid){
  167. let url = '/iot/device/getDeviceRunTime/'+deviceid
  168. return request({
  169. url: url,
  170. method: 'get',
  171. })
  172. }
  173. //获取所有runtime事件排序
  174. export function getAllDeviceRunTime(){
  175. let url = '/iot/device/rankRunTime'
  176. return request({
  177. url: url,
  178. method: 'get',
  179. })
  180. }
  181. // 查询设备最新固件
  182. export function getLatestFirmware(deviceId) {
  183. return request({
  184. url: '/iot/firmware/getLatest/' + deviceId,
  185. method: 'get'
  186. })
  187. }
  188. // 添加设备预约
  189. export function addDevicePlan(plan) {
  190. return request({
  191. url: '/iot/plan?minute='+plan.minute,
  192. method: 'post',
  193. data:plan
  194. })
  195. }
  196. // 获取设备的预约信息
  197. export function getDevicePlan(deviceId) {
  198. return request({
  199. url: '/iot/plan/' + deviceId,
  200. method: 'get'
  201. })
  202. }
  203. // 删除设备预约
  204. export function delDevicePlan(deviceId) {
  205. return request({
  206. url: '/iot/plan/' + deviceId,
  207. method: 'delete'
  208. })
  209. }
  210. // 解除设备绑定
  211. export function unbind(userId) {
  212. return request({
  213. url: '/iot/device/unbind/' + userId,
  214. method: 'delete'
  215. })
  216. }
  217. // 添加保温
  218. export function saveBaowenSetting(baowen) {
  219. return request({
  220. url: '/iot/setting/',
  221. method: 'post',
  222. data:baowen
  223. })
  224. }
  225. // 修改保温
  226. export function editBaowenSetting(baowen) {
  227. return request({
  228. url: '/iot/setting/',
  229. method: 'put',
  230. data:baowen
  231. })
  232. }
  233. // 保温信息
  234. export function getBaoWen(baowen) {
  235. return request({
  236. url: '/iot/setting/getInfo',
  237. method: 'post',
  238. data:baowen
  239. })
  240. }
  241. // 取消保温
  242. export function cancelBaowen(baowen) {
  243. return request({
  244. url: '/iot/setting/cancel',
  245. method: 'post',
  246. data:baowen
  247. })
  248. }