record-inner.js 5.9 KB

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