|
@@ -2,78 +2,102 @@
|
|
|
var page = {
|
|
|
isScroll: false,
|
|
|
init: function ($page,param) {
|
|
|
- $page.find('#toptab').toptab(['告警', '公告']).each(function (index) {
|
|
|
+
|
|
|
+
|
|
|
+ userinfo = renlian.storage.get('userinfo');
|
|
|
+ $page.find('#toptab').rltoptab(['告警', '公告']).each(function (index) {
|
|
|
var $this = $(this);
|
|
|
switch (index) {
|
|
|
case 0:
|
|
|
- var msg_html = '';
|
|
|
- msg_html += '\
|
|
|
- <div class="f-page-body f-scroll-wrapper">\
|
|
|
- <div class="f-scroll" style="overflow:auto;height: 100%;">\
|
|
|
- <div class="lr-list gaojinginfo">\
|
|
|
- </div>\
|
|
|
- </div>\
|
|
|
- <div class="f-scrollbar f-scrollbar-vertical">\
|
|
|
- <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
|
|
|
- </div>\
|
|
|
- </div>\
|
|
|
- </div>';
|
|
|
- $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 += '\
|
|
|
- <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 gaojingdetail">告警<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
|
|
|
- </div>';
|
|
|
- $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 += '<h4>暂无消息</h4>';
|
|
|
- $page.find('.gaojinginfo').html(msg_html);
|
|
|
- }
|
|
|
- });
|
|
|
+ // var msg_html = '';
|
|
|
+ // msg_html += '\
|
|
|
+ // <div class="f-page-body f-scroll-wrapper">\
|
|
|
+ // <div class="f-scroll" style="overflow:auto;height: 100%;">\
|
|
|
+ // <div class="lr-list gaojinginfo">\
|
|
|
+ // </div>\
|
|
|
+ // </div>\
|
|
|
+ // <div class="f-scrollbar f-scrollbar-vertical">\
|
|
|
+ // <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
|
|
|
+ // </div>\
|
|
|
+ // </div>\
|
|
|
+ // </div>';
|
|
|
+ // $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 += '\
|
|
|
+ // <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 gaojingdetail">告警<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
|
|
|
+ // </div>';
|
|
|
+ // $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 += '<h4>暂无消息</h4>';
|
|
|
+ // $page.find('.gaojinginfo').html(msg_html);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
|
|
|
- //msg_html += '';
|
|
|
- //刷新
|
|
|
- var pageobj = $('.gaojinginfo').lrpagination({
|
|
|
+ // //msg_html += '';
|
|
|
+ // //刷新
|
|
|
+
|
|
|
+ var pageobj = $('#gaojinginfo').lrpagination({
|
|
|
lclass: "lr-list",
|
|
|
- rows: 10, // 每页行数
|
|
|
+ rows: 5,
|
|
|
+
|
|
|
+ // 每页行数
|
|
|
getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
|
|
|
// param: page: 当前页,rows:行数
|
|
|
setTimeout(function () {
|
|
|
var data = [];
|
|
|
- renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
|
|
|
+ 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){
|
|
|
- $.each(res.data, function (_index, _item) {
|
|
|
- data.push({ AddTime: _item.AddTime,LicensePlate: _item.LicensePlate,DeviceNumber:_item.DeviceNumber})
|
|
|
- })
|
|
|
+ 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;
|
|
|
}
|
|
|
+
|
|
|
+ callback(data, count+1);
|
|
|
})
|
|
|
- callback(data, 20);
|
|
|
+
|
|
|
}, 1000);
|
|
|
},
|
|
|
renderData: function (_index, _item) {// 渲染数据模板
|
|
|
- console.log(_index);
|
|
|
var _msg_html_list = '';
|
|
|
_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 gaojingdetail">告警<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
|
|
|
+ <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){
|
|
|
+ renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"ID":"'+item.ID+'"}'});
|
|
|
+ },
|
|
|
down: {
|
|
|
contentinit: '下拉可以刷新',
|
|
|
contentdown: '下拉可以刷新',
|
|
@@ -90,45 +114,46 @@
|
|
|
//刷新结束
|
|
|
break;
|
|
|
case 1:
|
|
|
- var msg_html = '';
|
|
|
- var msg_html = '';
|
|
|
- msg_html += '\
|
|
|
- <div class="f-page-body f-scroll-wrapper">\
|
|
|
- <div class="f-scroll" style="overflow:auto;height: 100%;">\
|
|
|
- <div style="position:unset;padding:10px" class="lr-list gonggaoinfo">\
|
|
|
- </div>\
|
|
|
- </div>\
|
|
|
- <div class="f-scrollbar f-scrollbar-vertical">\
|
|
|
- <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
|
|
|
- </div>\
|
|
|
- </div>\
|
|
|
- </div>';
|
|
|
- $this.html(msg_html);
|
|
|
- //var baojing_info = '{"0":{"data":"1111","msg":"公告","time":"2/28"},"1":{"data":"2222","msg":"公告","time":"2/29"}}';
|
|
|
- userinfo = renlian.storage.get('userinfo');
|
|
|
- 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 += '\
|
|
|
- <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 gonggaodetail">公告<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
|
|
|
- </div>';
|
|
|
- $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+'"}'});
|
|
|
- });
|
|
|
- });
|
|
|
+ // var msg_html = '';
|
|
|
+ // var msg_html = '';
|
|
|
+ // msg_html += '\
|
|
|
+ // <div class="f-page-body f-scroll-wrapper">\
|
|
|
+ // <div class="f-scroll" style="overflow:auto;height: 100%;">\
|
|
|
+ // <div style="position:unset;padding:10px" class="lr-list gonggaoinfo">\
|
|
|
+ // </div>\
|
|
|
+ // </div>\
|
|
|
+ // <div class="f-scrollbar f-scrollbar-vertical">\
|
|
|
+ // <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
|
|
|
+ // </div>\
|
|
|
+ // </div>\
|
|
|
+ // </div>';
|
|
|
+ // $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 += '\
|
|
|
+ // <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 gonggaodetail">公告<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
|
|
|
+ // </div>';
|
|
|
+ // $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 += '<h4 style="text-align: center;">暂无消息</h4>';
|
|
|
- $page.find('.gonggaoinfo').html(msg_html);
|
|
|
- }
|
|
|
- });
|
|
|
- break;
|
|
|
+ // }else{
|
|
|
+ // msg_html += '<h4 style="text-align: center;">暂无消息</h4>';
|
|
|
+ // $page.find('.gonggaoinfo').html(msg_html);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // break;
|
|
|
+
|
|
|
}
|
|
|
$this = null;
|
|
|
});
|