baojinginfo.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. (function () {
  2. var page = {
  3. isScroll: false,
  4. init: function ($page,param) {
  5. var url = '/?s=api/get_baojing_info&plate=';
  6. var pageobj = $('#gaojinginfo').lrpagination({
  7. lclass: "lr-list",
  8. rows: 10,
  9. // 每页行数
  10. getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
  11. // param: page: 当前页,rows:行数
  12. setTimeout(function () {
  13. var data = [];
  14. var count = 0;
  15. var page = param.page-1;
  16. renlian.httpget(config.webapi + url + userinfo.baseinfo.plate+'&pagesize='+param.rows+'&page='+page+'&cityid='+userinfo.baseinfo.cityid, {}, function(res) {
  17. var length = 0;
  18. if(res.success == true){
  19. length = res.data.length;
  20. for (var i = 0; i < length; i++) {
  21. // $.each(res.data, function (_index, _item) {
  22. data.push({ ID: res.data[i].ID,AddTime: res.data[i].AddTime,LicensePlate: res.data[i].LicensePlate,DeviceNumber:res.data[i].DeviceNumber, Title:res.data[i].Title})
  23. // })
  24. count = (param.page-1) * param.rows + i + 1;
  25. }
  26. }
  27. if(page === 0 && data.length === 0){
  28. $('#no-message').show();
  29. }else{
  30. $('#no-message').hide();
  31. }
  32. callback(data, count+1);
  33. })
  34. }, 300);
  35. },
  36. renderData: function (_index, _item) {// 渲染数据模板
  37. var _msg_html_list = '';
  38. _msg_html_list+= '\
  39. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  40. <h4 id="time">'+ _item.AddTime +'</h4>\
  41. <p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ (_item.DeviceNumber || "无标签") +'</span></p>\
  42. <a class="lr-nav-right" id="gaojingdetail'+_item.AddTime+'">'+_item.Title+'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  43. </div>';
  44. // $('#gaojingdetail'+_item.AddTime).on('tap', function () {
  45. // renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+_item.Addtime+'"}'});
  46. // });
  47. return _msg_html_list;
  48. },
  49. click: function(item, $item){
  50. renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"ID":"'+item.ID+'"}'});
  51. },
  52. down: {
  53. contentinit: '下拉可以刷新',
  54. contentdown: '下拉可以刷新',
  55. contentover: '释放立即刷新',
  56. contentrefresh: '正在刷新...'
  57. },
  58. up: {
  59. contentinit: '上拉显示更多',
  60. contentdown: '上拉显示更多',
  61. contentrefresh: '正在加载...',
  62. contentnomore: '没有更多数据了'
  63. }
  64. });
  65. var pullrefresh = function(index){
  66. if(Number(index) === 0){
  67. url = '/?s=api/get_baojing_info&plate=';
  68. }else{
  69. url = '/?s=api/get_gonggao_info&plate=';
  70. // url = '/?s=api/get_baojing_info&plate=';
  71. }
  72. pageobj.reload();
  73. // return pageobj;
  74. }
  75. userinfo = renlian.storage.get('userinfo');
  76. $page.find('#toptab').rltoptab(['告警', '公告'], pullrefresh ).each(function (index) {
  77. var $this = $(this);
  78. switch (index) {
  79. case 0:
  80. break;
  81. case 1:
  82. break;
  83. }
  84. $this = null;
  85. });
  86. }
  87. };
  88. return page;
  89. })();