record-inner.js 6.1 KB

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