修改流量统计traffic,动作详情的导出excel文件为后台导出

This commit is contained in:
zhanghongqing
2019-01-03 21:08:34 +08:00
parent 673db28e2e
commit 966989c357
3 changed files with 113 additions and 32 deletions

View File

@@ -82,7 +82,6 @@
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/offline-exporting.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/exporting-data.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/standalone.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/export-csv.js"></script>
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/no-data-to-display.js"></script>
<script type="text/javascript">
@@ -111,6 +110,8 @@
// loading();
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 {
@@ -267,12 +268,37 @@
}
(function(H) {
H.Chart.prototype.downloadXLS = function() {
var div = document.createElement('div'), xlsxRows = [], xlsxColumns = [];
var nowDate=new Date();
var start=$("#beginDateh").val();
var end=$("#endDateh").val();
/* var div = document.createElement('div'), xlsxRows = [], xlsxColumns = [];
div.style.display = 'none';
document.body.appendChild(div);
rows = this.getDataRows(true);
xlsxRows = H.map(rows.slice(1), function(row) {
document.body.appendChild(div); */
var rows = this.getDataRows(true);
/* 调用后台接口导出 */
var total=[];
var totalVlue = JSON.parse($("#total").val());
var map={};
$(rows).each(function(i,d){
// 去掉多余属性
delete d.name;
delete d.x;
delete d.xValues;
})
total.push('<spring:message code="report_total"/>',totalVlue);
rows.shift(); // 删除一个重复行
var heard = rows.shift(); // 删除一个重复行
rows.push(total)
var title=[];
title.push('<spring:message code="${searchAction}"></spring:message>',start+"--"+end);
map["titleTime"]=title;
map["heard"]=heard;
map["book"]=rows;
map["titleCode"]='<spring:message code="${searchAction}"></spring:message>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds();
var exports = JSON.stringify(map);
aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports});
/* xlsxRows = H.map(rows.slice(1), function(row) {
return H.map(row, function(column) {
return {
type : typeof column === 'number' ? 'number' : 'string',
@@ -309,7 +335,7 @@
sheet : {
data : xlsxRows
}
});
}); */
};
}(Highcharts));
@@ -327,11 +353,11 @@
}
})
data.push({
num1:"<spring:message code='total'/>",
num1:"<spring:message code='report_total'/>",
num2:total
})
var start = $("#beginDate").val();
var end = $("#endDate").val();
var start = $("#beginDateh").val();
var end = $("#endDateh").val();
exportCsv({
title:["<spring:message code='${searchAction}'/>",start+"--"+end],
titleForKey:["num1","num2"],

View File

@@ -95,6 +95,8 @@ function searchList(){
loading();
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{
@@ -253,15 +255,38 @@ function showActionTransChart(xData,series){
(function(H) {
var nowDate=new Date();
H.Chart.prototype.downloadXLS = function() {
var start=$("#beginDate").val();
var end=$("#endDate").val();
var start=$("#beginDateh").val();
var end=$("#endDateh").val();
var div = document.createElement('div'),
xlsxRows = [],
xlsxColumns = [];
div.style.display = 'none';
document.body.appendChild(div);
rows = this.getDataRows(true);
xlsxRows = H.map(rows.slice(1), function(row) {
/* 调用后台接口导出 */
var total = JSON.parse($("#total").val());
var map={};
$(rows).each(function(i,d){
// 去掉多余属性
delete d.name;
delete d.x;
delete d.xValues;
})
total.unshift('<spring:message code="report_total"/>');
rows.shift(); // 删除一个重复行
var heard = rows.shift(); // 删除一个重复行
rows.push(total)
var title=[];
title.push('<spring:message code="${searchAction}"></spring:message>',start+"--"+end);
map["titleTime"]=title;
map["heard"]=heard;
map["book"]=rows;
map["titleCode"]='<spring:message code="${searchAction}"></spring:message>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds();
var exports = JSON.stringify(map);
aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports});
/* xlsxRows = H.map(rows.slice(1), function(row) {
return H.map(row, function(column) {
return {
type: typeof column === 'number' ? 'number' : 'string',
@@ -308,7 +333,7 @@ function showActionTransChart(xData,series){
sheet: {
data: xlsxRows
}
});
}); */
};
}(Highcharts));
(function(H) {
@@ -328,11 +353,11 @@ function showActionTransChart(xData,series){
}
})
data.push({
num1:"<spring:message code='total'/>",
num1:"<spring:message code='report_total'/>",
num2:total
})
var start = $("#beginDate").val();
var end = $("#endDate").val();
var start = $("#beginDateh").val();
var end = $("#endDateh").val();
exportCsv({
title:["<spring:message code='${searchAction}'/>",start+"--"+end],
titleForKey:["num1","num2","num3"],

View File

@@ -126,6 +126,8 @@ function searchList(){
loading();
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{
@@ -263,7 +265,7 @@ function changeBandwidth(unitType,beginDate,endDate){
/* 网络带宽时间维度趋势图 */
function showBandwidthChart(id,unitType,xdata,ydata,title){
var nowDate=new Date();
var nowDate=new Date();
Highcharts.setOptions({ global: { useUTC: false } });
var chart = Highcharts.chart(id, {
chart:{
@@ -386,20 +388,52 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){
}
}, */
series:ydata
});
});
}
(function(H) {
H.Chart.prototype.downloadXLS = function() {
var nowDate=new Date();
var start=$("#beginDate").val();
var end=$("#endDate").val();
var start=$("#beginDateh").val();
var end=$("#endDateh").val();
var div = document.createElement('div'),
xlsxRows = [],
xlsxColumns = [];
div.style.display = 'none';
document.body.appendChild(div);
rows = this.getDataRows(true);
xlsxRows = H.map(rows.slice(1), function(row) {
/* 调用后台接口导出 */
var total = [];
var map={};
$(rows).each(function(i,d){
if(d!=null){
if(i==0){
if(d[0].indexOf("Astana") != -1){
total=JSON.parse($("#total").val());
}
if(d[0].indexOf("Alamty") != -1){
total=JSON.parse($("#total2").val());
}
}
}
// 去掉多余属性
delete d.name;
delete d.x;
delete d.xValues;
})
total.unshift('<spring:message code="report_total"/>');
rows.shift(); // 删除一个重复行
var heard = rows.shift(); // 删除一个重复行
rows.push(total)
var title=[];
title.push('<spring:message code="traffic"></spring:message>',start+"--"+end);
map["titleTime"]=title;
map["heard"]=heard;
map["book"]=rows;
map["titleCode"]='<spring:message code="traffic"></spring:message>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds();
var exports = JSON.stringify(map);
aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports});
/* xlsxRows = H.map(rows.slice(1), function(row) {
return H.map(row, function(column) {
return {
type: typeof column === 'number' ? 'number' : 'string',
@@ -436,17 +470,14 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){
b.push({
type:"string",
value:start+'--'+end
})
xlsxRows.unshift(b)
zipcelx({
}); */
// xlsxRows.unshift(b)
/* zipcelx({
filename: '<spring:message code="traffic"></spring:message>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(),
sheet: {
data: xlsxRows
}
});
}); */
};
}(Highcharts));
@@ -478,13 +509,12 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){
}
}
})
console.log(total)
data.push({
num1:"<spring:message code='total'/>",
num1:"<spring:message code='report_total'/>",
num2:total
})
var start = $("#beginDate").val();
var end = $("#endDate").val();
var start = $("#beginDateh").val();
var end = $("#endDateh").val();
exportCsv({
title:["<spring:message code='traffic'/>",start+"--"+end],
titleForKey:["num1","num2","num3"],