Config Statistics增加导出.
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<html>
|
||||
<head>
|
||||
<script src="${ctxStatic }/global/plugins/tableExport-3.3.13/xlsx.core.js"></script>
|
||||
<script src="${ctxStatic }/global/plugins/tableExport-3.3.13/FileSaver.js"></script>
|
||||
<script src="${ctxStatic }/global/plugins/tableExport-3.3.13/tableexport.js"></script>
|
||||
<meta name="format-detection" content="telephone=no,email=no,address=no">
|
||||
<style type="text/css">
|
||||
.statisticsRequest{
|
||||
@@ -70,6 +73,7 @@
|
||||
.table-bordered > thead > tr > td {
|
||||
border-bottom-width: 2px; }
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var hideTd=new Array();
|
||||
@@ -96,13 +100,90 @@
|
||||
});
|
||||
}
|
||||
closeTip();
|
||||
|
||||
// 导出
|
||||
$(".export-btn").on("click",function(){
|
||||
var suffix = $(this).data("export-type"); // 导出文件类型
|
||||
var tableMark = $(this).data("export-table"); //导出table
|
||||
var menuName = $("#menuName").val();
|
||||
var fileName = menuName + "_" + getNowFormatDate();
|
||||
setTemporaryRows(tableMark);
|
||||
var te = $("."+tableMark).tableExport({
|
||||
headings:true,
|
||||
footers:true,
|
||||
formats:[suffix],
|
||||
fileName: fileName,
|
||||
bootstrap:false
|
||||
});
|
||||
$("#myexport").click();
|
||||
$("caption").remove();
|
||||
$(".exportFirst").remove();
|
||||
$("."+tableMark+" .count").empty();
|
||||
});
|
||||
});
|
||||
function setTemporaryRows(tableMark){
|
||||
//1. 设置td合计
|
||||
var tb=document.getElementsByName(tableMark)[0];
|
||||
var rows = tb.rows;
|
||||
var cells = tb.cells;
|
||||
var colums = tb.rows[0].cells.length;
|
||||
$("."+tableMark+" .count").empty();
|
||||
$("."+tableMark+" .count").append("<td><spring:message code='report_total' /></td>");
|
||||
|
||||
for(var j = 1; j < colums; j++){
|
||||
var sum = 0;
|
||||
for(var i = 1;i<rows.length-1;i++){
|
||||
var a = parseInt(rows[i].cells[j].innerHTML.trim());
|
||||
sum = sum + a;
|
||||
}
|
||||
$("."+tableMark+" .count").append("<td>"+sum+"</td>");
|
||||
}
|
||||
|
||||
var table = $("."+tableMark);
|
||||
//2. 设置导出第一行
|
||||
if(tableMark == "cfgMenuTable"){
|
||||
var title = table.parent("div:first").siblings("font").text().trim().replace(/\s/g,'');
|
||||
}else{
|
||||
var title = table.siblings("font").text().trim().replace(/\s/g,'');
|
||||
}
|
||||
var addTr = "<tr class='exportFirst' class='hidden'><td>"+title+"</td></tr>";
|
||||
$("."+tableMark+"> thead").prepend(addTr);
|
||||
|
||||
}
|
||||
function getNowFormatDate() {
|
||||
var date = new Date();
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
var strDate = date.getDate();
|
||||
var hours = date.getHours();
|
||||
var minutes = date.getMinutes();
|
||||
var seconds = date.getSeconds();
|
||||
if (month >= 1 && month <= 9) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (strDate >= 0 && strDate <= 9) {
|
||||
strDate = "0" + strDate;
|
||||
}
|
||||
if (hours >= 1 && hours <= 9) {
|
||||
hours = "0" + hours;
|
||||
}
|
||||
if (minutes >= 1 && minutes <= 9) {
|
||||
minutes = "0" + minutes;
|
||||
}
|
||||
if (seconds >= 1 && seconds <= 9) {
|
||||
seconds = "0" + seconds;
|
||||
}
|
||||
var currentdate = year+""+ month+""+strDate+""+ hours+""+ minutes+""+seconds;
|
||||
return currentdate;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<title>index</title>
|
||||
</head>
|
||||
|
||||
<body class="page-full-width">
|
||||
<input id="menuName" type="hidden" value="<spring:message code="config_service_statistics"/>">
|
||||
<div class="statisticsRequest">
|
||||
<form id="searchForm" action="${ctx}/configure/statistics/configureStateStatistics" >
|
||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||
@@ -111,10 +192,22 @@
|
||||
[<spring:message code="statistic_time"/>:${requestStatisticTime }]
|
||||
</i>
|
||||
</font>
|
||||
<a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a>
|
||||
<a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh"> </a>
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="margin-top: -8px;">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="export"></spring:message>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" style="min-width: 110px;" >
|
||||
<li><a href="javascript:;" class="export-btn" data-export-type="xlsx" data-export-table="cfgMenuTable"><i class="fa fa-download"> <spring:message code="Excel"/></i></a></li>
|
||||
<li><a href="javascript:;" class="export-btn" data-export-type="csv" data-export-table="cfgMenuTable"><i class="fa fa-download"> <spring:message code="CSV"/></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h5 class="page-header"></h5>
|
||||
<div class="tableDiv">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap cfgMenuTable" name="cfgMenuTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><spring:message code="letter"/></th>
|
||||
@@ -150,18 +243,33 @@
|
||||
|
||||
</tr>
|
||||
</c:forEach>
|
||||
<tr class="count"></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<div class="page">${page}</div>
|
||||
</div>
|
||||
<div class="statisticsStatus">
|
||||
<font size="4"><i class="fa fa-cogs"> <spring:message code="configure_statistics_info"/>
|
||||
[<spring:message code="statistic_time"/>:${configStatisticTime }]
|
||||
</i></font> <a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a>
|
||||
<div id="statisticsStatus" class="statisticsStatus">
|
||||
<font size="4">
|
||||
<i class="fa fa-cogs"> <spring:message code="configure_statistics_info"/>
|
||||
[<spring:message code="statistic_time"/>:${configStatisticTime }]</i>
|
||||
</font>
|
||||
<a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh "> </a>
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="margin-top: -8px;">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="export"></spring:message>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right" style="min-width: 110px;" >
|
||||
<li><a href="javascript:;" class="export-btn" data-export-type="xlsx" data-export-table="statisticsStatusTable"><i class="fa fa-download"> <spring:message code="Excel"/></i></a></li>
|
||||
<li><a href="javascript:;" class="export-btn" data-export-type="csv" data-export-table="statisticsStatusTable"><i class="fa fa-download"> <spring:message code="CSV"/></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h5 class="page-header"></h5>
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">
|
||||
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap statisticsStatusTable" name="statisticsStatusTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><spring:message code="service_name"/></th>
|
||||
@@ -221,6 +329,7 @@
|
||||
</tr>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<tr class="count"></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -484,6 +484,9 @@ white-space:nowrap;
|
||||
<button type="button" class="btn blue" onClick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
|
||||
<button type="button" class="btn btn-default" id="resetBtn" > <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
|
||||
<%-- <button type="button" class="btn btn-default" id="export-btn"><i class="fa fa-download"> <spring:message code="export"/></i></button> --%>
|
||||
<%-- <button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/><i class="fa fa-angle-double-down"></i></button> --%>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> <spring:message code="export"></spring:message>
|
||||
@@ -494,10 +497,6 @@ white-space:nowrap;
|
||||
<li><a href="javascript:;" class="export-btn" data-export-type="csv"><i class="fa fa-download"> <spring:message code="CSV"/></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%-- <button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/><i class="fa fa-angle-double-down"></i></button> --%>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-icon-only btn-default setfields tooltips"
|
||||
data-container="body" data-placement="top" data-original-title=<spring:message code="custom_columns"/> href="javascript:;">
|
||||
<i class="icon-wrench"></i>
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
var $cols = $(val).find('th, td');
|
||||
return $cols.map(function (i, val) {
|
||||
// 当文字过长有省略时取title导出
|
||||
var titleText=$(val).text();
|
||||
var titleText=$(val).text().trim();
|
||||
if($(val).attr("title")!=null&&$(val).attr("title")!=""){
|
||||
titleText=$(val).attr("title");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user