reprotManage_scd.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 rel="stylesheet" href="../css/mescroll.min.css">
  8. <link rel="stylesheet" href="../css/mui.min.css"/>
  9. <style type="text/css">
  10. body{
  11. font-size: 14px;
  12. }
  13. /*蓝色导航*/
  14. .mui-bar {
  15. background-color: #21b2e7;
  16. }
  17. .mui-action-back {
  18. touch-action: none;
  19. }
  20. .mui-title,
  21. .mui-bar a {
  22. color: #fff;
  23. }
  24. /*搜索浮动*/
  25. .searchBox:before{
  26. position: absolute;
  27. content: '';
  28. background: #21b2e7;
  29. width: 100%;
  30. height: 35%;
  31. }
  32. .searchControl{
  33. width: 91%;
  34. margin: 0 auto;
  35. }
  36. .mui-search{
  37. display: inline-block;
  38. width: 79%;
  39. }
  40. .searchBtn,.mui-search >input{
  41. box-shadow: 1px 2px 3px 1px #cccccc;
  42. }
  43. .searchBtn,.mui-search >input{
  44. background: #fff;
  45. }
  46. .searchBtn{
  47. border-color: #fff;
  48. width: 19%;
  49. }
  50. /*列表*/
  51. ul{
  52. padding: 0;
  53. list-style: none;
  54. }
  55. #dataList >li{
  56. padding: 0 20px 10px 20px;
  57. background: #fff;
  58. margin-bottom: 10px;
  59. font-family: '楷体';
  60. }
  61. #dataList >li .topInner{
  62. height: 66px;
  63. }
  64. .icon{
  65. float: left;
  66. width: 40px;
  67. height: 40px;
  68. /*background: blue;*/
  69. border-radius: 50%;
  70. margin-right: 15px;
  71. margin-top: 9px;
  72. line-height: 52px;
  73. text-align: center;
  74. }
  75. .roseRed{
  76. background: radial-gradient(#dbc9fa 5%,#b083ff 60%);
  77. }
  78. .blue{
  79. background: radial-gradient(#b1eaff 5%,#3dcaff 60%);
  80. }
  81. .equipId{
  82. line-height: 35px;
  83. font-size: 16px;
  84. }
  85. .equipName{
  86. font-size: 14px;
  87. }
  88. #dataList >li .bottomInner{
  89. border-top: 1px dashed #d0d0d0;
  90. font-size: 14px;
  91. margin: 0 21px;
  92. padding-top: 9px;
  93. }
  94. .searchBox {
  95. position: fixed;
  96. left: 0;
  97. right: 0;
  98. z-index: 222;
  99. padding: 0;
  100. }
  101. .mescroll{
  102. position: fixed;
  103. top: 73px;
  104. bottom: 0;
  105. height: auto; /*如设置bottom:50px,则需height:auto才能生效*/
  106. }
  107. </style>
  108. </head>
  109. <body>
  110. <header class="mui-bar mui-bar-nav">
  111. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  112. <h1 class="mui-title">杀虫灯报表管理</h1>
  113. </header>
  114. <div class="mui-content">
  115. <div class="searchBox">
  116. <div class="searchControl">
  117. <div class="mui-input-row mui-search">
  118. <input type="search" id="searchInp" class="mui-input-clear" placeholder="请输入设备ID">
  119. </div>
  120. <button id="searchBtn" class="searchBtn">搜索</button>
  121. </div>
  122. </div>
  123. <div id="scrollPlace" class="mescroll"> <!--id可以改,而"mescroll"的class不能删-->
  124. <ul id="dataList">
  125. <!--<li class="" data-id="">
  126. <div class="topInner">
  127. <div class="icon roseRed">
  128. <img src="../images/scdBulb.png" width="25"/>
  129. </div>
  130. <h1 class="equipId">设备ID:84512134543231545</h1>
  131. <p class="equipName">设备名称:无</p>
  132. </div>
  133. 删除了上报时间
  134. <div class="bottomInner">
  135. <p>上报时间:2018-12-03 09:41:21</p>
  136. </div>
  137. </li>-->
  138. </ul>
  139. </div>
  140. </div>
  141. <script src="../js/jquery-2.1.0.js"></script>
  142. <script src="../js/mescroll.min.js" charset="utf-8"></script>
  143. <script src="../js/mui.min.js"></script>
  144. <script type="text/javascript">
  145. mui.init();
  146. var mescroll;
  147. document.addEventListener('plusready',function () {
  148. //创建MeScroll对象,内部已默认开启下拉刷新,自动执行up.callback,重置列表数据;
  149. mescroll = new MeScroll("scrollPlace", {
  150. up: {
  151. callback: getListData, //上拉回调,此处可简写; 相当于 callback: function (page) { getListData(page); }
  152. isBounce: false, //此处禁止ios回弹,解析(务必认真阅读,特别是最后一点): http://www.mescroll.com/qa.html#q10
  153. clearEmptyId: "dataList", //1.下拉刷新时会自动先清空此列表,再加入数据; 2.无任何数据时会在此列表自动提示空
  154. toTop:{ //配置回到顶部按钮
  155. src : "../images/totop.png", //默认滚动到1000px显示,可配置offset修改
  156. offset : 700
  157. },
  158. empty: {
  159. //列表第一页无任何数据时,显示的空提示布局; 需配置warpId才显示
  160. warpId: "dataList", //父布局的id (1.3.5版本支持传入dom元素)
  161. icon: "../images/listNull.png", //图标,默认null,支持网络图
  162. tip: "暂无相关数据~" //提示
  163. },
  164. htmlNodata: '<p class="upwarp-nodata">-- 没有更多内容了 --</p>',
  165. noMoreSize: 5, //如果列表已无数据,可设置列表的总数量要大于5才显示无更多数据;
  166. lazyLoad: {
  167. use: true // 是否开启懒加载,默认false
  168. }
  169. }
  170. });
  171. },false);
  172. /*联网加载列表数据 page = {num:1, size:10}; num:当前页 从1开始, size:每页数据条数 */
  173. function getListData(page){
  174. //联网加载数据
  175. getListDataFromNet(page.num, page.size, function(curPageData,totalSize){
  176. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  177. //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
  178. //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
  179. mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
  180. //设置列表数据,因为配置了emptyClearId,第一页会清空dataList的数据,所以setListData应该写在最后;
  181. setListData(curPageData);
  182. }, function(){
  183. //联网失败的回调,隐藏下拉刷新和上拉加载的状态;
  184. mescroll.endErr();
  185. mui.toast('数据请求失败');
  186. });
  187. }
  188. /*设置列表数据*/
  189. function setListData(curPageData){
  190. var html = '';
  191. // var listDom=document.getElementById("dataList");
  192. var dat = curPageData;
  193. for(var i = 0; i < dat.length; i++) {
  194. var equip_name = dat[i].equip_name || '无';
  195. var className;
  196. if(i%2 == 0){
  197. className = 'blue';
  198. }else{
  199. className = 'roseRed';
  200. }
  201. html += '<li class="" data-id="'+dat[i].equip_id+'"><div class="topInner"><div class="icon '+className+'"><img src="../images/scdBulb.png" width="25"/></div>'+
  202. '<h1 class="equipId">设备ID:'+dat[i].equip_id+'</h1><p class="equipName">设备名称:'+equip_name+'</p>'+
  203. '</div></li>';
  204. }
  205. $('#dataList').append(html);
  206. }
  207. /*联网加载列表数据*/
  208. function getListDataFromNet(pageNum,pageSize,successCallback,errorCallback) {
  209. $.ajax({
  210. type: 'POST',
  211. url: 'http://120.27.222.26/app_reportmanage',
  212. timeout : 10000, //超时时间设置,单位毫秒
  213. data:{
  214. 'etype': 'scd',
  215. 'page': pageNum,
  216. 'filter': mui('#searchInp')[0].value,
  217. },
  218. // beforeSend: function() {
  219. // plus.nativeUI.showWaiting('请求中...');
  220. // },
  221. // complete: function() {
  222. // plus.nativeUI.closeWaiting();
  223. // },
  224. dataType: 'json',
  225. success: function(data){
  226. successCallback(data.dat,data.nums);
  227. },
  228. error: function(){
  229. errorCallback();
  230. }
  231. });
  232. }
  233. //进入详情页面
  234. mui('#dataList').on('tap', 'li', function() {
  235. var imei = this.getAttribute('data-id');
  236. var upl_time = $(this).find('.upl_time').html();console.log(upl_time)
  237. markingid = imei;
  238. mui.openWindow({
  239. url: 'reprotManage_scd_detail.html',
  240. id: 'reprotManage_scd_detail',
  241. extras: {
  242. 'equipId': imei,
  243. 'upl_time':upl_time
  244. },
  245. })
  246. })
  247. //搜索操作
  248. $("#searchInp").on('keypress',function(e) {
  249. var keycode = e.keyCode;
  250. if(keycode=='13') {
  251. e.preventDefault();
  252. //请求搜索接口
  253. if(mui('#searchInp')[0].value) {
  254. $('#dataList').html('');
  255. getListData({num:1, size:10})
  256. } else {
  257. mui.toast("请输入设备ID");
  258. }
  259. }
  260. })
  261. document.getElementById('searchBtn').addEventListener('tap', function() {
  262. if(mui('#searchInp')[0].value) {
  263. $('#dataList').html('');
  264. getListData({num:1, size:10})
  265. } else {
  266. mui.toast("请输入设备ID");
  267. }
  268. })
  269. </script>
  270. </body>
  271. </html>