baojinginfo.js 8.4 KB

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