reprotManage_cbd.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. border-left: 1px dashed #72c6e5;
  57. margin-left: 20px;
  58. padding-bottom: 17px;
  59. }
  60. .equipItem{
  61. margin:0 20px 0px 18px;
  62. position: relative;
  63. background: #fff;
  64. border-radius: 7px;
  65. padding:12px;
  66. }
  67. .equipItem:before{
  68. position: absolute;
  69. top: 20px;
  70. left: -25px;
  71. width: 12px;
  72. height: 12px;
  73. border-radius: 50%;
  74. content: '';
  75. }
  76. .equipItem:after{
  77. position: absolute;
  78. top: 18px;
  79. left: -7px;
  80. width: 0;
  81. height: 0;
  82. content: '';
  83. background-size: 100% 100%;
  84. border: 8px solid #fff;
  85. border-left-color: transparent;
  86. border-top-color: transparent;
  87. transform: rotate(-225deg);
  88. }
  89. .upl_time{
  90. font-size: 16px;
  91. line-height: 30px;
  92. font-weight: bold;
  93. }
  94. .equipTitle{
  95. line-height: 30px;
  96. }
  97. .equipIdIcon{
  98. vertical-align: middle;
  99. margin-right: 3px;
  100. }
  101. .logoItemimg{
  102. position: absolute;
  103. right: 20px;
  104. bottom: 30px;
  105. display: block;
  106. border-radius: 50%;
  107. width: 40px;
  108. height: 40px;
  109. line-height: 42px;
  110. text-align: center;
  111. font-family: '黑体';
  112. font-size: 18px;
  113. }
  114. .logoItemimg:active{
  115. box-shadow: none !important;
  116. }
  117. .equipItem:active{
  118. background-color: #e4e3e3 !important;
  119. }
  120. .equipItem:active.equipItem:after{
  121. border: 8px solid #e4e3e3;
  122. border-left-color: transparent;
  123. border-top-color: transparent;
  124. }
  125. /*皮肤*/
  126. .blue:before{
  127. background: #00b9fe;
  128. }
  129. .blue .upl_time{
  130. color: #00b9fe;
  131. }
  132. .blue .logoItemimg{
  133. color: #6fc2e6;
  134. box-shadow: 2px 3px 7px 0px #66c6ea;
  135. background: radial-gradient(#d1eaf3, #2dc1fe);
  136. }
  137. .purple:before{
  138. background: #c8c6f7;
  139. }
  140. .purple .upl_time{
  141. color: #c8c6f7;
  142. }
  143. .purple .logoItemimg{
  144. color: #c8c6f7;
  145. box-shadow: 2px 3px 7px 0px #c8c6f7;
  146. background: radial-gradient(#edeef4, #c8c6f7);
  147. }
  148. .searchBox {
  149. position: fixed;
  150. left: 0;
  151. right: 0;
  152. z-index: 222;
  153. padding: 0;
  154. }
  155. .mescroll{
  156. position: fixed;
  157. top: 73px;
  158. bottom: 0;
  159. height: auto; /*如设置bottom:50px,则需height:auto才能生效*/
  160. }
  161. </style>
  162. </head>
  163. <body>
  164. <header class="mui-bar mui-bar-nav">
  165. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  166. <h1 class="mui-title">测报灯报表管理</h1>
  167. </header>
  168. <div class="mui-content">
  169. <div class="searchBox">
  170. <div class="searchControl">
  171. <div class="mui-input-row mui-search">
  172. <input type="search" id="searchInp" class="mui-input-clear" placeholder="请输入设备ID">
  173. </div>
  174. <button id="searchBtn" class="searchBtn">搜索</button>
  175. </div>
  176. </div>
  177. <div id="scrollPlace" class="mescroll"> <!--id可以改,而"mescroll"的class不能删-->
  178. <ul id="dataList">
  179. <!--<li>
  180. <div class="equipItem blue">
  181. <div class="upl_time">2018-12-13 09:13:02</div>
  182. <div class="equipTitle">
  183. <img class="equipIdIcon" src="../images/IDicon.png" width="22"/>
  184. <span class="">84521212212122</span>
  185. </div>
  186. <div class="equipTitle">
  187. <img class="equipIdIcon" src="../images/nameicon.png" width="22"/>
  188. <span class="">山东测报灯</span>
  189. </div>
  190. <!--<img class="logoItemimg" src="../images/lookitem.png"/ width="45">
  191. <div class="logoItemimg">→</div>
  192. </div>
  193. </li>-->
  194. </ul>
  195. </div>
  196. </div>
  197. <script src="../js/jquery-2.1.0.js"></script>
  198. <script src="../js/mescroll.min.js" charset="utf-8"></script>
  199. <script src="../js/mui.min.js"></script>
  200. <script type="text/javascript">
  201. mui.init()
  202. //创建MeScroll对象,内部已默认开启下拉刷新,自动执行up.callback,重置列表数据;
  203. var mescroll = new MeScroll("scrollPlace", {
  204. up: {
  205. callback: getListData, //上拉回调,此处可简写; 相当于 callback: function (page) { getListData(page); }
  206. isBounce: false, //此处禁止ios回弹,解析(务必认真阅读,特别是最后一点): http://www.mescroll.com/qa.html#q10
  207. clearEmptyId: "dataList", //1.下拉刷新时会自动先清空此列表,再加入数据; 2.无任何数据时会在此列表自动提示空
  208. toTop:{ //配置回到顶部按钮
  209. src : "../images/totop.png", //默认滚动到1000px显示,可配置offset修改
  210. offset : 700
  211. },
  212. empty: {
  213. //列表第一页无任何数据时,显示的空提示布局; 需配置warpId才显示
  214. warpId: "dataList", //父布局的id (1.3.5版本支持传入dom元素)
  215. icon: "../images/listNull.png", //图标,默认null,支持网络图
  216. tip: "暂无相关数据~" //提示
  217. },
  218. htmlNodata: '<p class="upwarp-nodata">-- 没有更多内容了 --</p>',
  219. noMoreSize: 5, //如果列表已无数据,可设置列表的总数量要大于5才显示无更多数据;
  220. lazyLoad: {
  221. use: true // 是否开启懒加载,默认false
  222. }
  223. }
  224. });
  225. /*联网加载列表数据 page = {num:1, size:10}; num:当前页 从1开始, size:每页数据条数 */
  226. function getListData(page){
  227. //联网加载数据
  228. getListDataFromNet(page.num, page.size, function(curPageData,totalSize){
  229. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  230. //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
  231. //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
  232. mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
  233. //设置列表数据,因为配置了emptyClearId,第一页会清空dataList的数据,所以setListData应该写在最后;
  234. setListData(curPageData);
  235. }, function(){
  236. //联网失败的回调,隐藏下拉刷新和上拉加载的状态;
  237. mescroll.endErr();
  238. mui.toast('数据请求失败');
  239. });
  240. }
  241. /*设置列表数据*/
  242. function setListData(curPageData){
  243. var html = '';
  244. // var listDom=document.getElementById("dataList");
  245. var dat = curPageData;
  246. for(var i = 0; i < dat.length; i++) {
  247. var equip_name = dat[i].equip_name || '无';
  248. var className;
  249. if(i%2 == 0){
  250. className = 'blue';
  251. }else{
  252. className = 'purple';
  253. }
  254. html += '<li data-id='+dat[i].equip_id+'><div class="equipItem '+className+'">'+
  255. '<div class="equipTitle"><img class="equipIdIcon" src="../images/IDicon.png" width="22"/>'+
  256. '<span class="">'+dat[i].equip_id+'</span></div><div class="equipTitle">'+
  257. '<img class="equipIdIcon" src="../images/nameicon.png" width="22"/><span class="">'+equip_name+'</span>'+
  258. '</div><div class="logoItemimg">→</div></div></li>';
  259. }
  260. $('#dataList').append(html);
  261. }
  262. /*联网加载列表数据*/
  263. function getListDataFromNet(pageNum,pageSize,successCallback,errorCallback) {
  264. $.ajax({
  265. type: 'POST',
  266. url: 'http://120.27.222.26/app_reportmanage',
  267. timeout : 10000, //超时时间设置,单位毫秒
  268. data:{
  269. 'etype': 'cbd',
  270. 'page': pageNum,
  271. 'filter': mui('#searchInp')[0].value,
  272. },
  273. dataType: 'json',
  274. success: function(data){
  275. successCallback(data.dat,data.nums);
  276. },
  277. error: function(){
  278. errorCallback();
  279. }
  280. });
  281. }
  282. //进入详情页面
  283. mui('#dataList').on('tap', 'li', function() {
  284. var imei = this.getAttribute('data-id');
  285. var upl_time = $(this).find('.upl_time').html();console.log(upl_time)
  286. markingid = imei;
  287. mui.openWindow({
  288. url: 'reprotManage_cbd_detail.html',
  289. id: 'reprotManage_cbd_detail',
  290. extras: {
  291. 'equipId': imei,
  292. 'upl_time':upl_time
  293. },
  294. })
  295. })
  296. //搜索操作
  297. $("#searchInp").on('keypress',function(e) {
  298. var keycode = e.keyCode;
  299. if(keycode=='13') {
  300. e.preventDefault();
  301. //请求搜索接口
  302. if(mui('#searchInp')[0].value) {
  303. $('#dataList').html('');
  304. getListData({num:1, size:10})
  305. } else {
  306. mui.toast("请输入设备ID");
  307. }
  308. }
  309. })
  310. document.getElementById('searchBtn').addEventListener('tap', function() {
  311. if(mui('#searchInp')[0].value) {
  312. $('#dataList').html('');
  313. getListData({num:1, size:10})
  314. } else {
  315. mui.toast("请输入设备ID");
  316. }
  317. })
  318. </script>
  319. </body>
  320. </html>