team-inner.js 5.9 KB

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