baojinginfo.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. (function () {
  2. /*function list(data, $page) {
  3. $.each(data, function (_index, _item) {
  4. learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'list', id: _item.F_Id }, function(data) {
  5. if (data) {
  6. var html = '';
  7. $.each(data.value, function (_j, _jitem) {
  8. html += '\
  9. <div class="lr-list-item lr-dtlist-item">\
  10. <div class="lr-ellipsis">'+ _jitem.f_title + '</div>\
  11. <div class="date">'+ learun.date.format(_jitem.f_time, 'yyyy-MM-dd') + '</div>\
  12. </div>';
  13. });
  14. console.log(html);
  15. }
  16. $page.find('#lr_desktop_msg_content').append(html);
  17. });
  18. });
  19. }*/
  20. var page = {
  21. isScroll: false,
  22. init: function ($page,param) {
  23. $page.find('#toptab').toptab(['告警', '公告']).each(function (index) {
  24. var $this = $(this);
  25. switch (index) {
  26. case 0:
  27. var msg_html = '';
  28. msg_html += '\
  29. <div class="f-page-body f-scroll-wrapper">\
  30. <div class="f-scroll" style="overflow:auto;height: 100%;">\
  31. <div class="lr-list gaojinginfo">\
  32. </div>\
  33. </div>\
  34. <div class="f-scrollbar f-scrollbar-vertical">\
  35. <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
  36. </div>\
  37. </div>\
  38. </div>';
  39. $this.html(msg_html);
  40. //var baojing_info = '';
  41. userinfo = learun.storage.get('userinfo');
  42. learun.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
  43. if(res.success == true){
  44. var msg_html_list = '';
  45. $.each(res.data, function (_index, _item) {
  46. msg_html_list += '\
  47. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  48. <h4 id="time">'+ _item.AddTime +'</h4>\
  49. <p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
  50. <a class="lr-nav-right gaojingdetail">'+ _item.Type +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  51. </div>';
  52. $page.find('.gaojinginfo').html(msg_html_list);
  53. var addtime = $('#time').text();
  54. $('.gaojingdetail').on('tap', function () {
  55. learun.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
  56. });
  57. });
  58. }else{
  59. msg_html += '<h4>暂无消息</h4>';
  60. $page.find('.gaojinginfo').html(msg_html);
  61. }
  62. });
  63. //msg_html += '';
  64. break;
  65. case 1:
  66. var msg_html = '';
  67. var msg_html = '';
  68. msg_html += '\
  69. <div class="f-page-body f-scroll-wrapper">\
  70. <div class="f-scroll" style="overflow:auto;height: 100%;">\
  71. <div class="lr-list gonggaoinfo">\
  72. </div>\
  73. </div>\
  74. <div class="f-scrollbar f-scrollbar-vertical">\
  75. <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
  76. </div>\
  77. </div>\
  78. </div>';
  79. $this.html(msg_html);
  80. //var baojing_info = '{"0":{"data":"1111","msg":"公告","time":"2/28"},"1":{"data":"2222","msg":"公告","time":"2/29"}}';
  81. userinfo = learun.storage.get('userinfo');
  82. learun.httpget(config.webapi + "/?s=api/get_gonggao_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
  83. var msg_html_list = '';
  84. if(res.success == true){
  85. $.each(res.data, function (_index, _item) {
  86. msg_html_list += '\
  87. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  88. <h4 id="time">'+ _item.AddTime +'</h4>\
  89. <p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
  90. <a class="lr-nav-right gonggaodetail">'+ _item.Type +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  91. </div>';
  92. $page.find('.gonggaoinfo').html(msg_html_list);
  93. $('.gonggaodetail').on('tap', function () {
  94. var addtime = $('#time').text();
  95. learun.nav.go({ path: 'noticedetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
  96. });
  97. });
  98. }else{
  99. msg_html += '<h4>暂无消息</h4>';
  100. $page.find('.gonggaoinfo').html(msg_html);
  101. }
  102. });
  103. break;
  104. }
  105. $this = null;
  106. });
  107. }
  108. /*reload: function ($page, pageinfo) {
  109. if (learun.isOutLogin) {// 如果是重新登录的情况刷新下桌面数据
  110. learun.isOutLogin = false;
  111. $page.find('#toptab').toptab(['告警', '公告']).each(function (index) {
  112. var $this = $(this);
  113. switch (index) {
  114. case 0:
  115. var msg_html = '';
  116. msg_html += '\
  117. <div class="f-page-body f-scroll-wrapper">\
  118. <div class="f-scroll" id="gaojinginfo" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">';
  119. learun.http.get("http://czapp.rltest.cn/?s=api/get_baojing_info", {}, function(res) {
  120. if(res){
  121. $.each(res.data, function (_index, _item) {
  122. msg_html += '\
  123. <div class="lr-list">\
  124. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  125. <h4>'+ _item.AddTime +'</h4>\
  126. <p class="lr-ellipsis">'+ _item.DeviceNumber +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.AddTime +'</span></p>\
  127. <a class="lr-nav-right">'+ _item.Comment +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  128. </div>\
  129. </div>';
  130. });
  131. }else{
  132. msg_html += '<h4>暂无消息</h4>';
  133. }
  134. $page.find('#gaojinginfo').html(msg_html);
  135. });
  136. msg_html += '\
  137. </div>\
  138. <div class="f-scrollbar f-scrollbar-vertical">\
  139. <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
  140. </div>\
  141. </div>\
  142. </div>';
  143. $this.html(msg_html);
  144. break;
  145. case 1:
  146. var msg_html = '';
  147. msg_html += '\
  148. <div class="f-page-body f-scroll-wrapper">\
  149. <div class="f-scroll" id="gonggaoinfo" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">';
  150. learun.http.get("http://czapp.rltest.cn/?s=api/get_baojing_info", {}, function(res) {
  151. if(res){
  152. $.each(res.data, function (_index, _item) {
  153. msg_html += '\
  154. <div class="lr-list">\
  155. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  156. <h4>'+ _item.AddTime +'</h4>\
  157. <p class="lr-ellipsis">'+ _item.DeviceNumber +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.AddTime +'</span></p>\
  158. <a class="lr-nav-right">'+ _item.Comment +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  159. </div>\
  160. </div>';
  161. });
  162. }else{
  163. msg_html += '<h4>暂无消息</h4>';
  164. }
  165. $page.find('#gonggaoinfo').html(msg_html);
  166. });
  167. msg_html += '\
  168. </div>\
  169. <div class="f-scrollbar f-scrollbar-vertical">\
  170. <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
  171. </div>\
  172. </div>\
  173. </div>';
  174. $this.html(msg_html);
  175. break;
  176. }
  177. $this = null;
  178. });
  179. }
  180. }*/
  181. };
  182. return page;
  183. /*var page = {
  184. isScroll: false,
  185. init: function ($page) {
  186. learun.clientdata.get('desktop', {
  187. callback: function (data) {
  188. console.log(data);
  189. list(data.list || [], $page);
  190. }
  191. });
  192. }
  193. };
  194. return page;*/
  195. })();