// 详情弹框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 += "
" + " | " + "" + item.spot_name + " | " + "" + item.spot_address + " | " + "" + item.wcqk + " | " + "" + item.wcqk + " | " + "" + item.wcqk + " | " + "查看 | " + "查看 | " + "
"
})
$('#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)
})