266 lines
8.2 KiB
Plaintext
266 lines
8.2 KiB
Plaintext
<%@ page contentType="text/html;charset=UTF-8"%>
|
|
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
|
<html>
|
|
<head>
|
|
<title>
|
|
<spring:message code="domain_name"></spring:message>
|
|
</title>
|
|
</head>
|
|
|
|
<body >
|
|
|
|
<div class="page-content">
|
|
<div class="theme-panel hidden-xs hidden-sm">
|
|
<%-- <button type="button" class="btn btn-default" onClick="javascript:window.location='${ctx}/dashboard/ipActiveList'"><i class="fa fa-refresh"></i></button> --%>
|
|
<%-- <button type="button" class="btn btn-default" onClick="javascript:window.location='${ctx}/dashboard/logChart'"><i class="fa fa-history"></i></button> --%>
|
|
</div>
|
|
<%-- <h3 class="page-title">
|
|
<spring:message code="domain_name"></spring:message>
|
|
</h3> --%>
|
|
<div class="row" >
|
|
<form:form id="searchForm" action="${ctx}/dashboard/traffic/ajaxDomainTrans" method="get" class="form-search">
|
|
<input id="beginDate" type="hidden" value="${beginDate}"/>
|
|
<input id="endDate" type="hidden" value="${endDate}"/>
|
|
<input id="domain" type="hidden" value="${domain}"/>
|
|
<input id="entranceId" type="hidden" value="${entranceId}"/>
|
|
<input id="domainName" type="hidden" value="${domainName}"/>
|
|
<input id="total" type="hidden"/>
|
|
<!-- 搜索内容与操作按钮栏 -->
|
|
|
|
<!-- 搜索内容与操作按钮栏 -->
|
|
</form:form>
|
|
</div>
|
|
<div id="chart" style="width:95%;height:500px;"></div>
|
|
|
|
</div>
|
|
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/highcharts.js"></script>
|
|
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/exporting.js"></script>
|
|
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/series-label.js"></script>
|
|
<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/no-data-to-display.js"></script>
|
|
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/standalone.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
domainTrans();
|
|
});
|
|
//活跃IP一小时间隔五分钟统计
|
|
function domainTrans(){
|
|
loading();
|
|
var beginDate=$("#beginDate").val();
|
|
var endDate=$("#endDate").val();
|
|
var entranceId=$("#entranceId").val();
|
|
var domain=$("#domain").val();
|
|
$.ajax({
|
|
url: '${ctx}/dashboard/traffic/ajaxDomainTrans',
|
|
type : "get" ,
|
|
dataType:"json",
|
|
data:{"beginDate":beginDate,"endDate":endDate,"entranceId":entranceId,"domain":domain},
|
|
async:true,
|
|
timeout:40000,
|
|
success:function (rs) {
|
|
$("#tbodyData").html("");
|
|
var xData=new Array();
|
|
var series=new Array();
|
|
var total = 0;
|
|
if(rs!=null&&rs.length>0){
|
|
xData=rs[0].statTime;
|
|
$(rs[0].count).each(function(i,d) {
|
|
total+=d
|
|
})
|
|
series.push({
|
|
name: 'unique',
|
|
data: rs[0].count
|
|
});
|
|
}else{
|
|
series.push({
|
|
name: 'unique',
|
|
data: []
|
|
});
|
|
}
|
|
$("#total").val(JSON.stringify(total));
|
|
showDomainTrans(xData,series);
|
|
closeTip();
|
|
},
|
|
error: function(data, textStatus, errorThrown){
|
|
closeTip();
|
|
},
|
|
complete:function(XMLHttpRequest,status){//超时设置
|
|
closeTip();
|
|
}
|
|
});
|
|
|
|
}
|
|
function showDomainTrans(xData,series){
|
|
var nowDate=new Date();
|
|
var domainName= $("#domainName").val();
|
|
var chart = Highcharts.chart('chart', {
|
|
chart:{
|
|
// type: 'area',
|
|
zoomType: 'x'
|
|
},
|
|
exporting: {
|
|
filename:'<spring:message code="domain_name"/>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(),
|
|
scale:1,
|
|
sourceWidth: 1280,
|
|
sourceHeight: 500,
|
|
buttons: {
|
|
contextButton: {
|
|
menuItems: [
|
|
Highcharts.getOptions().exporting.buttons.contextButton.menuItems[0],// 打印
|
|
Highcharts.getOptions().exporting.buttons.contextButton.menuItems[1],// jpeg
|
|
Highcharts.getOptions().exporting.buttons.contextButton.menuItems[4],// excel
|
|
Highcharts.getOptions().exporting.buttons.contextButton.menuItems[3],// cvs
|
|
]
|
|
}
|
|
}
|
|
},
|
|
noData:{
|
|
style: {//设置字体颜色
|
|
color: '#413333',
|
|
fontFamily:'Microsoft YaHei',
|
|
fontWeight:"unset",
|
|
},
|
|
},
|
|
title: {
|
|
text: domainName
|
|
},
|
|
xAxis: {
|
|
type:'category',
|
|
categories: xData,
|
|
title: {
|
|
text: 'time',
|
|
align:'high',
|
|
},
|
|
|
|
},
|
|
yAxis: {
|
|
title: {
|
|
text: ''
|
|
}
|
|
},
|
|
credits:{//是否有highcharts水印
|
|
enabled:false
|
|
},
|
|
legend: {
|
|
enabled:false
|
|
},
|
|
plotOptions: {
|
|
series: {
|
|
lineWidth:1,
|
|
marker: {
|
|
radius: 2,
|
|
hover: {
|
|
enabled: true,
|
|
radius: 7,
|
|
radiusPlus: 5
|
|
}
|
|
}
|
|
}
|
|
},
|
|
series: series,
|
|
});
|
|
}
|
|
(function(H) {
|
|
H.Chart.prototype.downloadXLS = function() {
|
|
var div = document.createElement('div'), xlsxRows = [], xlsxColumns = [];
|
|
var nowDate=new Date();
|
|
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 : '<spring:message code="domain_name"></spring:message>'
|
|
})
|
|
b.push({
|
|
type : "string",
|
|
value : start + "--" + end
|
|
})
|
|
xlsxRows.unshift(b);
|
|
|
|
var a = new Array();
|
|
a.push({
|
|
type : 'string',
|
|
value : '<spring:message code="total"></spring:message>'
|
|
})
|
|
var total = JSON.parse($("#total").val());
|
|
a.push({
|
|
type : "number",
|
|
value : total
|
|
})
|
|
xlsxRows.push(a)
|
|
zipcelx({
|
|
filename : '<spring:message code="domain_name"></spring:message>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds(),
|
|
sheet : {
|
|
data : xlsxRows
|
|
}
|
|
});
|
|
};
|
|
}(Highcharts));
|
|
|
|
(function(H) {
|
|
H.Chart.prototype.downloadCSV = function() {
|
|
var rows = this.getDataRows(true);
|
|
var data=new Array();
|
|
var total = total = JSON.parse($("#total").val());
|
|
$(rows).each(function (i,d){
|
|
if(d!=null&&i>0){
|
|
data.push({
|
|
num1:d,
|
|
})
|
|
}
|
|
})
|
|
data.push({
|
|
num1:"<spring:message code='total'/>",
|
|
num2:total
|
|
})
|
|
var start = $("#beginDate").val();
|
|
var end = $("#endDate").val();
|
|
exportCsv({
|
|
title:["<spring:message code='domain_name'/>",start+"--"+end],
|
|
titleForKey:["num1","num2"],
|
|
data:data
|
|
});
|
|
};
|
|
}(Highcharts));
|
|
|
|
function exportCsv(obj){
|
|
var nowDate=new Date();
|
|
//title ["","",""]
|
|
var title = obj.title;
|
|
//titleForKey ["","",""]
|
|
var titleForKey = obj.titleForKey;
|
|
var data = obj.data;
|
|
var str = [];
|
|
str.push(obj.title.join(",")+"\n");
|
|
for(var i=0;i<data.length;i++){
|
|
var temp = [];
|
|
for(var j=0;j<titleForKey.length;j++){
|
|
temp.push(data[i][titleForKey[j]]);
|
|
}
|
|
str.push(temp.join(",")+"\n");
|
|
}
|
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
|
var downloadLink = document.createElement("a");
|
|
downloadLink.href = uri;
|
|
downloadLink.download = "<spring:message code='domain_name'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
|
document.body.appendChild(downloadLink);
|
|
downloadLink.click();
|
|
document.body.removeChild(downloadLink);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |