123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- // 详情弹框js start
- var aa = '';
- // 详情弹框
- $(document).on('click', 'a.view-detail', function() {
- let dataId = $(this).data('id'); // 单位ID
- alert(dataId)
- companyId = dataId;
- layerDepartmentIndex = layer.open({
- type: 1,
- title: false,
- closeBtn: 0,
- shadeClose: true,
- skin: 'yourclass',
- area: [
- '700px', '500px'
- ],
- content: $(".queryPointDetailList"),
- success: function() {
- getPointDetailAjax({ "id": dataId })
- // 获取部门列表 ajax请求
- $('.clsBtn,.cancel').click(function() {
- layer.close(layerDepartmentIndex);
- })
- }
- })
- // 按钮搜索
- $('#buttonSearch2').on('click', function() {
- page = 1;
- getPointDetailAjax(getSearchParamObj2());
- })
- // 拼接搜索条件
- function getSearchParamObj2() {
- let queryParam = {};
- let weibao = $('#weibao').val();
- queryParam.data3 = weibao;
- queryParam.id = dataId;
- return queryParam;
- }
- // 分页刷新按钮
- $('.pg-refresh2').click(resetForm);
- // 重置表单
- function resetForm() {
- page = 1;
- $("#weibao").val("0");
- getPointDetailAjax(getSearchParamObj2());
- }
- })
- // 获取列表 ajax请求
- function getPointDetailAjax(queryParam = {}, page = 1) {
- queryParam.page = page;
- queryParam.limit = 1; // 每页显示条数
- queryParam.start = (queryParam.page - 1) * queryParam.limit;
- ajaxRequest(RECORD_AND_POINT, "POST", queryParam, function(result) {
- let data = result.RESULT;
- let items = '';
- if (result.totalCount > 0) {
- data.forEach(function(item, key) {
- 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>"
- })
- $('#dataList2').html(items);
- } else {
- $('#dataList2').html('');
- }
- // console.log(result)
- totalPages = result.totalCount / result.limit;
- totalPages = Math.ceil(totalPages);
- $('#totalPage2').html(totalPages); // 总共多少页
- $('#dataTotal2').html(result.totalCount); // 总共多少条数据
- $('#currentPage2').val(page); // 当前页面
- let pageFrom = (page - 1) * result.limit + 1; // 开始
- let pageTo = result.page * result.limit; // 结束
- pageTo = pageTo > result.totalCount ? result.totalCount : pageTo;
- $('#pageFrom2').html(pageFrom);
- $('#pageTo2').html(pageTo);
- // 无数据时
- if (!result.totalCount) {
- $('.pager2.has-data').hide()
- $('.pager2.no-data').show()
- } else {
- $('.pager2.has-data').show()
- $('.pager2.no-data').hide()
- }
- if (page < totalPages) {
- $('#nextPageButton2,#lastPageButton2').removeClass('disabled');
- } else {
- $('#nextPageButton2,#lastPageButton2').addClass('disabled');
- }
- if (page === 1) {
- $('#firstPageButton2,#prevPageButton2').addClass('disabled');
- } else {
- $('#firstPageButton2,#prevPageButton2').removeClass('disabled');
- }
- }, function(errorMsg) {
- alert("请求数据失败!");
- }, 3)
- };
- // 分页操作
- $('#firstPageButton2').on('click', function() {
- page = 1;
- getPointDetailAjax({}, 1)
- // getListDataAjax(getSearchParamObj(), 1);
- });
- $('#lastPageButton2').on('click', function() {
- page = totalPages;
- // getListDataAjax({}, page);
- getPointDetailAjax({}, page)
- });
- $('#prevPageButton2').on('click', function() {
- page -= 1;
- // getListDataAjax(getSearchParamObj(), page);
- getPointDetailAjax({}, page)
- });
- $('#nextPageButton2').on('click', function() {
- page += 1;
- // getListDataAjax(getSearchParamObj(), page);
- getPointDetailAjax(getSearchParamObj2(), page)
- })
|