配置统计Excel调整为后台导出
This commit is contained in:
@@ -71,7 +71,7 @@ function toPage(pageNo, pageSize, funcParam) {
|
||||
$('tbody').children().css('display', 'none');
|
||||
//显示元素
|
||||
$('tbody').children().slice((pageNo-1)*pageSize, pageNo*pageSize).css('display', '');
|
||||
totaltb(pageNo,pageSize);
|
||||
showTotal();
|
||||
}
|
||||
|
||||
//底部跳页按钮
|
||||
|
||||
@@ -249,6 +249,73 @@
|
||||
append: null
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getTitl(tableMark){
|
||||
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>");
|
||||
}
|
||||
}
|
||||
|
||||
function getExport(tableId,url,titleName){
|
||||
loading('<spring:message code="onloading"/>');
|
||||
getTitl(tableId);
|
||||
var tb=document.getElementsByName(tableId);
|
||||
var rows=tb[0].rows;
|
||||
var list=new Array();
|
||||
list.splice(0,list.length);
|
||||
var column=[]; //获取标题
|
||||
var index=[];//获取数据列下标
|
||||
var num=0;
|
||||
$("table[name='"+tableId+"']").find("tr th").each(function(){
|
||||
if($(this).is(":visible")){
|
||||
column.push($(this).text().trim());
|
||||
index.push(num);
|
||||
}
|
||||
num++;
|
||||
});
|
||||
for(var i=1 ; i<rows.length;i++){
|
||||
var rowMap=[];
|
||||
for (var j = 0; j <index.length ; j++) {
|
||||
var n=index[j];
|
||||
if(rows[i].cells[n]!=null){
|
||||
if(rows[i].cells[n].innerText.indexOf("...") !=-1){
|
||||
if(rows[i].cells[n].title.length > 20){
|
||||
rowMap.push(rows[i].cells[n].title);
|
||||
}else{
|
||||
rowMap.push(rows[i].cells[n].innerText);
|
||||
}
|
||||
}else{
|
||||
rowMap.push(rows[i].cells[n].innerText);
|
||||
}
|
||||
}
|
||||
}
|
||||
list[i-1]=rowMap;
|
||||
}
|
||||
var menuName = $("#menuName").val();
|
||||
var fileName = menuName + "_" + getNowFormatDate();
|
||||
var pztitle =$("#"+titleName).text();
|
||||
var map={};
|
||||
map.heard=column;
|
||||
map.book=list;
|
||||
map.titleTime=pztitle;
|
||||
map.titleCode="config_service_statistics";
|
||||
var exports=JSON.stringify(map);
|
||||
aJaxImportPost(url,{"exports":exports});
|
||||
$("."+tableId+" .count").empty();
|
||||
closeTip();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<title>index</title>
|
||||
@@ -260,9 +327,7 @@
|
||||
<form id="searchForm" action="${ctx}/configure/statistics/configureStateStatistics" >
|
||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||
<font size="4"><i class="fa fa-cogs"> <spring:message code="letter_statistics_info"/>
|
||||
[<spring:message code="statistic_time"/>:${requestStatisticTime }]
|
||||
</i>
|
||||
<font size="4"><i class="fa fa-cogs" id="pzTitle"> <spring:message code="letter_statistics_info"/> [<spring:message code="statistic_time"/>:${requestStatisticTime }]</i>
|
||||
</font>
|
||||
<a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh"> </a>
|
||||
<div class="pull-right">
|
||||
@@ -272,7 +337,7 @@
|
||||
<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:;" onclick="getExport('cfgMenuTable','${ctx}/export/ajaxExport','pzTitle')" 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>
|
||||
@@ -329,8 +394,7 @@
|
||||
</div>
|
||||
<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>
|
||||
<i class="fa fa-cogs" id="statusTitle"><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">
|
||||
@@ -340,7 +404,7 @@
|
||||
<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:;" onclick="getExport('statisticsStatusTable','${ctx}/export/ajaxExport','statusTitle')" 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>
|
||||
|
||||
@@ -101,7 +101,7 @@ $(document).ready(function() {
|
||||
var lipx=Number(li/6);
|
||||
lipx=lipx-3;
|
||||
$(".lireport").css({'width':lipx+'px','text-overflow':'ellipsis','overflow':'hidden'});
|
||||
|
||||
totaltb(1,-1);
|
||||
});
|
||||
function getExportHead(){
|
||||
// 报表导出 文件增加表头
|
||||
@@ -372,6 +372,13 @@ function customColumnClick(){
|
||||
$('#total').html(trtotal);
|
||||
}
|
||||
}
|
||||
function showTotal(){
|
||||
if($("#total")!=null){
|
||||
$("#total").show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
window.onload=function (){
|
||||
setTimeout(function (){
|
||||
var height=document.documentElement.clientHeight;
|
||||
@@ -477,7 +484,7 @@ function customColumnClick(){
|
||||
var column=[]; //获取标题
|
||||
var index=[];//获取数据列下标
|
||||
var num=0;
|
||||
$("#"+tableId+" thead tr th").each(function(){
|
||||
$("#"+tableId).find("tr th").each(function(){
|
||||
if($(this).is(":visible")){
|
||||
column.push($(this).text().trim());
|
||||
index.push(num);
|
||||
|
||||
Reference in New Issue
Block a user