sex_trap_detail1.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  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 rel="stylesheet" href="../css/iconfont.css" />
  9. <link href="../css/mui.min.css" rel="stylesheet" />
  10. <link href="../css/common.css" rel="stylesheet" />
  11. <style type="text/css">
  12. .mui-content {
  13. background: #fff;
  14. }
  15. .iconfont {
  16. font-size: 35px;
  17. color: #3bb9e7;
  18. /*font-weight: bold;*/
  19. line-height: 80px;
  20. margin: 10px 10px 10px 20px;
  21. }
  22. .equipState {
  23. font-size: 18px;
  24. margin-top: 14px;
  25. color: #333;
  26. text-align: -webkit-center;
  27. color: #21b2e7;
  28. }
  29. #detial>div {
  30. border-bottom: 2px solid #eee;
  31. }
  32. #detial>div:nth-of-type(odd) {
  33. /*border-right: 2px solid #eee;*/
  34. }
  35. .mui-table-view:after,
  36. .mui-table-view:before {
  37. height: 2px;
  38. background-color: #eee;
  39. }
  40. @media(max-width: 400px) {
  41. .mui-col-sm-6 {
  42. width: 50%;
  43. }
  44. }
  45. /*设置*/
  46. #detial .mui-navigate-right {
  47. line-height: 80px;
  48. }
  49. #detial .mui-navigate-right:after,
  50. #detial .mui-push-right:after {
  51. font-size: 33px;
  52. color: #3bb9e7;
  53. }
  54. .nullData {
  55. top: 45px;
  56. }
  57. .areaTitle {
  58. color: #424242;
  59. padding-left: 5px;
  60. border-left: 5px solid #5870f6;
  61. font-weight: bold;
  62. font-size: 16px;
  63. }
  64. .detialBox .fa {
  65. padding-right: 5px;
  66. color: #ff6e00;
  67. }
  68. #adminOperate{
  69. display: none;
  70. }
  71. .btns{
  72. padding-top: 20px;
  73. text-align: center;
  74. }
  75. .btns p{
  76. margin: 10px 0;
  77. }
  78. .btns p button{
  79. width: 120px;
  80. border-radius: 50px;
  81. }
  82. .equipFun {
  83. text-align: -webkit-center;
  84. }
  85. /*设备数据*/
  86. .equipmentBox {
  87. margin: 80px 0 0 0;
  88. }
  89. .annular {
  90. background: url(../images/annular.png);
  91. background-repeat:no-repeat;
  92. background-position: center;
  93. height: 150px;
  94. /*height: 100%;*/
  95. width: 33%;
  96. background-size: 100%;
  97. }
  98. .equipmentBox_val {
  99. }
  100. .unit {
  101. font-size: 15px;
  102. }
  103. .stateList {
  104. /*border: 1px solid #000;*/
  105. width: 30%;
  106. }
  107. #detial {
  108. margin-left: 16px;
  109. }
  110. </style>
  111. </head>
  112. <body>
  113. <header class="mui-bar mui-bar-nav">
  114. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  115. <h1 class="mui-title">性诱设备</h1>
  116. <a class="headRightIcon mui-icon mui-icon-loop mui-pull-right" onclick="location.reload();"></a>
  117. </header>
  118. <div class="mui-content">
  119. <div id="scrollPlace" class="mescroll">
  120. <div id="dataList">
  121. <ul class="mui-table-view" id="equip">
  122. <li class="mui-table-view-cell">
  123. <h1 class="areaTitle">设备信息</h1>
  124. </li>
  125. <li class="mui-table-view-cell">
  126. <p id="equipId"></p>
  127. </li>
  128. <li class="mui-table-view-cell">
  129. <p id="equipName"></p>
  130. </li>
  131. <!--<li class="mui-table-view-cell">
  132. <p id="equipCode"></p>
  133. </li>-->
  134. <li class="mui-table-view-cell">
  135. <p id="equipType"></p>
  136. </li>
  137. <li class="mui-table-view-cell">
  138. <p id="upl_time"></p>
  139. </li>
  140. <li class="mui-table-view-cell">
  141. <p id="lat_lng"></p>
  142. </li>
  143. </ul>
  144. <ul class="mui-table-view detialBox">
  145. <li class="mui-table-view-cell">
  146. <h1 class="areaTitle">配置设备操作</h1>
  147. </li>
  148. <li class="mui-table-view-cell" id="configuration">
  149. <a class="mui-navigate-right">
  150. <i class="fa fa-cogs" aria-hidden="true"></i> 设备配置
  151. </a>
  152. </li>
  153. <li class="mui-table-view-cell" id="lookHistoryData">
  154. <a class="mui-navigate-right">
  155. <i class="fa fa-list" aria-hidden="true"></i> 查看历史数据
  156. </a>
  157. </li>
  158. <li class="mui-table-view-cell" id="debug">
  159. <a class="mui-navigate-right">
  160. <i class="fa fa-wrench" aria-hidden="true"></i> 调试
  161. </a>
  162. </li>
  163. <li class="mui-table-view-cell" id="adminOperate">
  164. <a class="mui-navigate-right">
  165. <i class="fa fa-cog" aria-hidden="true"></i> 操作
  166. </a>
  167. </li>
  168. <li class="mui-table-view-cell" id="simCodeSearch">
  169. <a class="mui-navigate-right">
  170. <i class="fa fa-search" aria-hidden="true"></i> SIM卡查询
  171. </a>
  172. </li>
  173. </ul>
  174. <div class="mui-table-view-cell">
  175. <h1 class="areaTitle">设备状态</h1>
  176. </div>
  177. <!--测试-->
  178. <div class="mui-row" id="detial">
  179. <div class="mui-col-sm-4 stateList">
  180. <div class="mui-pull-left">
  181. </div>
  182. <div class="">
  183. <p class="equipState" id="ds"></p>
  184. <p class="equipFun">设备开关</p>
  185. </div>
  186. </div>
  187. <div class="mui-col-sm-4 stateList">
  188. <div class="mui-pull-left">
  189. </div>
  190. <div class="">
  191. <p class="equipState" id="onOff"></p>
  192. <p class="equipFun">工作状态</p>
  193. </div>
  194. </div>
  195. <!--<div class="mui-col-sm-3">
  196. <div class="mui-pull-left">
  197. </div>
  198. <div class="">
  199. <p class="equipState" id="ws"></p>
  200. <p class="equipFun">电池状态</p>
  201. </div>
  202. </div>-->
  203. <div class="mui-col-sm-4 stateList">
  204. <div class="mui-pull-left">
  205. </div>
  206. <div class="">
  207. <p class="equipState" id="cs"></p>
  208. <p class="equipFun">充电状态</p>
  209. </div>
  210. </div>
  211. <div class="mui-col-sm-4 stateList">
  212. <div class="mui-pull-left">
  213. </div>
  214. <div class="">
  215. <p class="equipState" id="rps"></p>
  216. <p class="equipFun">雨控状态</p>
  217. </div>
  218. </div>
  219. <div class="mui-col-sm-4 stateList">
  220. <div class="mui-pull-left">
  221. </div>
  222. <div class="">
  223. <p class="equipState" id="tps"></p>
  224. <p class="equipFun">温控状态</p>
  225. </div>
  226. </div>
  227. <div class="mui-col-sm-4 stateList">
  228. <div class="mui-pull-left">
  229. </div>
  230. <div class="">
  231. <p class="equipState" id="dps"></p>
  232. <p class="equipFun">倾倒状态</p>
  233. </div>
  234. </div>
  235. <!--<div class="mui-col-sm-4 stateList">
  236. <div class="mui-pull-left">
  237. </div>
  238. <div class="">
  239. <p class="equipState">--</p>
  240. <p class="equipFun">--</p>
  241. </div>
  242. </div>
  243. <div class="mui-col-sm-4 stateList">
  244. <div class="mui-pull-left">
  245. </div>
  246. <div class="">
  247. <p class="equipState">--</p>
  248. <p class="equipFun">--</p>
  249. </div>
  250. </div>-->
  251. </div>
  252. <!--测试-->
  253. <!--设备数据测试-->
  254. <div class="mui-table-view-cell">
  255. <h1 class="areaTitle">设备数据</h1>
  256. </div>
  257. <div class="mui-row" id="detial">
  258. <div class="mui-col-sm-4 annular">
  259. <div class="mui-pull-left">
  260. </div>
  261. <div class="equipmentBox">
  262. <p class="equipState equipmentBox_val" id="cv"></p>
  263. <p class="equipFun">充电电压</p>
  264. </div>
  265. </div>
  266. <div class="mui-col-sm-4 annular">
  267. <div class="mui-pull-left">
  268. </div>
  269. <div class="equipmentBox">
  270. <p class="equipState equipmentBox_val" id="bv"></p>
  271. <p class="equipFun">电池电压</p>
  272. </div>
  273. </div>
  274. <div class="mui-col-sm-4 annular">
  275. <div class="mui-pull-left">
  276. </div>
  277. <div class="equipmentBox">
  278. <p class="equipState equipmentBox_val" id="at"></p>
  279. <p class="equipFun">环境温度</p>
  280. </div>
  281. </div>
  282. <div class="mui-col-sm-4 annular">
  283. <div class="mui-pull-left">
  284. </div>
  285. <div class="equipmentBox">
  286. <p class="equipState equipmentBox_val" id="ah"></p>
  287. <p class="equipFun">环境湿度</p>
  288. </div>
  289. </div>
  290. <div class="mui-col-sm-4 annular">
  291. <div class="mui-pull-left">
  292. </div>
  293. <div class="equipmentBox">
  294. <p class="equipState equipmentBox_val" id="infr_ct"></p>
  295. <p class="equipFun">红外计数值</p>
  296. </div>
  297. </div>
  298. <div class="mui-col-sm-4 annular">
  299. <div class="mui-pull-left">
  300. </div>
  301. <div class="equipmentBox">
  302. <p class="equipState equipmentBox_val" id="wind_drec"></p>
  303. <p class="equipFun">风向</p>
  304. </div>
  305. </div>
  306. <div class="mui-col-sm-4 annular">
  307. <div class="mui-pull-left">
  308. </div>
  309. <div class="equipmentBox">
  310. <p class="equipState equipmentBox_val" id="wind_sped"></p>
  311. <p class="equipFun">风速</p>
  312. </div>
  313. </div>
  314. <!--<div class="mui-col-sm-4 annular">
  315. <div class="mui-pull-left">
  316. </div>
  317. <div class="equipmentBox">
  318. <p class="equipState equipmentBox_val" id="cs"></p>
  319. <p class="equipFun">数据上传间隔</p>
  320. </div>
  321. </div>
  322. <div class="mui-col-sm-4 annular">
  323. <div class="mui-pull-left">
  324. </div>
  325. <div class="equipmentBox">
  326. <p class="equipState equipmentBox_val" id="cs"></p>
  327. <p class="equipFun">信号强度</p>
  328. </div>
  329. </div>-->
  330. </div>
  331. <!--设备数据测试-->
  332. </div>
  333. </div>
  334. <!--调试框-->
  335. <div id="debugPopover" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 220px;background-color: #fff;border-radius: 10px 10px 0 0;">
  336. <div class="mui-popover-arrow"></div>
  337. <div class="btns">
  338. <p><button type="button" onclick="popupFrame('开启设备',7)" class="mui-btn mui-btn-danger">开启</button></p>
  339. <p><button type="button" onclick="popupFrame('关闭设备',8)" class="mui-btn mui-btn-danger">关闭</button></p>
  340. <p><button type="button" onclick="popupFrame('重启设备',1)" class="mui-btn mui-btn-danger">重启</button></p>
  341. <p><button type="button" onclick="popupFrame('进行清网',9)" class="mui-btn mui-btn-danger">清网</button></p>
  342. </div>
  343. </div>
  344. <!--操作框-->
  345. <div id="operatePopover" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 300px;background-color: #fff;border-radius: 10px 10px 0 0;">
  346. <div class="mui-popover-arrow">1</div>
  347. <div class="btns">
  348. <p><button type="button" onclick="popupFrame('开启设备',7)" class="mui-btn mui-btn-danger">开启</button></p>
  349. <p><button type="button" onclick="popupFrame('关闭设备',8)" class="mui-btn mui-btn-danger">关闭</button></p>
  350. <p><button type="button" onclick="popupFrame('重启设备',1)" class="mui-btn mui-btn-danger">重启</button></p>
  351. <p><button type="button" onclick="popupFrame('进行清网',9)" class="mui-btn mui-btn-danger">清网</button></p>
  352. <p><button type="button" onclick="popupFrame('升级',2)" class="mui-btn mui-btn-danger">升级</button></p>
  353. <p><button type="button" onclick="popupFrame('查询mqtt网络配置',3)" class="mui-btn mui-btn-danger">mqtt网络配置</button></p>
  354. </div>
  355. </div>
  356. <!--sim卡-->
  357. <div id="popover" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 310px;background-color: #fff;">
  358. <div class="mui-popover-arrow"></div>
  359. <!--<div class="popoverheader">
  360. <div class="text"></div>
  361. <a href="#popover"><img src="../image/close.png" alt=""></a>
  362. </div>-->
  363. <div id="simDetial">
  364. </div>
  365. <div class="mui-table-view mui-table-view-chevron next">
  366. <a href="#popover" class="x-next add">我知道了</a>
  367. </div>
  368. </div>
  369. <!--mqtt网络配置-->
  370. <div id="mqttConf" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 310px;background-color: #fff;">
  371. <div class="mui-popover-arrow"></div>
  372. <!--<div class="popoverheader">
  373. <div class="text"></div>
  374. <a href="#popover"><img src="../image/close.png" alt=""></a>
  375. </div>-->
  376. <div id="mqttConfDetial">
  377. </div>
  378. <div class="mui-table-view mui-table-view-chevron next">
  379. <a href="#mqttConf" class="x-next add">我知道了</a>
  380. </div>
  381. </div>
  382. </div>
  383. <div id="map" style="display: none;"></div>
  384. <script src="../js/jquery-2.1.0.js"></script>
  385. <script src="../js/mui.min.js"></script>
  386. <script src="../js/common.js"></script>
  387. <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=La58N63t7hPhafQ7Eror2kon"></script>
  388. <script type="text/javascript">
  389. var equipId;
  390. var iccid;
  391. //配置需要参数
  392. var confDatF;
  393. var confTurnT;
  394. var confPicT;
  395. var confPicF;
  396. var confSt;
  397. var confEt;
  398. var confTs;
  399. mui.init();
  400. mui.plusReady(function() {
  401. var self = plus.webview.currentWebview();
  402. equipId = self.equipId;
  403. $('#equipId').html('设备ID:' + equipId);
  404. console.log(equipId);
  405. downCallback()
  406. var isuser = plus.storage.getItem('isuser');
  407. if(isuser == 'admin'){
  408. $('#adminOperate').show();
  409. }
  410. var map = new BMap.Map("map"); //
  411. geoc = new BMap.Geocoder();
  412. function downCallback() {
  413. $.ajax({
  414. url: 'http://120.27.222.26/app_equipmanage_detail',
  415. data: {
  416. 'etype': 'xycb',
  417. 'equip_id': equipId,
  418. },
  419. dataType: 'json', //服务器返回json格式数据
  420. type: 'post', //HTTP请求类型
  421. timeout: 10000, //超时时间设置为10秒;
  422. beforeSend: function() {
  423. plus.nativeUI.showWaiting('请求中...');
  424. },
  425. complete: function() {
  426. plus.nativeUI.closeWaiting();
  427. },
  428. success: function(data) {
  429. var equip_name = data.equip_name || '无';
  430. $('#equipName').html('设备名称:' + equip_name);
  431. $('#upl_time').html('上报时间:' + data.upl_time);
  432. var stat = eval('(' + data.ybq_status + ')');
  433. var point = new BMap.Point(stat.lng, stat.lat);
  434. geoc.getLocation(point, function (rs) {
  435. var addComp = rs.addressComponents;
  436. $('#lat_lng').html('位置:' + addComp.province + ", " + addComp.city + ", " + addComp.district);
  437. });
  438. $('#equipCode').html('设备编号:' + stat.dev_num);
  439. if(stat.proj == "SEX_TRAP_1"){
  440. $('#equipType').html('设备型号:I');
  441. }else if(stat.proj == "SEX_TRAP_2"){
  442. $('#equipType').html('设备型号:II');
  443. }
  444. var ds = stat.ds == 0 ? '关闭' : '开机';
  445. $('#ds').html(ds);
  446. var onOff = data.is_online == 0 ? '离线' : '在线';
  447. $('#onOff').html(onOff);
  448. var ws = stat.ws == 0 ? '待机' : '工作';
  449. $('#ws').html(ws);
  450. if(stat.bs != ''){
  451. if(stat.bs == 0){
  452. var bs = '正常';
  453. }else if(stat.bs == 1){
  454. var bs = '欠压';
  455. }else if(stat.bs == 2){
  456. var bs = '过压';
  457. }
  458. $('#bs').html(bs);
  459. }else{
  460. $('#bs').html('--');
  461. }
  462. if(stat.bv != ''){
  463. $('#bv').html(stat.bv/1000 + '<span class="unit">v</span>');
  464. }else{
  465. $('#bv').html('--');
  466. }
  467. if(stat.cv !== ''){
  468. $('#cv').html(stat.cv/1000 + '<span class="unit">v</span>');
  469. }else{
  470. $('#cv').html('--');
  471. }
  472. $('#dver').html(stat.dver);
  473. if(stat.cs !== ''){
  474. var cs = stat.cs == 0 ? '未充电' : '充电';
  475. }else{
  476. var cs = '--';
  477. }
  478. if (stat.rps !== '') {
  479. var rps = stat.rps == 0 ? '正常' : '雨控'
  480. } else {
  481. var rps = '--'
  482. }
  483. if (stat.tps !== '') {
  484. var tps = stat.tps == 0 ? '正常' : '温控'
  485. } else {
  486. var tps = '--'
  487. }
  488. if (stat.dps !== '') {
  489. var dps = stat.dps == 0 ? '正常' : '倾倒'
  490. } else {
  491. var dps = '--'
  492. }
  493. if (stat.infr_ct !== '') {
  494. var infr_ct = stat.infr_ct
  495. } else {
  496. var infr_ct = '--'
  497. }
  498. if (stat.wind_drec !== '') {
  499. var wind_drec = stat.wind_drec
  500. } else {
  501. var wind_drec = '--'
  502. }
  503. if (stat.wind_sped !== '') {
  504. var wind_sped = stat.wind_sped
  505. } else {
  506. var wind_sped = '--'
  507. }
  508. $('#wind_sped').html(wind_sped + '<span class="unit">M/S</span>')
  509. $('#wind_drec').html(wind_drec)
  510. // $('#volt_ct').html(volt_ct)
  511. $('#infr_ct').html(infr_ct)
  512. $('#dps').html(dps)
  513. $('#tps').html(tps)
  514. $('#rps').html(rps)
  515. $('#cs').html(cs);
  516. $('#dat_f').html(stat.dat_f);
  517. $('#cpu_tmp').html(stat.cpu_tmp/1000);
  518. $('#csq').html(stat.csq);
  519. if(stat.at != ''){
  520. $('#at').html(stat.at + '<span class="unit">°C</span>');
  521. }else{
  522. $('#at').html('-');
  523. }
  524. if(stat.ah != ''){
  525. $('#ah').html(stat.ah + '<span class="unit">RH</span>');
  526. }else{
  527. $('#ah').html('--');
  528. }
  529. iccid = stat.iccid;
  530. confDatF = stat.dat_f;
  531. confTurnT = stat.turn_t;
  532. confPicT = stat.pic_t;
  533. confPicF = stat.pic_f;
  534. confSt = stat.st
  535. confEt = stat.et
  536. confTs = stat.ts
  537. },
  538. error: function(xhr, type, errorThrown) {
  539. //联网失败的回调,隐藏下拉刷新的状态
  540. mescroll.endErr();
  541. mui.toast('数据请求失败');
  542. }
  543. });
  544. }
  545. //查看图片
  546. // document.getElementById('lookImg').addEventListener('tap', function() {
  547. // mui.openWindow({
  548. // url: 'sex_trap_photo2.html',
  549. // id: 'sex_trap_photo2',
  550. // extras: {
  551. // equipId: equipId,
  552. // }
  553. // })
  554. // })
  555. //配置
  556. document.getElementById('configuration').addEventListener('tap', function() {
  557. console.log(confDatF)
  558. console.log(confEt)
  559. console.log(confDatF)
  560. console.log(confSt)
  561. mui.openWindow({
  562. url: 'sex_trap_detail1_config.html',
  563. id: 'sex_trap_detail1_config',
  564. extras: {
  565. equipId: equipId,
  566. confDatF: confDatF,
  567. confTurnT: confTurnT,
  568. confPicT: confPicT,
  569. confPicF: confPicF,
  570. confSt: confSt,
  571. confEt: confEt,
  572. confTs: confTs,
  573. }
  574. })
  575. })
  576. //sim卡查新
  577. document.getElementById('simCodeSearch').addEventListener('tap', function() {
  578. if(iccid) {
  579. $.ajax({
  580. url: 'http://120.27.222.26/siminfo',
  581. data: {
  582. simid: iccid,
  583. },
  584. dataType: 'json', //服务器返回json格式数据
  585. type: 'post', //HTTP请求类型
  586. timeout: 10000, //超时时间设置为10秒;
  587. beforeSend: function() {
  588. plus.nativeUI.showWaiting('请求中...');
  589. },
  590. complete: function() {
  591. plus.nativeUI.closeWaiting();
  592. },
  593. success: function(data) {
  594. var dat = data.data;
  595. if(data.code == 0) {
  596. var status;
  597. if(dat.account_status == "0") {
  598. status = "未知";
  599. } else if(dat.account_status == "1") {
  600. status = "测试期";
  601. } else if(dat.account_status == "2") {
  602. status = "沉默期";
  603. } else if(dat.account_status == "3") {
  604. status = "使用中";
  605. } else if(dat.account_status == "4") {
  606. status = "停机";
  607. } else if(dat.account_status == "5") {
  608. status = "停机保号";
  609. } else if(dat.account_status == "6") {
  610. status = "预销号";
  611. } else if(dat.account_status == "7") {
  612. status = "销号";
  613. }
  614. var usage;
  615. if(dat.iccid) {
  616. usage = dat.data_usage;
  617. } else {
  618. usage.innerHTML = '--';
  619. }
  620. var balance;
  621. if(dat.iccid) {
  622. balance = dat.data_balance;
  623. } else {
  624. balance = '--';
  625. }
  626. var time;
  627. if(dat.iccid) {
  628. var timestamp4 = new Date(dat.expiry_date * 1000); //直接用 new Date(时间戳) 格式转化获得当前时间
  629. time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8);
  630. } else {
  631. time = '--';
  632. }
  633. 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>'
  634. $('#mqttConfDetial').html(html);
  635. mui('.mui-popover').popover('show', document.getElementById("popover"));
  636. }
  637. },
  638. error: function(xhr, type, errorThrown) {
  639. //联网失败的回调,隐藏下拉刷新的状态
  640. mescroll.endErr();
  641. mui.toast('数据请求失败');
  642. }
  643. });
  644. } else {
  645. mui.toast('未查询到SIM卡号');
  646. }
  647. })
  648. //统计详情
  649. // document.getElementById('lookStatsData').addEventListener('tap', function() {
  650. // mui.openWindow({
  651. // url: 'sex_trap_detail_echart.html',
  652. // id: 'sex_trap_detail_echart',
  653. // extras: {
  654. // equipId: equipId
  655. // }
  656. // })
  657. // })
  658. //历史数据
  659. document.getElementById('lookHistoryData').addEventListener('tap', function() {
  660. mui.openWindow({
  661. url: 'sex_trap_detail_list.html',
  662. id: 'sex_trap_detail_list',
  663. extras: {
  664. equipId: equipId
  665. }
  666. })
  667. })
  668. //调试
  669. document.getElementById('debug').addEventListener('tap', function() {
  670. mui('#debugPopover').popover('show', document.getElementById("debug"));
  671. })
  672. //操作
  673. document.getElementById('adminOperate').addEventListener('tap', function() {
  674. mui('#operatePopover').popover('show', document.getElementById("adminOperate"));
  675. })
  676. })
  677. function popupFrame(txt,flag){
  678. var txtMsg = '是否'+ txt +'?';
  679. mui.confirm(txtMsg,'控制',['取消','确定'],function(e){
  680. if(e.index == 0){
  681. // alert(0)
  682. }else if(e.index == 1){
  683. if(flag == 1){
  684. var data = {
  685. ext:'reboot',
  686. }
  687. var fun = function(){};
  688. }else if(flag == 2){
  689. var data = {
  690. ext:'update',
  691. }
  692. var fun = function(){};
  693. }else if(flag == 3){
  694. var data = {
  695. ext:'mqttconf',
  696. }
  697. var fun = function(){
  698. setTimeout(function(){
  699. mui.ajax('http://120.27.222.26/sex_mqtt_detail', {
  700. type:'post',
  701. data:{
  702. e_id:equipId
  703. },
  704. dataType:'json',
  705. beforeSend: function() {
  706. plus.nativeUI.showWaiting("分配中...");
  707. },
  708. complete: function() {
  709. plus.nativeUI.closeWaiting();
  710. },
  711. success:function(data){
  712. var content='<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">ip:'+data.ip+'<br />port:'+data.port+'<br />sub:'+data.sub+'<br />pub:'+data.pub+'<br />lastwill:'+data.lastwill+'<br />keepalive:'+data.keepalive+'<br />username:'+data.username+'<br />stamp:'+data.stamp+'</div>';
  713. $('#mqttConfDetial').html(content);
  714. mui('.mui-popover').popover('toggle',document.getElementById("mqttConf"));
  715. },
  716. error:function(type){
  717. console.log(type)
  718. }
  719. })
  720. },500)
  721. };
  722. }else if(flag == 4){
  723. var data = {
  724. ext:'takephoto',
  725. }
  726. var fun = function(){};
  727. }else if(flag == 5){
  728. var data = {
  729. ext:'turn',
  730. }
  731. var fun = function(){};
  732. }else if(flag == 6){
  733. var data = {
  734. ext:'repower',
  735. }
  736. var fun = function(){};
  737. }else if(flag == 7){
  738. var data = {
  739. ext:'ds1',
  740. }
  741. var fun = function(){};
  742. }else if(flag == 8){
  743. var data = {
  744. ext:'ds0',
  745. }
  746. var fun = function(){};
  747. }else if(flag == 9){
  748. var data = {
  749. ext:'clearnet',
  750. }
  751. var fun = function(){};
  752. }
  753. sendCtrlFun(data,fun)
  754. }
  755. },'div')
  756. }
  757. function sendCtrlFun(data,callback){
  758. data.e_id = equipId;
  759. mui.ajax('http://120.27.222.26/sex_mqtt_v1', {
  760. type:'post',
  761. data:data,
  762. beforeSend: function() {
  763. plus.nativeUI.showWaiting("分配中...");
  764. },
  765. complete: function() {
  766. plus.nativeUI.closeWaiting();
  767. },
  768. success:function(data){
  769. if(data == 0){
  770. callback();
  771. mui.toast('下发成功',{ duration:'long', type:'div' })
  772. }
  773. },
  774. error:function(type){
  775. console.log(type)
  776. }
  777. })
  778. }
  779. </script>
  780. </body>
  781. </html>