team-inner.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. // 新增弹框
  2. $(document).on('click', '.add', function() {
  3. layerCreateIndex = layer.open({
  4. type: 1,
  5. title: false,
  6. closeBtn: 0,
  7. shadeClose: true,
  8. skin: 'yourclass',
  9. area: ['450px', '500px'],
  10. content: $(".addDeviceTypeOut"),
  11. success: function() {
  12. $('.clsBtn,.cancel').click(function() {
  13. layer.close(layerCreateIndex);
  14. })
  15. }
  16. })
  17. })
  18. // 新增列表渲染
  19. // 获取列表 ajax请求
  20. function getTeamInnerList(queryParam = {}, innerPage = 1) {
  21. queryParam.page = innerPage;
  22. queryParam.limit = 1; // 每页显示条数
  23. queryParam.start = (queryParam.page - 1) * queryParam.limit;
  24. ajaxRequest(RECORD_AND_POINT, "POST", queryParam, function(result) {
  25. let data = result.RESULT;
  26. let items = '';
  27. if (result.totalCount > 0) {
  28. data.forEach(function(item, key) {
  29. items += "<tr>" + "<td class='status'></td>" + "<td>" + item.spot_name + "</td>" + "<td>" + item.spot_address + "</td>" + "<td>" + item.wcqk +
  30. "</td>" + "<td>" + item.wcqk + "</td>" + "<td>" + item.wcqk + "</td>" +
  31. "<td ><a class='pointDetail' data-id=" + item.dwid + "><img src='../../images/tupianbtn.png'></a></td>" + "<td ><a class='weibaoReport' data-id=" + item.jlid + "><img src='../../images/tupianbtn.png'></a></td>" + "</tr>"
  32. })
  33. $('#dataList2').html(items);
  34. } else {
  35. $('#dataList2').html('');
  36. }
  37. // console.log(result)
  38. totalPages = result.totalCount / result.limit;
  39. totalPages = Math.ceil(totalPages);
  40. $('#totalPage2').html(totalPages); // 总共多少页
  41. $('#dataTotal2').html(result.totalCount); // 总共多少条数据
  42. $('#currentPage2').val(innerPage); // 当前页面
  43. let pageFrom = (innerPage - 1) * result.limit + 1; // 开始
  44. let pageTo = result.page * result.limit; // 结束
  45. pageTo = pageTo > result.totalCount ? result.totalCount : pageTo;
  46. $('#pageFrom2').html(pageFrom);
  47. $('#pageTo2').html(pageTo);
  48. // 无数据时
  49. if (!result.totalCount) {
  50. $('.pager2.has-data').hide()
  51. $('.pager2.no-data').show()
  52. } else {
  53. $('.pager2.has-data').show()
  54. $('.pager2.no-data').hide()
  55. }
  56. if (innerPage < totalPages) {
  57. $('#nextPageButton2,#lastPageButton2').removeClass('disabled');
  58. } else {
  59. $('#nextPageButton2,#lastPageButton2').addClass('disabled');
  60. }
  61. if (innerPage === 1) {
  62. $('#firstPageButton2,#prevPageButton2').addClass('disabled');
  63. } else {
  64. $('#firstPageButton2,#prevPageButton2').removeClass('disabled');
  65. }
  66. }, function(errorMsg) {
  67. alert("请求数据失败!");
  68. }, 3)
  69. };
  70. // 分页操作
  71. $('#firstPageButton2').on('click', function() {
  72. innerPage = 1;
  73. getTeamInnerList(getSearchParamObj2(), 1);
  74. });
  75. $('#lastPageButton2').on('click', function() {
  76. innerPage = totalPages;
  77. getTeamInnerList(getSearchParamObj2(), innerPage);
  78. });
  79. $('#prevPageButton2').on('click', function() {
  80. innerPage -= 1;
  81. getTeamInnerList(getSearchParamObj2(), innerPage);
  82. });
  83. $('#nextPageButton2').on('click', function() {
  84. innerPage += 1;
  85. getTeamInnerList(getSearchParamObj2(), innerPage);
  86. })
  87. // 按钮搜索
  88. $('#buttonSearch2').on('click', function() {
  89. innerPage = 1;
  90. getTeamInnerList(getSearchParamObj2());
  91. })
  92. // 拼接搜索条件
  93. function getSearchParamObj2() {
  94. let queryParam = {};
  95. let weibao = $('#weibao').val();
  96. queryParam.data3 = weibao;
  97. queryParam.id = pointId;
  98. return queryParam;
  99. }
  100. // 分页刷新按钮
  101. $('.pg-refresh2').click(resetForm);
  102. // 重置表单
  103. function resetForm() {
  104. innerPage = 1;
  105. $("#weibao").val("0");
  106. getTeamInnerList(getSearchParamObj2());
  107. }
  108. //点位详情弹框
  109. // $(document).on('click', 'a.pointDetail', function() {
  110. // let dwId = $(this).data('id');
  111. // layerDepartmentIndex = layer.open({
  112. // type: 1,
  113. // title: false,
  114. // closeBtn: 0,
  115. // shadeClose: true,
  116. // skin: 'yourclass',
  117. // area: [
  118. // '400px', '400px'
  119. // ],
  120. // content: $(".pointDetailOut"),
  121. // success: function() {
  122. // ajaxRequest(RECORD_POINT_DETAIL, "POST", { "id": dwId }, function(result) {
  123. // console.log(result.RESULT[0])
  124. // var data = result.RESULT[0];
  125. // $('#pointDetailUrl').attr('src', data.picture_route);
  126. // }, function(errorMsg) {
  127. // alert("请求数据失败!");
  128. // }, 3);
  129. // $('.clsBtn2,.cancel2').click(function() {
  130. // innerPage = 1;
  131. // layer.close(layerDepartmentIndex);
  132. // })
  133. // }
  134. // })
  135. // })
  136. //维保报告点击
  137. // $(document).on('click', 'a.weibaoReport', function() {
  138. // let jlId = $(this).data('id'); //单位ID
  139. // layerReportIndex = layer.open({
  140. // type: 1,
  141. // title: false,
  142. // closeBtn: 0,
  143. // shadeClose: true,
  144. // skin: 'yourclass',
  145. // area: [
  146. // '400px', '400px'
  147. // ],
  148. // content: $(".weibaoReportOut"),
  149. // success: function() {
  150. // ajaxRequest(RECORD_AND_POINT, "POST", { "jlid": jlId }, function(result) {
  151. // console.log(result.RESULT[0])
  152. // var data = result.RESULT[0];
  153. // $('#weibaoReportUrl').attr('src', data.report_photos);
  154. // }, function(errorMsg) {
  155. // alert("请求数据失败!");
  156. // }, 3);
  157. // $('.clsBtn3,.cancel3').click(function() {
  158. // innerPage = 1;
  159. // layer.close(layerReportIndex);
  160. // })
  161. // }
  162. // })
  163. // })