1.report前端分页
2.report的时间搜索框显示默认时间(当日)
This commit is contained in:
@@ -337,6 +337,9 @@ public class BaseController {
|
|||||||
protected void initReportCondition(Model model,SearchReport report){
|
protected void initReportCondition(Model model,SearchReport report){
|
||||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(report.getFunctionId());
|
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(report.getFunctionId());
|
||||||
model.addAttribute("serviceList", serviceList);
|
model.addAttribute("serviceList", serviceList);
|
||||||
|
if (StringUtils.isBlank(report.getReportTime())) {
|
||||||
|
report.setReportTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
protected void initFormCondition(Model model){
|
protected void initFormCondition(Model model){
|
||||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ public class NtcSrcipDomesticReportController extends BaseController {
|
|||||||
}
|
}
|
||||||
model.addAttribute("splitor", Constants.REPORT_TRIM_CONNECTOR);
|
model.addAttribute("splitor", Constants.REPORT_TRIM_CONNECTOR);
|
||||||
model.addAttribute("datas", showData);
|
model.addAttribute("datas", showData);
|
||||||
|
model.addAttribute("dataLength", showData.size());
|
||||||
return "/report/srcIp";
|
return "/report/srcIp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ public class NtcTagReportController extends BaseController {
|
|||||||
showData.put(label.getServiceDictId().toString(), _line);
|
showData.put(label.getServiceDictId().toString(), _line);
|
||||||
}
|
}
|
||||||
model.addAttribute("datas", showData);
|
model.addAttribute("datas", showData);
|
||||||
|
model.addAttribute("dataLength", showData.size());
|
||||||
return "/report/label";
|
return "/report/label";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
146
src/main/webapp/WEB-INF/include/form/pageGroup.jsp
Normal file
146
src/main/webapp/WEB-INF/include/form/pageGroup.jsp
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
|
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||||
|
<script>
|
||||||
|
function pagination() {
|
||||||
|
|
||||||
|
pageNo = 1;
|
||||||
|
count = $('tbody').children().size();// 总记录数
|
||||||
|
|
||||||
|
//处理ajax时jquery选择器缓存的问题
|
||||||
|
dataLength = "${dataLength}";
|
||||||
|
preCount = 0;
|
||||||
|
if (dataLength < count) {
|
||||||
|
preCount = count - dataLength;
|
||||||
|
count = count - preCount;
|
||||||
|
}
|
||||||
|
$('tbody').children().slice(0, preCount).remove();
|
||||||
|
|
||||||
|
|
||||||
|
pageSize = 30; // 页面大小
|
||||||
|
first = 1;// 首页索引
|
||||||
|
last = Math.ceil(count/pageSize);// 尾页索引
|
||||||
|
length = 8;// 显示页面长度
|
||||||
|
slider = 1;// 前后显示页面长度
|
||||||
|
funcParam = "";
|
||||||
|
if (last == 0) {
|
||||||
|
last++;
|
||||||
|
}
|
||||||
|
if (last < first) {
|
||||||
|
last = first;
|
||||||
|
}
|
||||||
|
if (pageNo <= 1) {
|
||||||
|
pageNo = first;
|
||||||
|
firstPage = true;
|
||||||
|
}
|
||||||
|
if (pageNo >= last) {
|
||||||
|
pageNo = last;
|
||||||
|
lastPage = true;
|
||||||
|
}
|
||||||
|
if (pageNo < last - 1) {
|
||||||
|
next = pageNo + 1;
|
||||||
|
} else {
|
||||||
|
next = last;
|
||||||
|
}
|
||||||
|
if (pageNo > 1) {
|
||||||
|
prev = pageNo - 1;
|
||||||
|
} else {
|
||||||
|
prev = first;
|
||||||
|
}
|
||||||
|
if (pageNo < first) {
|
||||||
|
pageNo = first;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageNo > last) {
|
||||||
|
pageNo = last;
|
||||||
|
}
|
||||||
|
toPage(1, pageSize, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
//跳页
|
||||||
|
function toPage(pageNo, pageSize, funcParam) {
|
||||||
|
prev = pageNo - 1;
|
||||||
|
next = pageNo + 1;
|
||||||
|
|
||||||
|
var inhtml = getFootHtml(pageNo);
|
||||||
|
|
||||||
|
$(".page").html(inhtml);
|
||||||
|
|
||||||
|
//隐藏该对象下面的所有子元素
|
||||||
|
$('tbody').children().css('display', 'none');
|
||||||
|
//显示元素
|
||||||
|
$('tbody').children().slice((pageNo-1)*pageSize, pageNo*pageSize).css('display', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
//底部跳页按钮
|
||||||
|
function getFootHtml(pageNo) {
|
||||||
|
var htm = "";
|
||||||
|
if (count == 0) {
|
||||||
|
htm = "<div class=\"none-data\"><i class=\"fa fa-warning font-red-flamingo\"></i> " + "<spring:message code="noneData"/>" + "</div>";
|
||||||
|
return htm;
|
||||||
|
}
|
||||||
|
htm = "<ul>";
|
||||||
|
if (pageNo == first) {
|
||||||
|
htm += "<li class=\"disabled\"><a href=\"javascript:\">« " + "<spring:message code="previousPage"/>" + "</a></li>";
|
||||||
|
} else {
|
||||||
|
htm += "<li><a href=\"javascript:\" onclick=\"toPage(" + prev + "," + pageSize + ",'" + funcParam + "');\">« " + "<spring:message code="previousPage"/>" + "</a></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
var begin = pageNo - (length / 2);
|
||||||
|
|
||||||
|
if (begin < first) {
|
||||||
|
begin = first;
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = begin + length - 1;
|
||||||
|
|
||||||
|
if (end >= last) {
|
||||||
|
end = last;
|
||||||
|
begin = end - length + 1;
|
||||||
|
if (begin < first) {
|
||||||
|
begin = first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begin > first) {
|
||||||
|
var i = 0;
|
||||||
|
for (i = first; i < first + slider && i < begin; i++) {
|
||||||
|
htm += "<li tmp=\"" + i + "\"><a href=\"javascript:\" onclick=\"toPage(" + i + "," + pageSize + ",'" + funcParam + "');\">" + (i + 1 - first) + "</a></li>";
|
||||||
|
}
|
||||||
|
if (i < begin) {
|
||||||
|
htm += "<li class=\"disabled\"><a href=\"javascript:\">...</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = begin; i <= end; i++) {
|
||||||
|
if (i == pageNo) {
|
||||||
|
htm += "<li class=\"active\"><a href=\"javascript:\">" + (i + 1 - first) + "</a></li>";
|
||||||
|
} else {
|
||||||
|
htm += "<li><a href=\"javascript:\" onclick=\"toPage(" + i + "," + pageSize + ",'" + funcParam + "');\">" + (i + 1 - first) + "</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (last - end > slider) {
|
||||||
|
htm += "<li class=\"disabled\"><a href=\"javascript:\">...</a></li>";
|
||||||
|
end = last - slider;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = end + 1; i <= last; i++) {
|
||||||
|
htm += "<li><a href=\"javascript:\" onclick=\"toPage(" + i + "," + pageSize + ",'" + funcParam + "');\">" + (i + 1 - first) + "</a></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageNo == last) {
|
||||||
|
htm += "<li class=\"disabled\"><a href=\"javascript:\">" + "<spring:message code="nextPage"/>" + " »</a></li>";
|
||||||
|
} else {
|
||||||
|
htm += "<li><a href=\"javascript:\" onclick=\"toPage(" + next + "," + pageSize + ",'" + funcParam + "');\">" + "" + "<spring:message code="nextPage"/>" + " »</a></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
htm += "<li class=\"disabled controls\"><a href=\"javascript:\">" + "<spring:message code="current"/>" + " ";
|
||||||
|
htm += "<input type=\"text\" value=\"" + pageNo + "\" onkeypress=\"var e=window.event||this;var c=e.keyCode||e.which;if(c==13)";
|
||||||
|
htm += "toPage(this.value," + pageSize + ",'" + funcParam + "');\" onclick=\"this.select();\"/> / ";
|
||||||
|
htm += "<input type=\"text\" value=\"" + last + "\" onkeypress=\"var e=window.event||this;var c=e.keyCode||e.which;if(c==13)";
|
||||||
|
htm += "(toPage" + pageNo + ",this.value,'" + funcParam + "');\" onclick=\"this.select();\"/> " + "<spring:message code="page"/>" + ",";
|
||||||
|
htm += "" + "<spring:message code="total"/>" + " <span id='showTotalCount'>" + count + "</span> " + "<spring:message code="count"/>" + "</a></li>";
|
||||||
|
htm += "</ul>";
|
||||||
|
return htm;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||||
<script type="text/javascript">
|
<%@ include file="/WEB-INF/include/form/pageGroup.jsp"%>
|
||||||
$(function(){
|
<%-- <script src="${ctxStatic }/pages/scripts/pageGroup.js" type="text/javascript"></script> --%>
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<table id="tagTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
<table id="tagTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -29,4 +27,4 @@ $(function(){
|
|||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="page">${page}</div>
|
<div class="page"></div>
|
||||||
@@ -109,7 +109,8 @@ var ajaxReport=function(url,target){
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type:'post',
|
type:'post',
|
||||||
async:false,
|
async:false,
|
||||||
url:'${ctx}'+url,///report/ajaxNtcTagReport
|
cache:false,
|
||||||
|
url:'${ctx}'+url+"?random="+Math.random,///report/ajaxNtcTagReport
|
||||||
data:{
|
data:{
|
||||||
"action":$('[name="action"]').val(),
|
"action":$('[name="action"]').val(),
|
||||||
"reportType":$('[name="reportType"]').val(),
|
"reportType":$('[name="reportType"]').val(),
|
||||||
@@ -118,10 +119,11 @@ var ajaxReport=function(url,target){
|
|||||||
dataType:"html",
|
dataType:"html",
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$(target).html(data);//#label
|
$(target).html(data);//#label
|
||||||
|
pagination();
|
||||||
closeTip();
|
closeTip();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||||
<script type="text/javascript">
|
<%@ include file="/WEB-INF/include/form/pageGroup.jsp"%>
|
||||||
$(function(){
|
<%-- <script src="${ctxStatic }/pages/scripts/pageGroup.js" type="text/javascript"></script> --%>
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<table id="contentTable1" class="table table-striped table-bordered table-condensed text-nowrap">
|
<table id="contentTable1" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -28,4 +26,4 @@ $(function(){
|
|||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="page">${page}</div>
|
<div class="page"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user