流量统计详情导出xls功能修改为后台

This commit is contained in:
zhanghongqing
2019-01-04 12:48:24 +08:00
parent d25c8bfce9
commit a75ae809e8
12 changed files with 338 additions and 171 deletions

View File

@@ -124,6 +124,8 @@ $(document).ready(function(){
function searchList(){
var start=$("#beginDate").val();
var end=$("#endDate").val();
$("#beginDateh").val(start);
$("#endDateh").val(end);
if(start==''||end==''||end==null||start==null){
window.location.reload();
}else{
@@ -137,7 +139,7 @@ function ajaxProtocolList(start,end){
dataType: "json",
data:{"beginDate":start,"endDate":end},
async:true,
timeout:10000,
timeout:50000,
beforeSend:function(){
loading();
},
@@ -185,8 +187,8 @@ function doPrint() {
$(".export-btn").click(function(){
var dataType = $(this).attr("data-type");
getPageData(1,999999);// 设置导出页条数
var start=$("#beginDate").val();
var end=$("#endDate").val();
var start=$("#beginDateh").val();
var end=$("#endDateh").val();
var nowDate=new Date();
var htmlTitle="";
htmlTitle+="<tr class='tr-title'>";
@@ -194,19 +196,50 @@ $(".export-btn").click(function(){
htmlTitle+= "<th class='tc' colspan='2'>"+start+"--"+ end +"</th>";
htmlTitle+="</tr>"
$("#contentTable thead").prepend(htmlTitle);
var te = $("#contentTable").tableExport({
headings:true,
footers:true,
formats:[dataType],
fileName:"service"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(),
bootstrap:false
});
$("#myexport").click();
$("caption").remove();
if(dataType=="xlsx"){
getTableContent("contentTable");
}else{
var te = $("#contentTable").tableExport({
headings:true,
footers:true,
formats:[dataType],
fileName:"<spring:message code='service'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(),
bootstrap:false
});
$("#myexport").click();
$("caption").remove();
}
$(".tr-title").remove();
getPageData(1,10);
pageJuan(10);//初始化分页
});
/**
* 调用后台接口
* @param Int id 表格id
* @return Array
*/
function getTableContent(id){
var mytable = document.getElementById(id);
var nowDate=new Date();
var data = [];
for(var i=0,rows=mytable.rows.length; i<rows; i++){
for(var j=0,cells=mytable.rows[i].cells.length; j<cells; j++){
if(!data[i]){
data[i] = new Array();
}
data[i][j] = mytable.rows[i].cells[j].innerHTML;
}
}
var title= data.shift();
var heard= data.shift();
var map ={};
map["titleTime"]=title;
map["heard"]=heard;
map["book"]=data;
map["titleCode"]="<spring:message code='service'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds();
var exports = JSON.stringify(map);
aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports});
}
/**
* 获取本页数据
* @param currentPage 当前页数 【初次查数据默认第1页】
@@ -246,7 +279,7 @@ function htmlData(fileDataS){
$.each(fileDataS,function (index,data){
if(data!=null){
var html = "<tr>";
html+= "<td class='tc'>"+data.name+"</td>";
html+= "<td class='tc' title=''>"+data.name+"</td>";
html+= "<td class='tc'>"+data.linkNum+"</td>";
html+= "<td class='tc'>"+(data.linkNum/data.allLink*100).toFixed(2)+"%"+"</td>";
html+= "<td class='tc'>"+data.packets+"</td>";