123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- (function () {
- var page = {
- isScroll: false,
- init: function ($page,param) {
- var url = '/?s=api/get_baojing_info&plate=';
- var pageobj = $('#gaojinginfo').lrpagination({
- lclass: "lr-list",
- rows: 10,
-
- // 每页行数
- 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 + url + userinfo.baseinfo.plate+'&pagesize='+param.rows+'&page='+page+'&cityid='+userinfo.baseinfo.cityid, {}, function(res) {
- var length = 0;
- //console.log(res);
- if(res.success == true){
- length = res.data.length;
- for (var i = 0; i < length; i++) {
- // $.each(res.data, function (_index, _item) {
- if(res.data[i].Type != '9'){
- 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,Type:res.data[i].Type})
- }else{
- data.push({ ID: res.data[i].ID,AddTime: res.data[i].AddTime,Title:res.data[i].Title,Type:res.data[i].Type})
- }
-
- // })
- count = (param.page-1) * param.rows + i + 1;
- }
-
- }
- if(page === 0 && data.length === 0){
- $('#no-message').show();
- }else{
- $('#no-message').hide();
- }
- callback(data, count+1);
- })
- }, 300);
- },
- renderData: function (_index, _item) {// 渲染数据模板
- //console.log(_item);
- var _msg_html_list = '';
- if(_item.Type=='9'){//公告类型
- _msg_html_list+= '\
- <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
- <h4 id="time">'+ _item.AddTime +'</h4>\
- <a class="lr-nav-right" id="gaojingdetail'+_item.AddTime+'">'+_item.Title+'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
- </div>';
- }else{//其他告警类型
- _msg_html_list+= '\
- <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
- <h4 id="time">'+ _item.AddTime +'</h4>\
- <p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ (_item.DeviceNumber || "无标签") +'</span></p>\
- <a class="lr-nav-right" id="gaojingdetail'+_item.AddTime+'">'+_item.Title+'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
- </div>';
- }
- // $('#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){
- if(item.Type != '9'){
- renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"ID":"'+item.ID+'"}'});
- }else{
- renlian.nav.go({ path: 'articledetail', title: '公告详情', type: 'right', param:'{"ID":"'+item.ID+'"}'});
- }
- },
- down: {
- contentinit: '下拉可以刷新',
- contentdown: '下拉可以刷新',
- contentover: '释放立即刷新',
- contentrefresh: '正在刷新...'
- },
- up: {
- contentinit: '上拉显示更多',
- contentdown: '上拉显示更多',
- contentrefresh: '正在加载...',
- contentnomore: '没有更多数据了'
- }
- });
- var pullrefresh = function(index){
- if(Number(index) === 0){
- url = '/?s=api/get_baojing_info&plate=';
- }else{
- url = '/?s=api/get_article_info&plate=';
- // url = '/?s=api/get_baojing_info&plate=';
- }
- pageobj.reload();
- // return pageobj;
- }
- userinfo = renlian.storage.get('userinfo');
- $page.find('#toptab').rltoptab(['告警', '公告'], pullrefresh ).each(function (index) {
- var $this = $(this);
- switch (index) {
- case 0:
- break;
- case 1:
- break;
-
- }
- $this = null;
- });
- }
-
-
- };
- return page;
- })();
|