sex_trap_detail1.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  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="volt_ct"></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_drec"></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="wind_sped"></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 class="mui-col-sm-4 annular">
  331. <div class="mui-pull-left">
  332. </div>
  333. <div class="equipmentBox">
  334. <p class="equipState equipmentBox_val" id="cs"></p>
  335. <p class="equipFun">信号强度</p>
  336. </div>
  337. </div>-->
  338. </div>
  339. <!--设备数据测试-->
  340. </div>
  341. </div>
  342. <!--调试框-->
  343. <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;">
  344. <div class="mui-popover-arrow"></div>
  345. <div class="btns">
  346. <p><button type="button" onclick="popupFrame('开启设备',7)" class="mui-btn mui-btn-danger">开启</button></p>
  347. <p><button type="button" onclick="popupFrame('关闭设备',8)" class="mui-btn mui-btn-danger">关闭</button></p>
  348. <p><button type="button" onclick="popupFrame('重启设备',1)" class="mui-btn mui-btn-danger">重启</button></p>
  349. <p><button type="button" onclick="popupFrame('进行清网',9)" class="mui-btn mui-btn-danger">清网</button></p>
  350. </div>
  351. </div>
  352. <!--操作框-->
  353. <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;">
  354. <div class="mui-popover-arrow">1</div>
  355. <div class="btns">
  356. <p><button type="button" onclick="popupFrame('开启设备',7)" class="mui-btn mui-btn-danger">开启</button></p>
  357. <p><button type="button" onclick="popupFrame('关闭设备',8)" class="mui-btn mui-btn-danger">关闭</button></p>
  358. <p><button type="button" onclick="popupFrame('重启设备',1)" class="mui-btn mui-btn-danger">重启</button></p>
  359. <p><button type="button" onclick="popupFrame('进行清网',9)" class="mui-btn mui-btn-danger">清网</button></p>
  360. <p><button type="button" onclick="popupFrame('升级',2)" class="mui-btn mui-btn-danger">升级</button></p>
  361. <p><button type="button" onclick="popupFrame('查询mqtt网络配置',3)" class="mui-btn mui-btn-danger">mqtt网络配置</button></p>
  362. </div>
  363. </div>
  364. <!--sim卡-->
  365. <div id="popover" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 310px;background-color: #fff;">
  366. <div class="mui-popover-arrow"></div>
  367. <!--<div class="popoverheader">
  368. <div class="text"></div>
  369. <a href="#popover"><img src="../image/close.png" alt=""></a>
  370. </div>-->
  371. <div id="simDetial">
  372. </div>
  373. <div class="mui-table-view mui-table-view-chevron next">
  374. <a href="#popover" class="x-next add">我知道了</a>
  375. </div>
  376. </div>
  377. <!--mqtt网络配置-->
  378. <div id="mqttConf" class="box mui-popover mui-poppicker mui-popover-action mui-popover-bottom" style="height: 310px;background-color: #fff;">
  379. <div class="mui-popover-arrow"></div>
  380. <!--<div class="popoverheader">
  381. <div class="text"></div>
  382. <a href="#popover"><img src="../image/close.png" alt=""></a>
  383. </div>-->
  384. <div id="mqttConfDetial">
  385. </div>
  386. <div class="mui-table-view mui-table-view-chevron next">
  387. <a href="#mqttConf" class="x-next add">我知道了</a>
  388. </div>
  389. </div>
  390. </div>
  391. <div id="map" style="display: none;"></div>
  392. <script src="../js/jquery-2.1.0.js"></script>
  393. <script src="../js/mui.min.js"></script>
  394. <script src="../js/common.js"></script>
  395. <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=La58N63t7hPhafQ7Eror2kon"></script>
  396. <script type="text/javascript">
  397. var equipId;
  398. var iccid;
  399. //配置需要参数
  400. var confDatF;
  401. var confTurnT;
  402. var confPicT;
  403. var confPicF;
  404. var confSt;
  405. var confEt;
  406. var confTs;
  407. mui.init();
  408. mui.plusReady(function() {
  409. var self = plus.webview.currentWebview();
  410. equipId = self.equipId;
  411. $('#equipId').html('设备ID:' + equipId);
  412. console.log(equipId);
  413. downCallback()
  414. var isuser = plus.storage.getItem('isuser');
  415. if(isuser == 'admin'){
  416. $('#adminOperate').show();
  417. }
  418. var map = new BMap.Map("map"); //
  419. geoc = new BMap.Geocoder();
  420. function downCallback() {
  421. $.ajax({
  422. url: 'http://120.27.222.26/app_equipmanage_detail',
  423. data: {
  424. 'etype': 'xycb',
  425. 'equip_id': equipId,
  426. },
  427. dataType: 'json', //服务器返回json格式数据
  428. type: 'post', //HTTP请求类型
  429. timeout: 10000, //超时时间设置为10秒;
  430. beforeSend: function() {
  431. plus.nativeUI.showWaiting('请求中...');
  432. },
  433. complete: function() {
  434. plus.nativeUI.closeWaiting();
  435. },
  436. success: function(data) {
  437. var equip_name = data.equip_name || '无';
  438. $('#equipName').html('设备名称:' + equip_name);
  439. $('#upl_time').html('上报时间:' + data.upl_time);
  440. var stat = eval('(' + data.ybq_status + ')');
  441. var point = new BMap.Point(stat.lng, stat.lat);
  442. geoc.getLocation(point, function (rs) {
  443. var addComp = rs.addressComponents;
  444. $('#lat_lng').html('位置:' + addComp.province + ", " + addComp.city + ", " + addComp.district);
  445. });
  446. $('#equipCode').html('设备编号:' + stat.dev_num);
  447. if(stat.proj == "SEX_TRAP_1"){
  448. $('#equipType').html('设备型号:I');
  449. }else if(stat.proj == "SEX_TRAP_2"){
  450. $('#equipType').html('设备型号:II');
  451. }
  452. var ds = stat.ds == 0 ? '关闭' : '开机';
  453. $('#ds').html(ds);
  454. var onOff = data.is_online == 0 ? '离线' : '在线';
  455. $('#onOff').html(onOff);
  456. var ws = stat.ws == 0 ? '待机' : '工作';
  457. $('#ws').html(ws);
  458. if(stat.bs != ''){
  459. if(stat.bs == 0){
  460. var bs = '正常';
  461. }else if(stat.bs == 1){
  462. var bs = '欠压';
  463. }else if(stat.bs == 2){
  464. var bs = '过压';
  465. }
  466. $('#bs').html(bs);
  467. }else{
  468. $('#bs').html('--');
  469. }
  470. if(stat.bv != ''){
  471. $('#bv').html(stat.bv/1000 + '<span class="unit">v</span>');
  472. }else{
  473. $('#bv').html('--');
  474. }
  475. if(stat.cv !== ''){
  476. $('#cv').html(stat.cv/1000 + '<span class="unit">v</span>');
  477. }else{
  478. $('#cv').html('--');
  479. }
  480. $('#dver').html(stat.dver);
  481. if(stat.cs !== ''){
  482. var cs = stat.cs == 0 ? '未充电' : '充电';
  483. }else{
  484. var cs = '--';
  485. }
  486. if (stat.rps !== '') {
  487. var rps = stat.rps == 0 ? '正常' : '雨控'
  488. } else {
  489. var rps = '--'
  490. }
  491. if (stat.tps !== '') {
  492. var tps = stat.tps == 0 ? '正常' : '温控'
  493. } else {
  494. var tps = '--'
  495. }
  496. if (stat.dps !== '') {
  497. var dps = stat.dps == 0 ? '正常' : '倾倒'
  498. } else {
  499. var dps = '--'
  500. }
  501. if (stat.infr_ct !== '') {
  502. var infr_ct = stat.infr_ct
  503. } else {
  504. var infr_ct = '--'
  505. }
  506. if (stat.volt_ct !== '') {
  507. var volt_ct = stat.volt_ct
  508. } else {
  509. var volt_ct = '--'
  510. }
  511. if (stat.wind_drec !== '') {
  512. var wind_drec = stat.wind_drec
  513. } else {
  514. var wind_drec = '--'
  515. }
  516. if (stat.wind_sped !== '') {
  517. var wind_sped = stat.wind_sped
  518. } else {
  519. var wind_sped = '--'
  520. }
  521. $('#wind_sped').html(wind_sped + '<span class="unit">M/S</span>')
  522. $('#wind_drec').html(wind_drec)
  523. $('#volt_ct').html(volt_ct)
  524. $('#infr_ct').html(infr_ct)
  525. $('#dps').html(dps)
  526. $('#tps').html(tps)
  527. $('#rps').html(rps)
  528. $('#cs').html(cs);
  529. $('#dat_f').html(stat.dat_f);
  530. $('#cpu_tmp').html(stat.cpu_tmp/1000);
  531. $('#csq').html(stat.csq);
  532. if(stat.at != ''){
  533. $('#at').html(stat.at + '<span class="unit">°C</span>');
  534. }else{
  535. $('#at').html('-');
  536. }
  537. if(stat.ah != ''){
  538. $('#ah').html(stat.ah + '<span class="unit">RH</span>');
  539. }else{
  540. $('#ah').html('--');
  541. }
  542. iccid = stat.iccid;
  543. confDatF = stat.dat_f;
  544. confTurnT = stat.turn_t;
  545. confPicT = stat.pic_t;
  546. confPicF = stat.pic_f;
  547. confSt = stat.st
  548. confEt = stat.et
  549. confTs = stat.ts
  550. },
  551. error: function(xhr, type, errorThrown) {
  552. //联网失败的回调,隐藏下拉刷新的状态
  553. mescroll.endErr();
  554. mui.toast('数据请求失败');
  555. }
  556. });
  557. }
  558. //查看图片
  559. // document.getElementById('lookImg').addEventListener('tap', function() {
  560. // mui.openWindow({
  561. // url: 'sex_trap_photo2.html',
  562. // id: 'sex_trap_photo2',
  563. // extras: {
  564. // equipId: equipId,
  565. // }
  566. // })
  567. // })
  568. //配置
  569. document.getElementById('configuration').addEventListener('tap', function() {
  570. console.log(confDatF)
  571. console.log(confEt)
  572. console.log(confDatF)
  573. console.log(confSt)
  574. mui.openWindow({
  575. url: 'sex_trap_detail1_config.html',
  576. id: 'sex_trap_detail1_config',
  577. extras: {
  578. equipId: equipId,
  579. confDatF: confDatF,
  580. confTurnT: confTurnT,
  581. confPicT: confPicT,
  582. confPicF: confPicF,
  583. confSt: confSt,
  584. confEt: confEt,
  585. confTs: confTs,
  586. }
  587. })
  588. })
  589. //sim卡查新
  590. document.getElementById('simCodeSearch').addEventListener('tap', function() {
  591. if(iccid) {
  592. $.ajax({
  593. url: 'http://120.27.222.26/siminfo',
  594. data: {
  595. simid: iccid,
  596. },
  597. dataType: 'json', //服务器返回json格式数据
  598. type: 'post', //HTTP请求类型
  599. timeout: 10000, //超时时间设置为10秒;
  600. beforeSend: function() {
  601. plus.nativeUI.showWaiting('请求中...');
  602. },
  603. complete: function() {
  604. plus.nativeUI.closeWaiting();
  605. },
  606. success: function(data) {
  607. var dat = data.data;
  608. if(data.code == 0) {
  609. var status;
  610. if(dat.account_status == "0") {
  611. status = "未知";
  612. } else if(dat.account_status == "1") {
  613. status = "测试期";
  614. } else if(dat.account_status == "2") {
  615. status = "沉默期";
  616. } else if(dat.account_status == "3") {
  617. status = "使用中";
  618. } else if(dat.account_status == "4") {
  619. status = "停机";
  620. } else if(dat.account_status == "5") {
  621. status = "停机保号";
  622. } else if(dat.account_status == "6") {
  623. status = "预销号";
  624. } else if(dat.account_status == "7") {
  625. status = "销号";
  626. }
  627. var usage;
  628. if(dat.iccid) {
  629. usage = dat.data_usage;
  630. } else {
  631. usage.innerHTML = '--';
  632. }
  633. var balance;
  634. if(dat.iccid) {
  635. balance = dat.data_balance;
  636. } else {
  637. balance = '--';
  638. }
  639. var time;
  640. if(dat.iccid) {
  641. var timestamp4 = new Date(dat.expiry_date * 1000); //直接用 new Date(时间戳) 格式转化获得当前时间
  642. time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8);
  643. } else {
  644. time = '--';
  645. }
  646. 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>'
  647. $('#mqttConfDetial').html(html);
  648. mui('.mui-popover').popover('show', document.getElementById("popover"));
  649. }
  650. },
  651. error: function(xhr, type, errorThrown) {
  652. //联网失败的回调,隐藏下拉刷新的状态
  653. mescroll.endErr();
  654. mui.toast('数据请求失败');
  655. }
  656. });
  657. } else {
  658. mui.toast('未查询到SIM卡号');
  659. }
  660. })
  661. //统计详情
  662. // document.getElementById('lookStatsData').addEventListener('tap', function() {
  663. // mui.openWindow({
  664. // url: 'sex_trap_detail_echart.html',
  665. // id: 'sex_trap_detail_echart',
  666. // extras: {
  667. // equipId: equipId
  668. // }
  669. // })
  670. // })
  671. //历史数据
  672. document.getElementById('lookHistoryData').addEventListener('tap', function() {
  673. mui.openWindow({
  674. url: 'sex_trap_detail_list.html',
  675. id: 'sex_trap_detail_list',
  676. extras: {
  677. equipId: equipId
  678. }
  679. })
  680. })
  681. //调试
  682. document.getElementById('debug').addEventListener('tap', function() {
  683. mui('#debugPopover').popover('show', document.getElementById("debug"));
  684. })
  685. //操作
  686. document.getElementById('adminOperate').addEventListener('tap', function() {
  687. mui('#operatePopover').popover('show', document.getElementById("adminOperate"));
  688. })
  689. })
  690. function popupFrame(txt,flag){
  691. var txtMsg = '是否'+ txt +'?';
  692. mui.confirm(txtMsg,'控制',['取消','确定'],function(e){
  693. if(e.index == 0){
  694. // alert(0)
  695. }else if(e.index == 1){
  696. if(flag == 1){
  697. var data = {
  698. ext:'reboot',
  699. }
  700. var fun = function(){};
  701. }else if(flag == 2){
  702. var data = {
  703. ext:'update',
  704. }
  705. var fun = function(){};
  706. }else if(flag == 3){
  707. var data = {
  708. ext:'mqttconf',
  709. }
  710. var fun = function(){
  711. setTimeout(function(){
  712. mui.ajax('http://120.27.222.26/sex_mqtt_detail', {
  713. type:'post',
  714. data:{
  715. e_id:equipId
  716. },
  717. dataType:'json',
  718. beforeSend: function() {
  719. plus.nativeUI.showWaiting("分配中...");
  720. },
  721. complete: function() {
  722. plus.nativeUI.closeWaiting();
  723. },
  724. success:function(data){
  725. 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>';
  726. $('#mqttConfDetial').html(content);
  727. mui('.mui-popover').popover('toggle',document.getElementById("mqttConf"));
  728. },
  729. error:function(type){
  730. console.log(type)
  731. }
  732. })
  733. },500)
  734. };
  735. }else if(flag == 4){
  736. var data = {
  737. ext:'takephoto',
  738. }
  739. var fun = function(){};
  740. }else if(flag == 5){
  741. var data = {
  742. ext:'turn',
  743. }
  744. var fun = function(){};
  745. }else if(flag == 6){
  746. var data = {
  747. ext:'repower',
  748. }
  749. var fun = function(){};
  750. }else if(flag == 7){
  751. var data = {
  752. ext:'ds1',
  753. }
  754. var fun = function(){};
  755. }else if(flag == 8){
  756. var data = {
  757. ext:'ds0',
  758. }
  759. var fun = function(){};
  760. }else if(flag == 9){
  761. var data = {
  762. ext:'clearnet',
  763. }
  764. var fun = function(){};
  765. }
  766. sendCtrlFun(data,fun)
  767. }
  768. },'div')
  769. }
  770. function sendCtrlFun(data,callback){
  771. data.e_id = equipId;
  772. mui.ajax('http://120.27.222.26/sex_mqtt_v1', {
  773. type:'post',
  774. data:data,
  775. beforeSend: function() {
  776. plus.nativeUI.showWaiting("分配中...");
  777. },
  778. complete: function() {
  779. plus.nativeUI.closeWaiting();
  780. },
  781. success:function(data){
  782. if(data == 0){
  783. callback();
  784. mui.toast('下发成功',{ duration:'long', type:'div' })
  785. }
  786. },
  787. error:function(type){
  788. console.log(type)
  789. }
  790. })
  791. }
  792. </script>
  793. </body>
  794. </html>