equipManage_bzy_detail.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
  8. <link href="../css/mui.min.css" rel="stylesheet" />
  9. <link rel="stylesheet" href="../css/iconfont.css" />
  10. <link href="../css/common.css" rel="stylesheet" />
  11. <link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
  12. <style type="text/css">
  13. .mui-content {
  14. background: #fff;
  15. }
  16. .iconfont {
  17. font-size: 35px;
  18. color: #3bb9e7;
  19. /*font-weight: bold;*/
  20. line-height: 80px;
  21. margin: 10px 10px 10px 20px;
  22. }
  23. .equipState {
  24. font-size: 18px;
  25. margin-top: 14px;
  26. color: #333;
  27. }
  28. .conversion {
  29. width: 110px;
  30. }
  31. #detial>div {
  32. border-bottom: 2px solid #eee;
  33. }
  34. #detial>div:nth-of-type(odd) {
  35. border-right: 2px solid #eee;
  36. }
  37. .mui-table-view:after,
  38. .mui-table-view:before {
  39. height: 2px;
  40. background-color: #eee;
  41. }
  42. @media(max-width: 400px) {
  43. .mui-col-sm-6 {
  44. width: 50%;
  45. }
  46. }
  47. .nullData {
  48. top: 45px;
  49. }
  50. /*查看详情*/
  51. .areaTitle {
  52. color: #424242;
  53. padding-left: 5px;
  54. border-left: 5px solid #5870f6;
  55. font-weight: bold;
  56. font-size: 16px;
  57. }
  58. .detialBox .fa {
  59. padding-right: 5px;
  60. color: #ff6e00;
  61. }
  62. /**/
  63. .controlVal {
  64. position: absolute;
  65. top: 50%;
  66. right: 35px;
  67. -webkit-transform: translateY(-50%);
  68. transform: translateY(-50%);
  69. }
  70. #controlBtn {
  71. width: 80%;
  72. /*height: 0px;*/
  73. background: white;
  74. position: fixed;
  75. top: 24%;
  76. left: 50%;
  77. margin-left: -40%;
  78. }
  79. /*移除底部或顶部三角,需要在删除此代码*/
  80. .mui-popover .mui-popover-arrow:after {
  81. width: 0px;
  82. }
  83. .lnglat>p {
  84. color: #333;
  85. font-size: 14px;
  86. }
  87. .lnglat #lng {
  88. margin: 18px 0 3px 0;
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <header class="mui-bar mui-bar-nav">
  94. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  95. <h1 class="mui-title" id="title">孢子仪设备</h1>
  96. <a class="headRightIcon fa fa-camera mui-pull-right" id="takephoto">拍照</a>
  97. </header>
  98. <div class="mui-content">
  99. <div id="scrollPlace" class="mescroll">
  100. <div id="dataList">
  101. <ul class="mui-table-view" id="equip">
  102. <li class="mui-table-view-cell">
  103. <h1 class="areaTitle">设备信息</h1>
  104. </li>
  105. <li class="mui-table-view-cell">
  106. <p id="equipId"></p>
  107. </li>
  108. <li class="mui-table-view-cell">
  109. <p id="equipName"></p>
  110. </li>
  111. <li class="mui-table-view-cell">
  112. <p id="upl_time"></p>
  113. </li>
  114. <li class="mui-table-view-cell">
  115. <p id="lat_lng"></p>
  116. </li>
  117. </ul>
  118. <ul class="mui-table-view detialBox">
  119. <li class="mui-table-view-cell">
  120. <h1 class="areaTitle">配置设备操作</h1>
  121. </li>
  122. <!--<li class="mui-table-view-cell" id="equipSW">
  123. <a class="mui-navigate-right">
  124. <i class="fa fa-calendar" aria-hidden="true"></i> 设备开关
  125. <span class="controlVal" data-time='' id="equipSWValue"></span>
  126. </a>
  127. </li>-->
  128. <li class="mui-table-view-cell" id="glass">
  129. <a class="mui-navigate-right">
  130. <i class="fa fa-calendar" aria-hidden="true"></i> 载玻片更换时间
  131. <span class="controlVal" data-time='' id="glassValue"></span>
  132. </a>
  133. </li>
  134. <li class="mui-table-view-cell" id="liquid">
  135. <a class="mui-navigate-right">
  136. <i class="fa fa-tint" aria-hidden="true"></i> 培养液更换时间
  137. <span class="controlVal" data-time='' id="liquidValue"></span>
  138. </a>
  139. </li>
  140. <li class="mui-table-view-cell" id="configBtn">
  141. <a class="mui-navigate-right">
  142. <i class="fa fa-cog" aria-hidden="true"></i> 设备详细配置
  143. </a>
  144. </li>
  145. <li class="mui-table-view-cell" id="simCodeSearch">
  146. <a class="mui-navigate-right">
  147. <i class="fa fa-search" aria-hidden="true"></i> SIM卡查询
  148. </a>
  149. </li>
  150. <li class="mui-table-view-cell" id="refreshBtn">
  151. <a class="mui-navigate-right">
  152. <i class="fa fa-refresh" aria-hidden="true"></i> 查询最新状态
  153. </a>
  154. </li>
  155. </ul>
  156. <div class="mui-row" id="detial">
  157. <div class="mui-col-sm-6">
  158. <div class="mui-pull-left">
  159. <i class="iconfont">&#xe698;</i>
  160. </div>
  161. <div class="mui-pull-left ">
  162. <p class="equipState" id="ds">开</p>
  163. <p class="equipFun">设备开关</p>
  164. </div>
  165. </div>
  166. <div class="mui-col-sm-6">
  167. <div class="mui-pull-left">
  168. <i class="iconfont">&#xe60b;</i>
  169. </div>
  170. <div class="mui-pull-left ">
  171. <p class="equipState" id="ws">待机</p>
  172. <p class="equipFun">在线状态</p>
  173. </div>
  174. </div>
  175. <div class="mui-col-sm-6">
  176. <div class="mui-pull-left">
  177. <i class="iconfont">&#xe8f3;</i>
  178. </div>
  179. <div class="mui-pull-left ">
  180. <p class="equipState" id="bat_sta">4</p>
  181. <p class="equipFun">电池状态</p>
  182. </div>
  183. </div>
  184. <div class="mui-col-sm-6">
  185. <div class="mui-pull-left">
  186. <i class="iconfont">&#xe612;</i>
  187. </div>
  188. <div class="mui-pull-left ">
  189. <p class="equipState" id="usb_sta">正常</p>
  190. <p class="equipFun">摄像头状态</p>
  191. </div>
  192. </div>
  193. <div class="mui-col-sm-6">
  194. <div class="mui-pull-left">
  195. <i class="iconfont">&#xe610;</i>
  196. </div>
  197. <div class="mui-pull-left ">
  198. <p class="equipState" id="pre_temp">正常</p>
  199. <p class="equipFun">保温仓温度</p>
  200. </div>
  201. </div>
  202. <div class="mui-col-sm-6">
  203. <div class="mui-pull-left">
  204. <i class="iconfont">&#xe624;</i>
  205. </div>
  206. <div class="mui-pull-left ">
  207. <p class="equipState" id="v_bat">正常</p>
  208. <p class="equipFun">当前电压</p>
  209. </div>
  210. </div>
  211. <div class="mui-col-sm-6">
  212. <div class="mui-pull-left">
  213. <i class="iconfont">&#xeaae;</i>
  214. </div>
  215. <div class="mui-pull-left ">
  216. <p class="equipState" id="staytime">正常</p>
  217. <p class="equipFun">已培养时间</p>
  218. </div>
  219. </div>
  220. <div class="mui-col-sm-6">
  221. <div class="mui-pull-left">
  222. <i class="iconfont">&#xe711;</i>
  223. </div>
  224. <div class="mui-pull-left lnglat">
  225. <p class="equipState conversion" id="lng">正常</p>
  226. <p class="equipFun conversion" id="lat">经纬度</p>
  227. </div>
  228. </div>
  229. <div class="mui-col-sm-6">
  230. <div class="mui-pull-left">
  231. <i class="iconfont">&#xe60a;</i>
  232. </div>
  233. <div class="mui-pull-left ">
  234. <p class="equipState" id="csq">29</p>
  235. <p class="equipFun">信号强度</p>
  236. </div>
  237. </div>
  238. <div class="mui-col-sm-6">
  239. <div class="mui-pull-left">
  240. <i class="iconfont">&#xe65f;</i>
  241. </div>
  242. <div class="mui-pull-left ">
  243. <p class="equipState conversion" id="dver">1.0.1</p>
  244. <p class="equipFun">版本型号</p>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. <div id="popover" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 310px;background-color: #fff;">
  251. <div class="mui-popover-arrow"></div>
  252. <!--<div class="popoverheader">
  253. <div class="text"></div>
  254. <a href="#popover"><img src="../image/close.png" alt=""></a>
  255. </div>-->
  256. <div id="simDetial">
  257. </div>
  258. <div class="mui-table-view mui-table-view-chevron next">
  259. <a href="#popover" class="x-next add">我知道了</a>
  260. </div>
  261. </div>
  262. </div>
  263. <div id="aaa" style="display: none;">
  264. sdvsdvsdvsd
  265. </div>
  266. <div id="map" style="display: none;"></div>
  267. <script src="../js/jquery-2.1.0.js"></script>
  268. <script src="../js/mui.min.js"></script>
  269. <script src="../js/mui.picker.min.js" type="text/javascript" charset="utf-8"></script>
  270. <script src="../js/common.js"></script>
  271. <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=La58N63t7hPhafQ7Eror2kon"></script>
  272. <script type="text/javascript">
  273. var equipId,bzy_status,iccid;
  274. mui.init();
  275. mui.plusReady(function() {
  276. var self = plus.webview.currentWebview();
  277. equipId = self.equipId;
  278. $('#equipId').html('设备ID:' + equipId);
  279. console.log(equipId);
  280. downCallback()
  281. var map = new BMap.Map("map"); //
  282. geoc = new BMap.Geocoder();
  283. //拍照
  284. document.getElementById("takephoto").addEventListener('tap', function() {
  285. $.ajax({
  286. url: 'http://120.27.222.26/bzy_mqtt',
  287. type: "post",
  288. data: {
  289. 'req': 'ctrl',
  290. 'topicid': equipId,
  291. 'cmd': 'ctrl',
  292. 'type': 'takephoto'
  293. },
  294. dataType: "json",
  295. beforeSend: function() {
  296. plus.nativeUI.showWaiting('请求中...');
  297. },
  298. complete: function() {
  299. plus.nativeUI.closeWaiting();
  300. },
  301. timeout: 10000, //超时时间设置为10秒;
  302. success: function(data) {
  303. mui.toast('请求成功');
  304. },
  305. error: function(xhr, type, errorThrown) {
  306. //联网失败的回调,隐藏下拉刷新的状态
  307. mescroll.endErr();
  308. mui.toast('数据请求失败');
  309. }
  310. });
  311. })
  312. //载玻片更换时间
  313. document.getElementById("glass").addEventListener('tap', function() {
  314. var year = new Date().getFullYear();
  315. var dtpicker = new mui.DtPicker({
  316. "type": "date",
  317. "beginYear": 1999,
  318. "endYear": year + 6,
  319. });
  320. dtpicker.show(function(selectItems) {
  321. console.log(selectItems.text)
  322. $.ajax({
  323. url: 'http://120.27.222.26/bzy_mqtt',
  324. type: "post",
  325. data: {
  326. "req": "glass", //读取
  327. 'id': equipId,
  328. "glass": selectItems.text,
  329. },
  330. dataType: "json",
  331. beforeSend: function() {
  332. plus.nativeUI.showWaiting('请求中...');
  333. },
  334. complete: function() {
  335. plus.nativeUI.closeWaiting();
  336. },
  337. timeout: 10000, //超时时间设置为10秒;
  338. success: function(data) {
  339. headChangeFun(selectItems.text, $('#liquidValue').data('time'));
  340. },
  341. error: function(xhr, type, errorThrown) {
  342. //联网失败的回调,隐藏下拉刷新的状态
  343. mescroll.endErr();
  344. mui.toast('数据请求失败');
  345. }
  346. });
  347. })
  348. })
  349. //滴液更换时间
  350. document.getElementById("liquid").addEventListener('tap', function() {
  351. var year = new Date().getFullYear();
  352. var dtpicker = new mui.DtPicker({
  353. "type": "date",
  354. "beginYear": 1999,
  355. "endYear": year + 6,
  356. });
  357. dtpicker.show(function(selectItems) {
  358. console.log(selectItems.text)
  359. $.ajax({
  360. url: 'http://120.27.222.26/bzy_mqtt',
  361. type: "post",
  362. data: {
  363. "req": "liquid", //读取
  364. 'id': equipId,
  365. "liquid": selectItems.text,
  366. },
  367. dataType: "json",
  368. beforeSend: function() {
  369. plus.nativeUI.showWaiting('请求中...');
  370. },
  371. complete: function() {
  372. plus.nativeUI.closeWaiting();
  373. },
  374. timeout: 10000, //超时时间设置为10秒;
  375. success: function(data) {
  376. headChangeFun($('#glassValue').data('time'),selectItems.text);
  377. },
  378. error: function(xhr, type, errorThrown) {
  379. //联网失败的回调,隐藏下拉刷新的状态
  380. mescroll.endErr();
  381. mui.toast('数据请求失败');
  382. }
  383. });
  384. })
  385. })
  386. // 过期时间
  387. function getNextDay(setTime, num) {
  388. var date = new Date(setTime);
  389. var nextDay = date.getTime() + (num * 24 * 60 * 60 * 1000);
  390. var d = new Date(nextDay);
  391. var datetime = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
  392. return datetime;
  393. }
  394. // 相差天数
  395. function getSurplusDay(sDate2) {
  396. var newData = new Date();
  397. var dateSpan,
  398. iDays;
  399. sDate2 = Date.parse(sDate2);
  400. newData = Date.parse(newData);
  401. dateSpan = sDate2 - newData;
  402. // dateSpan = Math.abs(dateSpan);
  403. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  404. return iDays;
  405. }
  406. // 载玻片更换提示
  407. function headChangeFun(setGlassTime, setLiquidTime) {
  408. var glassSurplusDay = getSurplusDay(getNextDay(setGlassTime, 10));
  409. var liquidSurplusDay = getSurplusDay(getNextDay(setLiquidTime, 10));
  410. if(setGlassTime) {
  411. $('#glassValue').data('time',setGlassTime)
  412. if(glassSurplusDay < 10 && glassSurplusDay > 0) {
  413. $('#glassValue').html(setGlassTime+'('+glassSurplusDay+'天过期)').css('color','#cfd51c')
  414. } else if(glassSurplusDay <= 0) {
  415. $('#glassValue').html(setGlassTime+'(已过期)').css('color','red')
  416. } else {
  417. $('#glassValue').html(setGlassTime).css('color','#333')
  418. }
  419. } else {
  420. $('#glassValue').data('time','')
  421. $('#glassValue').html('请及时设置').css('color','red')
  422. }
  423. if(setLiquidTime) {
  424. $('#liquidValue').data('time',setLiquidTime)
  425. if(liquidSurplusDay < 10 && liquidSurplusDay > 0) {
  426. $('#liquidValue').html(setLiquidTime+'('+liquidSurplusDay+'天过期)').css('color','#cfd51c')
  427. } else if(liquidSurplusDay <= 0) {
  428. $('#liquidValue').html(setLiquidTime+'(已过期)').css('color','red')
  429. } else {
  430. $('#liquidValue').html(setLiquidTime).css('color','#333')
  431. }
  432. } else {
  433. $('#liquidValue').data('time','')
  434. $('#liquidValue').html('请及时设置').css('color','red')
  435. }
  436. }
  437. //下拉刷新的回调
  438. function downCallback() {
  439. $.ajax({
  440. url: 'http://120.27.222.26/app_equipmanage_detail',
  441. data: {
  442. 'etype': 'bzy',
  443. 'equip_id': equipId,
  444. },
  445. dataType: 'json', //服务器返回json格式数据
  446. type: 'post', //HTTP请求类型
  447. beforeSend: function() {
  448. plus.nativeUI.showWaiting('请求中...');
  449. },
  450. complete: function() {
  451. plus.nativeUI.closeWaiting();
  452. },
  453. timeout: 10000, //超时时间设置为10秒;
  454. success: function(data) {
  455. bzy_status = data.bzy_status;
  456. console.log(JSON.stringify(data))
  457. //联网成功的回调,隐藏下拉刷新的状态;
  458. // mescroll.endSuccess(); //无参. 注意结束下拉刷新是无参的
  459. var equip_name = data.equip_name || '无';
  460. $('#equipName').html('设备名称:' + equip_name);
  461. $('#upl_time').html('上报时间:' + data.upl_time);
  462. var stat = eval('(' + data.bzy_status + ')');
  463. var point = new BMap.Point(stat.lng, stat.lat);
  464. geoc.getLocation(point, function (rs) {
  465. var addComp = rs.addressComponents;
  466. if(addComp.province || addComp.city || addComp.district){
  467. $('#lat_lng').html('位置:' + addComp.province + ", " + addComp.city + ", " + addComp.district);
  468. }else{
  469. $('#lat_lng').html('暂无位置信息')
  470. }
  471. });
  472. if(stat.on_off == 1) {
  473. $('#ds').html('开');
  474. } else {
  475. $('#ds').html('关');
  476. }
  477. if(data.is_online == 1) {
  478. $('#ws').html('在线');
  479. } else if(data.is_online == 0) {
  480. $('#ws').html('离线');
  481. } else {
  482. $('#ws').html('--');
  483. }
  484. if(stat.bat_sta == 0) $('#bat_sta').html('正常');
  485. else $('#bat_sta').html('异常');
  486. if(stat.usb_sta == 0) $('#usb_sta').html('正常');
  487. else $('#usb_sta').html('异常');
  488. $('#pre_temp').html(stat.pre_temp + '°C')
  489. var dverNum = stat.dver.split('.')[0];
  490. if((stat.v_bat > 30) && (dverNum == 1)){
  491. var v_bat = 24;
  492. }else{
  493. var v_bat = stat.v_bat;
  494. }
  495. $('#v_bat').html(v_bat + 'V')
  496. $('#staytime').html(stat.staytime || 0 + '(hour)')
  497. $('#csq').html(stat.csq)
  498. $('#dver').html(stat.dver)
  499. $('#lng').html('经:' + parseFloat(stat.lng).toFixed(4))
  500. $('#lat').html('纬:' + parseFloat(stat.lat).toFixed(4))
  501. if (data.glass) {
  502. var glassValArr = data.glass.split('#');
  503. var glassVal = glassValArr[glassValArr.length - 1];
  504. } else {
  505. var glassVal = '';
  506. }
  507. if (data.liquid) {
  508. var liquidValArr = data.liquid.split('#');
  509. var liquidVal = liquidValArr[liquidValArr.length - 1];
  510. } else {
  511. var liquidVal = '';
  512. }
  513. iccid = stat.iccid;
  514. // 载玻片更换时间提示
  515. headChangeFun(glassVal, liquidVal);
  516. },
  517. error: function(xhr, type, errorThrown) {
  518. //联网失败的回调,隐藏下拉刷新的状态
  519. mescroll.endErr();
  520. mui.toast('数据请求失败');
  521. }
  522. });
  523. }
  524. //设备详细配置
  525. $('#configBtn').on('tap', function() {
  526. mui.openWindow({
  527. url: 'configuration_bzy.html',
  528. id: 'configuration_bzy',
  529. extras: {
  530. equipId: equipId,
  531. status:bzy_status
  532. }
  533. })
  534. })
  535. //sim卡查新
  536. document.getElementById('simCodeSearch').addEventListener('tap', function() {
  537. if(iccid) {
  538. $.ajax({
  539. url: 'http://120.27.222.26/siminfo',
  540. data: {
  541. simid: iccid,
  542. },
  543. dataType: 'json', //服务器返回json格式数据
  544. type: 'post', //HTTP请求类型
  545. timeout: 10000, //超时时间设置为10秒;
  546. beforeSend: function() {
  547. plus.nativeUI.showWaiting('请求中...');
  548. },
  549. complete: function() {
  550. plus.nativeUI.closeWaiting();
  551. },
  552. success: function(data) {
  553. var dat = data.data;
  554. if(data.code == 0) {
  555. var status;
  556. if(dat.account_status == "0") {
  557. status = "未知";
  558. } else if(dat.account_status == "1") {
  559. status = "测试期";
  560. } else if(dat.account_status == "2") {
  561. status = "沉默期";
  562. } else if(dat.account_status == "3") {
  563. status = "使用中";
  564. } else if(dat.account_status == "4") {
  565. status = "停机";
  566. } else if(dat.account_status == "5") {
  567. status = "停机保号";
  568. } else if(dat.account_status == "6") {
  569. status = "预销号";
  570. } else if(dat.account_status == "7") {
  571. status = "销号";
  572. }
  573. var usage;
  574. if(dat.iccid) {
  575. usage = dat.data_usage;
  576. } else {
  577. usage.innerHTML = '--';
  578. }
  579. var balance;
  580. if(dat.iccid) {
  581. balance = dat.data_balance;
  582. } else {
  583. balance = '--';
  584. }
  585. var time;
  586. if(dat.iccid) {
  587. var timestamp4 = new Date(dat.expiry_date * 1000); //直接用 new Date(时间戳) 格式转化获得当前时间
  588. time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8);
  589. } else {
  590. time = '--';
  591. }
  592. html = '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">SIM卡查询结果<br>ICCID:' + iccid + '<br><br>状态:' + status + '<br>套餐:' + dat.data_plan + 'Mb<br>已用流量:' + usage + 'Mb<br>剩余流量:' + balance + 'Mb<br>到期时间:' + time + '</div>'
  593. $('#simDetial').html(html);
  594. mui('.mui-popover').popover('show', document.getElementById("popover"));
  595. }
  596. },
  597. error: function(xhr, type, errorThrown) {
  598. //联网失败的回调,隐藏下拉刷新的状态
  599. mescroll.endErr();
  600. mui.toast('数据请求失败');
  601. }
  602. });
  603. } else {
  604. mui.toast('未查询到SIM卡号');
  605. }
  606. })
  607. //查询
  608. $('#refreshBtn').on('tap', function() {
  609. var id = [];
  610. id.push(equipId);
  611. mui.ajax('http://120.27.222.26/bzy_mqtt', {
  612. data: {
  613. 'req': 'read',
  614. 'topicid': JSON.stringify(id),
  615. },
  616. dataType: 'json', //服务器返回json格式数据
  617. type: 'post', //HTTP请求类型
  618. timeout: 10000, //超时时间设置为10秒;
  619. beforeSend: function() {
  620. plus.nativeUI.showWaiting('请求中...');
  621. },
  622. complete: function() {
  623. setTimeout(function() {
  624. plus.nativeUI.closeWaiting();
  625. }, 5000)
  626. },
  627. success: function(data) {
  628. setTimeout(function() {
  629. location.reload();
  630. }, 5000)
  631. },
  632. error: function(xhr, type, errorThrown) {
  633. mui.toast('请求失败!')
  634. }
  635. });
  636. })
  637. })
  638. </script>
  639. </body>
  640. </html>