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" id="gaojinginfo" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">';
  31. //var baojing_info = '';
  32. userinfo = learun.storage.get('userinfo');
  33. learun.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
  34. if(res.success == true){
  35. $.each(res.data, function (_index, _item) {
  36. msg_html += '\
  37. <div class="lr-list">\
  38. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  39. <h4 id="time">'+ _item.AddTime +'</h4>\
  40. <p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
  41. <a class="lr-nav-right gaojingdetail">'+ _item.Type +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  42. </div>\
  43. </div>';
  44. $page.find('#gaojinginfo').html(msg_html);
  45. var addtime = $('#time').text();
  46. $('.gaojingdetail').on('tap', function () {
  47. learun.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
  48. });
  49. });
  50. }else{
  51. msg_html += '<h4>暂无消息</h4>';
  52. $page.find('#gaojinginfo').html(msg_html);
  53. }
  54. });
  55. msg_html += '\
  56. </div>\
  57. <div class="f-scrollbar f-scrollbar-vertical">\
  58. <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
  59. </div>\
  60. </div>\
  61. </div>';
  62. $this.html(msg_html);
  63. break;
  64. case 1:
  65. var msg_html = '';
  66. msg_html += '\
  67. <div class="f-page-body f-scroll-wrapper">\
  68. <div class="f-scroll" id="gonggaoinfo" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">';
  69. //var baojing_info = '{"0":{"data":"1111","msg":"公告","time":"2/28"},"1":{"data":"2222","msg":"公告","time":"2/29"}}';
  70. userinfo = learun.storage.get('userinfo');
  71. learun.httpget(config.webapi + "/?s=api/get_gonggao_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
  72. if(res.success == true){
  73. $.each(res.data, function (_index, _item) {
  74. msg_html += '\
  75. <div class="lr-list">\
  76. <div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
  77. <h4 id="time">'+ _item.AddTime +'</h4>\
  78. <p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
  79. <a class="lr-nav-right gonggaodetail">'+ _item.Type +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
  80. </div>\
  81. </div>';
  82. $page.find('.gonggaodetail').on('tap', function () {
  83. learun.nav.go({ path: 'baojing', title: '自助报警', type: 'right' });
  84. });
  85. });
  86. }else{
  87. msg_html += '<h4>暂无消息</h4>';
  88. }
  89. $page.find('#gonggaoinfo').html(msg_html);
  90. $('.gonggaodetail').on('tap', function () {
  91. var addtime = $('#time').text();
  92. learun.nav.go({ path: 'noticedetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
  93. });
  94. });
  95. msg_html += '\
  96. </div>\
  97. <div class="f-scrollbar f-scrollbar-vertical">\
  98. <div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
  99. </div>\
  100. </div>\
  101. </div>';
  102. $this.html(msg_html);
  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. })();