解决导出错误提示-唐浩 活跃ip导出报表格式更改

This commit is contained in:
zhanghongqing
2018-12-24 19:16:14 +08:00
parent fbbd5ec3bd
commit c05cc92f3b
6 changed files with 84 additions and 20 deletions

View File

@@ -81,7 +81,7 @@
<div id="chart" style="width:98%;height: 510px; -moz-user-select: none; position: relative;"></div>
</div>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <spring:message code="export"/>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> <spring:message code="export"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" style="min-width: 81px;right: -16px;">
@@ -100,8 +100,8 @@
<th class="tl"><spring:message code="percentage"/> (<spring:message code="link_num"/>)</th>
<th class="tl"><spring:message code="packets"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="packets"/>)</th>
<th class="tl"><spring:message code="Gbyte"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="Gbyte"/>)</th>
<th class="tl"><spring:message code="GByte"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="GByte"/>)</th>
</tr>
</thead>
<tbody id="tableData"></tbody>

View File

@@ -58,7 +58,7 @@
<div id="chart" style="width:98%;height: 510px; -moz-user-select: none; position: relative;"></div>
</div> -->
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <spring:message code="export"/>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> <spring:message code="export"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" style="min-width: 81px;right: -16px;">
@@ -77,8 +77,8 @@
<th class="tl"><spring:message code="percentage"/> (<spring:message code="link_num"/>)</th>
<th class="tl"><spring:message code="packets"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="packets"/>)</th>
<th class="tl"><spring:message code="Gbyte"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="Gbyte"/>)</th>
<th class="tl"><spring:message code="GByte"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="GByte"/>)</th>
</tr>
</thead>
<tbody id="tableData"></tbody>

View File

@@ -46,12 +46,13 @@
<button type="button" class="btn blue" onClick="return searchList()"> <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>
</div>
</div>
<!-- 搜索内容与操作按钮栏 -->
</form:form>
</div>
<div id="chart" style="width:95%;height:350px;"></div>
<input id="total" type="hidden"/>
<div class="col-md-12">
<div class="portlet">
<div class="portlet-body">
@@ -61,7 +62,7 @@
<spring:message code="traffic_ipactive_hour_max"></spring:message>
</h3>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <spring:message code="export"/>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> <spring:message code="export"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" style="min-width: 81px;right: -16px;">
@@ -72,7 +73,7 @@
<br>
<br>
<div class="" align="center">
<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">
<thead>
<tr>
<th><spring:message code="ip_addr"/></th>
@@ -106,6 +107,7 @@
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/offline-exporting.js"></script>
<%-- <script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/themes/grid.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 type="text/javascript">
$(document).ready(function(){
loading();
@@ -114,7 +116,7 @@ $(document).ready(function(){
$("#beginDate").val(starth);
$("#endDate").val(endh);
ipActiveMinuteList(starth,endh);
ipActiveOneHourList(starth,endh);
// ipActiveOneHourList(starth,endh);
//筛选功能初始化
$("#resetBtn").on("click",function(){
$("select.selectpicker").each(function(){
@@ -126,6 +128,7 @@ $(document).ready(function(){
$("#searchForm")[0].reset();
});
});
//导出列表
$(".export-btn").click(function(){
var dataType = $(this).attr("data-type");
@@ -133,7 +136,7 @@ $(".export-btn").click(function(){
var end=$("#endDate").val();
var htmlTitle="";
htmlTitle+="<tr class='tr-title'>";
htmlTitle+= "<th class='tc' colspan='1'>"+"<spring:message code='traffic_ipactive_hour_max'/>"+"</th>";
htmlTitle+= "<th class='tc' colspan='1'>"+"<spring:message code='traffic_ipactive_hour_trend'/>"+"</th>";
htmlTitle+= "<th class='tc' colspan='2'>"+start+"--"+ end +"</th>";
htmlTitle+="</tr>"
$("#contentTable thead").prepend(htmlTitle);
@@ -156,7 +159,7 @@ function searchList(){
window.location.reload();
}else{
ipActiveMinuteList(start,end);
ipActiveOneHourList(start,end);
// ipActiveOneHourList(start,end);
}
}
@@ -164,14 +167,18 @@ function showIpActiveChart(rs){
var data=new Array();
var xData=new Array();
xData=rs[0].statTime;
//var tickInterval=Math.ceil(xData.length/6);
var series=new Array();
var total=[];
$(rs).each(function(i, d) {
total.push(
sum(d.linkNum)
)
series.push({
name: d.ipAddr,
data: d.linkNum
});
})
$("#total").val(JSON.stringify(total));
var chart = Highcharts.chart('chart', {
chart:{
//type: 'area',
@@ -241,7 +248,7 @@ function showIpActiveChart(rs){
loading();
$.ajax({
url: '${ctx}/dashboard/ipActiveMinuteList',
type : "get" ,
type : "get",
dataType:"json",
data:{"beginDate":beginDate,"endDate":endDate},
cache:false,
@@ -337,6 +344,62 @@ function showIpActiveChart(rs){
});
}
(function(H) {
H.Chart.prototype.downloadXLS = function() {
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) {
return H.map(row, function(column) {
return {
type: typeof column === 'number' ? 'number' : 'string',
value: column
};
});
});
var start=$("#beginDate").val();
var end=$("#endDate").val();
var b =new Array();
b.push({
type:'string',
value:'IP-Active'
})
b.push({
type:"string",
value:start+"--"+end
})
xlsxRows.unshift(b);
var a =new Array();
a.push({
type:'string',
value:'Total'
})
var total=total=JSON.parse($("#total").val());
$(total).each(function(i, d) {
a.push({
type:"number",
value:d
})
})
xlsxRows.push(a)
zipcelx({
filename: 'IP-Active',
sheet: {
data: xlsxRows
}
});
};
}(Highcharts));
function sum(arr) {
return arr.reduce(function(prev, curr, idx, arr){
return prev + curr;
});
}
</script>
</body>
</html>

View File

@@ -71,7 +71,7 @@
<div id="chart" style="width:98%;height: 510px; -moz-user-select: none; position: relative;"></div>
</div>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <spring:message code="export"/>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> <spring:message code="export"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" style="min-width: 81px;right: -16px;">
@@ -90,8 +90,8 @@
<th class="tl"><spring:message code="percentage"/> (<spring:message code="link_num"/>)</th>
<th class="tl"><spring:message code="packets"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="packets"/>)</th>
<th class="tl"><spring:message code="Gbyte"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="Gbyte"/>)</th>
<th class="tl"><spring:message code="GByte"/></th>
<th class="tl"><spring:message code="percentage"/> (<spring:message code="GByte"/>)</th>
</tr>
</thead>
<tbody id="tableData"></tbody>

View File

@@ -121,7 +121,7 @@
<i class="fa fa-download"> <spring:message code="print" /></i>
</button>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <spring:message code="export"/>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> <spring:message code="export"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" style="min-width: 81px;right: -16px;">
@@ -142,8 +142,8 @@
<th><spring:message code="entrance_id"/></th>
<th><spring:message code="packets"/></th>
<th><spring:message code="percentage"/> (<spring:message code="packets"/>)</th>
<th><spring:message code="Gbyte"/></th>
<th><spring:message code="percentage"/> (<spring:message code="Gbyte"/>)</th>
<th><spring:message code="GByte"/></th>
<th><spring:message code="percentage"/> (<spring:message code="GByte"/>)</th>
</tr>
</thead>
<tbody id="tableData"></tbody>

File diff suppressed because one or more lines are too long