record-inner.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // 详情弹框js start
  2. var aa = '';
  3. // 详情弹框
  4. $(document).on('click', 'a.view-detail', function() {
  5. let dataId = $(this).data('id'); // 单位ID
  6. alert(dataId)
  7. companyId = dataId;
  8. layerDepartmentIndex = 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. layer.close(layerDepartmentIndex);
  23. })
  24. }
  25. })
  26. // 按钮搜索
  27. $('#buttonSearch2').on('click', function() {
  28. page = 1;
  29. getPointDetailAjax(getSearchParamObj2());
  30. })
  31. // 拼接搜索条件
  32. function getSearchParamObj2() {
  33. let queryParam = {};
  34. let weibao = $('#weibao').val();
  35. queryParam.data3 = weibao;
  36. queryParam.id = dataId;
  37. return queryParam;
  38. }
  39. // 分页刷新按钮
  40. $('.pg-refresh2').click(resetForm);
  41. // 重置表单
  42. function resetForm() {
  43. page = 1;
  44. $("#weibao").val("0");
  45. getPointDetailAjax(getSearchParamObj2());
  46. }
  47. })
  48. // 获取列表 ajax请求
  49. function getPointDetailAjax(queryParam = {}, page = 1) {
  50. queryParam.page = page;
  51. queryParam.limit = 1; // 每页显示条数
  52. queryParam.start = (queryParam.page - 1) * queryParam.limit;
  53. ajaxRequest(RECORD_AND_POINT, "POST", queryParam, function(result) {
  54. let data = result.RESULT;
  55. let items = '';
  56. if (result.totalCount > 0) {
  57. data.forEach(function(item, key) {
  58. items += "<tr>" + "<td class='status'></td>" + "<td>" + item.spot_name + "</td>" + "<td>" + item.spot_address + "</td>" + "<td>" + item.wcqk + "</td>" + "<td>" + item.wcqk + "</td>" + "<td>" + item.wcqk + "</td>" + "<td ><a class='view-detail' data-id=" + item.phone + ">查看</a></td>" + "<td ><a class='view-detail' data-id=" + item.phone + ">查看</a></td>" + "</tr>"
  59. })
  60. $('#dataList2').html(items);
  61. } else {
  62. $('#dataList2').html('');
  63. }
  64. // console.log(result)
  65. totalPages = result.totalCount / result.limit;
  66. totalPages = Math.ceil(totalPages);
  67. $('#totalPage2').html(totalPages); // 总共多少页
  68. $('#dataTotal2').html(result.totalCount); // 总共多少条数据
  69. $('#currentPage2').val(page); // 当前页面
  70. let pageFrom = (page - 1) * result.limit + 1; // 开始
  71. let pageTo = result.page * result.limit; // 结束
  72. pageTo = pageTo > result.totalCount ? result.totalCount : pageTo;
  73. $('#pageFrom2').html(pageFrom);
  74. $('#pageTo2').html(pageTo);
  75. // 无数据时
  76. if (!result.totalCount) {
  77. $('.pager2.has-data').hide()
  78. $('.pager2.no-data').show()
  79. } else {
  80. $('.pager2.has-data').show()
  81. $('.pager2.no-data').hide()
  82. }
  83. if (page < totalPages) {
  84. $('#nextPageButton2,#lastPageButton2').removeClass('disabled');
  85. } else {
  86. $('#nextPageButton2,#lastPageButton2').addClass('disabled');
  87. }
  88. if (page === 1) {
  89. $('#firstPageButton2,#prevPageButton2').addClass('disabled');
  90. } else {
  91. $('#firstPageButton2,#prevPageButton2').removeClass('disabled');
  92. }
  93. }, function(errorMsg) {
  94. alert("请求数据失败!");
  95. }, 3)
  96. };
  97. // 分页操作
  98. $('#firstPageButton2').on('click', function() {
  99. page = 1;
  100. getPointDetailAjax({}, 1)
  101. // getListDataAjax(getSearchParamObj(), 1);
  102. });
  103. $('#lastPageButton2').on('click', function() {
  104. page = totalPages;
  105. // getListDataAjax({}, page);
  106. getPointDetailAjax({}, page)
  107. });
  108. $('#prevPageButton2').on('click', function() {
  109. page -= 1;
  110. // getListDataAjax(getSearchParamObj(), page);
  111. getPointDetailAjax({}, page)
  112. });
  113. $('#nextPageButton2').on('click', function() {
  114. page += 1;
  115. // getListDataAjax(getSearchParamObj(), page);
  116. getPointDetailAjax(getSearchParamObj2(), page)
  117. })