(function () { var page = { isScroll: false, init: function ($page,param) { userinfo = renlian.storage.get('userinfo'); $page.find('#toptab').rltoptab(['告警', '公告']).each(function (index) { var $this = $(this); switch (index) { case 0: // var msg_html = ''; // msg_html += '\ //
\ //
\ //
\ //
\ //
\ //
\ // \ //
\ //
'; // $this.html(msg_html); // //var baojing_info = ''; // userinfo = renlian.storage.get('userinfo'); // renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) { // console.log(res) // if(res.success == true){ // var msg_html_list = ''; // $.each(res.data, function (_index, _item) { // msg_html_list += '\ //
\ //

'+ _item.AddTime +'

\ //

'+ _item.LicensePlate +''+ _item.DeviceNumber +'

\ // 告警详情\ //
'; // $page.find('.gaojinginfo').html(msg_html_list); // var addtime = $('#time').text(); // $('.gaojingdetail').on('tap', function () { // renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'}); // }); // }); // }else{ // msg_html += '

暂无消息

'; // $page.find('.gaojinginfo').html(msg_html); // } // }); // //msg_html += ''; // //刷新 var pageobj = $('#gaojinginfo').lrpagination({ lclass: "lr-list", rows: 5, // 每页行数 getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调 // param: page: 当前页,rows:行数 setTimeout(function () { var data = []; var count = 0; var page = param.page-1; renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate+'&pagesize='+param.rows+'&page='+page, {}, function(res) { var length = 0; if(res.success == true){ length = res.data.length; for (var i = 0; i < length; i++) { // $.each(res.data, function (_index, _item) { 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}) // }) count = (param.page-1) * param.rows + i + 1; } // count = (param.page-1) * param.rows + i + 1; } if($.isArray(data) && data.length === 0){ $('#no-message').show(); }else{ $('#no-message').hide(); } callback(data, count+1); }) }, 1000); }, renderData: function (_index, _item) {// 渲染数据模板 var _msg_html_list = ''; _msg_html_list+= '\
\

'+ _item.AddTime +'

\

'+ _item.LicensePlate +''+ _item.DeviceNumber +'

\ '+_item.Title+'详情\
'; // $('#gaojingdetail'+_item.AddTime).on('tap', function () { // renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+_item.Addtime+'"}'}); // }); return _msg_html_list; }, click: function(item, $item){ renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"ID":"'+item.ID+'"}'}); }, down: { contentinit: '下拉可以刷新', contentdown: '下拉可以刷新', contentover: '释放立即刷新', contentrefresh: '正在刷新...' }, up: { contentinit: '上拉显示更多', contentdown: '上拉显示更多', contentrefresh: '正在加载...', contentnomore: '没有更多数据了' } }); //刷新结束 break; case 1: // var msg_html = ''; // var msg_html = ''; // msg_html += '\ //
\ //
\ //
\ //
\ //
\ //
\ // \ //
\ //
'; // $this.html(msg_html); // //var baojing_info = '{"0":{"data":"1111","msg":"公告","time":"2/28"},"1":{"data":"2222","msg":"公告","time":"2/29"}}'; // renlian.httpget(config.webapi + "/?s=api/get_gonggao_info&plate="+userinfo.baseinfo.plate, {}, function(res) { // var msg_html_list = ''; // if(res.success == true){ // $.each(res.data, function (_index, _item) { // msg_html_list += '\ //
\ //

'+ _item.AddTime +'

\ //

'+ _item.LicensePlate +''+ _item.DeviceNumber +'

\ // 公告详情\ //
'; // $page.find('.gonggaoinfo').html(msg_html_list); // $('.gonggaodetail').on('tap', function () { // var addtime = $('#time').text(); // renlian.nav.go({ path: 'noticedetail', title: '公告详情', type: 'right', param:'{"addtime":"'+addtime+'"}'}); // }); // }); // }else{ // msg_html += '

暂无消息

'; // $page.find('.gonggaoinfo').html(msg_html); // } // }); // break; } $this = null; }); } }; return page; })();