新增流量统计app趋势动态界面,修改导出csv俄文office打开乱码问题
This commit is contained in:
@@ -717,6 +717,8 @@ public final class Constants {
|
|||||||
public static final String TRAFFIC_DOMAIN_TRANS=Configurations.getStringProperty("trafficDomainTrans","trafficDomainTrans");
|
public static final String TRAFFIC_DOMAIN_TRANS=Configurations.getStringProperty("trafficDomainTrans","trafficDomainTrans");
|
||||||
public static final String TRAFFIC_PORTACTIVE_FIVEMINUTE=Configurations.getStringProperty("trafficPortActiveFiveMinute","trafficPortActiveFiveMinute");
|
public static final String TRAFFIC_PORTACTIVE_FIVEMINUTE=Configurations.getStringProperty("trafficPortActiveFiveMinute","trafficPortActiveFiveMinute");
|
||||||
public static final String TREND_TOTAL_REPORT=Configurations.getStringProperty("trendTotalReport","trendTotalReport");
|
public static final String TREND_TOTAL_REPORT=Configurations.getStringProperty("trendTotalReport","trendTotalReport");
|
||||||
|
public static final String TRAFFIC_APP_TREND=Configurations.getStringProperty("trafficAppTrend","trafficAppTrend");
|
||||||
|
public static final String APPCONN_RECORD_TOP100=Configurations.getStringProperty("appConnRecordTop100","appConnRecordTop100");
|
||||||
/**
|
/**
|
||||||
* httpclient 工具超时时间设置
|
* httpclient 工具超时时间设置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -427,6 +427,85 @@ public class TrafficStatisticsInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* App趋势界面 独立IP访问数量趋势图
|
||||||
|
*/
|
||||||
|
@RequestMapping(value="appTrendList")
|
||||||
|
public String appTrendList(Model model,String beginDate,String endDate,String appName,Integer appType){
|
||||||
|
if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){
|
||||||
|
Calendar cal = Calendar. getInstance ();
|
||||||
|
cal.setTime(new Date());
|
||||||
|
endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 2);
|
||||||
|
beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||||
|
}
|
||||||
|
model.addAttribute("appName", appName);
|
||||||
|
model.addAttribute("appType", appType);
|
||||||
|
model.addAttribute("beginDate", beginDate);
|
||||||
|
model.addAttribute("endDate", endDate);
|
||||||
|
return "/dashboard/trafficAppTrendList";
|
||||||
|
}
|
||||||
|
@RequestMapping("ajaxAppTrend")
|
||||||
|
@ResponseBody
|
||||||
|
public Map ajaxAppTrend(String beginDate,String endDate,Integer appType,Integer entranceId,Model model){
|
||||||
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||||
|
Map list = new HashMap();
|
||||||
|
try {
|
||||||
|
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_TREND;
|
||||||
|
URIBuilder uriBuilder = new URIBuilder(url);
|
||||||
|
uriBuilder.addParameter("searchStartTime",beginDate);
|
||||||
|
uriBuilder.addParameter("searchEndTime",endDate);
|
||||||
|
url=uriBuilder.toString();
|
||||||
|
if(appType!=null){
|
||||||
|
url=url+"&searchAppId="+appType;
|
||||||
|
}
|
||||||
|
if(entranceId!=null){
|
||||||
|
url=url+"&searchEntranceId="+entranceId;
|
||||||
|
}
|
||||||
|
String string = HttpClientUtil.get(url);
|
||||||
|
Gson gson = new GsonBuilder().create();
|
||||||
|
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||||
|
logger.debug("app趋势图"+fromJsonList);
|
||||||
|
list = (Map) fromJsonList.get("data");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("app趋势图数据获取错误"+e);
|
||||||
|
list.put("error","request_service_failed");
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
@RequestMapping("ajaxAppTopList")
|
||||||
|
@ResponseBody
|
||||||
|
public List ajaxAppTopList(String beginDate,String endDate,Integer appType,Integer entranceId,Model model){
|
||||||
|
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||||
|
List list = new ArrayList();
|
||||||
|
try {
|
||||||
|
String url=Constants.DASHBOARD_URL+Constants.APPCONN_RECORD_TOP100;
|
||||||
|
URIBuilder uriBuilder = new URIBuilder(url);
|
||||||
|
uriBuilder.addParameter("searchStartTime",beginDate);
|
||||||
|
uriBuilder.addParameter("searchEndTime",endDate);
|
||||||
|
url=uriBuilder.toString();
|
||||||
|
if(appType!=null){
|
||||||
|
url=url+"&searchAppId="+appType;
|
||||||
|
}
|
||||||
|
if(entranceId!=null){
|
||||||
|
url=url+"&searchEntranceId="+entranceId;
|
||||||
|
}
|
||||||
|
String string = HttpClientUtil.get(url);
|
||||||
|
Gson gson = new GsonBuilder().create();
|
||||||
|
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||||
|
logger.debug("app列表Top100"+fromJsonList);
|
||||||
|
list = (ArrayList) fromJsonList.get("data");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("app列表Top100"+e);
|
||||||
|
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网址类型列表
|
* 网址类型列表
|
||||||
*/
|
*/
|
||||||
@@ -470,12 +549,12 @@ public class TrafficStatisticsInfoController extends BaseController {
|
|||||||
String string = HttpClientUtil.get(url);
|
String string = HttpClientUtil.get(url);
|
||||||
Gson gson = new GsonBuilder().create();
|
Gson gson = new GsonBuilder().create();
|
||||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||||
logger.debug("活跃IP1小时"+fromJsonList);
|
logger.debug("活跃域名1小时"+fromJsonList);
|
||||||
list = (ArrayList) fromJsonList.get("data");
|
list = (ArrayList) fromJsonList.get("data");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("活跃IP数据获取错误"+e);
|
logger.error("活跃域名数据获取错误"+e);
|
||||||
list.add(Maps.newHashMap("error","request_service_failed"));
|
list.add(Maps.newHashMap("error","request_service_failed"));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@@ -610,5 +610,7 @@ dashboardUrlV2=http://10.0.7.14:9999/galaxy-service/service/log/v2/
|
|||||||
trafficAreaStat=v1/trafficAreaStat
|
trafficAreaStat=v1/trafficAreaStat
|
||||||
logServiceTopn=v1/logServiceTopn
|
logServiceTopn=v1/logServiceTopn
|
||||||
blockAndDropStat=v1/blockAndDropStat
|
blockAndDropStat=v1/blockAndDropStat
|
||||||
#配置启停接口
|
#\u914d\u7f6e\u542f\u505c\u63a5\u53e3
|
||||||
configStartStop=v2/configStartStop
|
configStartStop=v2/configStartStop
|
||||||
|
trafficAppTrend=trafficAppTrend
|
||||||
|
appConnRecordTop100=appConnRecordTop100
|
||||||
@@ -377,10 +377,14 @@
|
|||||||
}
|
}
|
||||||
str.push(temp.join(",")+"\n");
|
str.push(temp.join(",")+"\n");
|
||||||
}
|
}
|
||||||
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
|
||||||
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
var downloadLink = document.createElement("a");
|
var downloadLink = document.createElement("a");
|
||||||
downloadLink.href = uri;
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
downloadLink.download = "<spring:message code='${searchAction}'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
downloadLink.download = "<spring:message code='${searchAction}'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
|
|||||||
@@ -381,10 +381,14 @@ function showActionTransChart(xData,series){
|
|||||||
}
|
}
|
||||||
str.push(temp.join(",")+"\n");
|
str.push(temp.join(",")+"\n");
|
||||||
}
|
}
|
||||||
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
|
||||||
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
var downloadLink = document.createElement("a");
|
var downloadLink = document.createElement("a");
|
||||||
downloadLink.href = uri;
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
downloadLink.download = "<spring:message code='${searchAction}'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
downloadLink.download = "<spring:message code='${searchAction}'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
|
|||||||
741
src/main/webapp/WEB-INF/views/dashboard/trafficAppTrendList.jsp
Normal file
741
src/main/webapp/WEB-INF/views/dashboard/trafficAppTrendList.jsp
Normal file
@@ -0,0 +1,741 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
|
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><spring:message code="app"></spring:message>
|
||||||
|
</title>
|
||||||
|
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/pages/css/dashboard.css">
|
||||||
|
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/pages/css/pagination.css">
|
||||||
|
|
||||||
|
<script src="${pageContext.request.contextPath}/static/pages/scripts/jquery.pagination.js"></script>
|
||||||
|
<script src="${ctxStatic }/global/plugins/tableExport-3.3.13/xlsx.core.js"></script>
|
||||||
|
<script src="${ctxStatic }/global/plugins/tableExport-3.3.13/FileSaver.js"></script>
|
||||||
|
<script src="${ctxStatic }/global/plugins/tableExport-3.3.13/tableexport.js"></script>
|
||||||
|
</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.reload()">
|
||||||
|
<i class="fa fa-refresh"></i>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default" onClick="javascript:window.location='${ctx}/dashboard/traffic/appTypeList'">
|
||||||
|
<i class="fa fa-history"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<h3 class="page-title">
|
||||||
|
<spring:message code="${appName}"></spring:message>
|
||||||
|
</h3>
|
||||||
|
<h5 class="page-header"></h5>
|
||||||
|
<div class="row">
|
||||||
|
<form:form id="searchForm" method="get" class="form-search">
|
||||||
|
<!-- 搜索内容与操作按钮栏 -->
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="pull-left">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-btn">
|
||||||
|
<span class="selectpicker form-control"><spring:message
|
||||||
|
code="begin_date" /></span>
|
||||||
|
</div>
|
||||||
|
<input name="beginDate" id="beginDate" type="text" readonly="readonly" maxlength="20" class="form-control Wdate input-medium"
|
||||||
|
value="" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setStartTime('#beginDate','#endDate',7,'d','yyyy-MM-dd hh:mm:ss',false)"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="pull-left">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-btn">
|
||||||
|
<span class="selectpicker form-control"><spring:message
|
||||||
|
code="end_date" /></span>
|
||||||
|
</div>
|
||||||
|
<input name="endDate" id="endDate" type="text" readonly="readonly" maxlength="20" class="form-control Wdate input-medium"
|
||||||
|
value="" onclick="WdatePicker({onpicked:function(){this.onchange()},dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true,maxDate:'#F{\'new Date()\'}'});" onchange="setEndTime('#beginDate','#endDate',7,'d','yyyy-MM-dd hh:mm:ss',false)"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="pull-left">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-btn">
|
||||||
|
<span class="selectpicker form-control" ><spring:message code="entrance_id"/></span>
|
||||||
|
</div>
|
||||||
|
<select id="entranceId" name="entranceId" class="selectpicker form-control" width="100px" data-live-search="true" data-live-search-placeholder="search">
|
||||||
|
<option value=""><spring:message code="select"/></option>
|
||||||
|
<c:forEach items="${fns:getDictList('ENTRANCE')}" var="dict" >
|
||||||
|
<option value="${dict.itemCode}"><spring:message code="${dict.itemValue}"></spring:message></option>
|
||||||
|
</c:forEach>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="pull-left">
|
||||||
|
<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 class="row">
|
||||||
|
<div id="chart" style="width: 97%; height: 530px; margin-top: 20px"></div>
|
||||||
|
<input id="total" type="hidden" />
|
||||||
|
<input id="sipData" type="hidden" />
|
||||||
|
<input id="dipData" type="hidden" />
|
||||||
|
<input id="timeData" type="hidden" />
|
||||||
|
<input id="appType" name="appType" type="hidden" value="${appType}" />
|
||||||
|
<input id="beginDateh" type="hidden" value="${beginDate}" />
|
||||||
|
<input id="endDateh" type="hidden" value="${endDate}" />
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<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: 2px;">
|
||||||
|
<li><a class="btn export-btn" data-type="xlsx" id="export-btn"><i class="fa fa-download"> </i> excel </a><li>
|
||||||
|
<li><a class="btn export-btn" data-type="csv" id="export-btn"><i class="fa fa-download"> </i> csv </a><li>
|
||||||
|
</ul>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-default css-print" onClick="doPrint()"><i class="fa glyphicon glyphicon-print" style="top:3px;margin-right: 3px;"></i><spring:message code="print"/></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="contentTable" style="width: 100%;"
|
||||||
|
class="table table-striped table-bordered table-condensed text-nowrap">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><spring:message code="ip"/></th>
|
||||||
|
<th><spring:message code="link_num"/></th>
|
||||||
|
<th><spring:message code="percentage"/> (<spring:message code="link_num"/>)</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>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tableData"></tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div id="page" class="pageView"><div class="M-box"></div><div class="pageMessage"> <spring:message code="current"/> <input type="text" class="pageCurrent" readonly="readonly"/> / <span class="pageNum"></span> <spring:message code="page"/> , <spring:message code="total"/> <span class="pageTotal"></span> <spring:message code="count"/></div></div>
|
||||||
|
<div class="none-data"><i class="fa fa-warning font-red-flamingo"></i> <spring:message code="noneData"/></div>
|
||||||
|
</div>
|
||||||
|
</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/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/no-data-to-display.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
var starth = $("#beginDateh").val();
|
||||||
|
var endh = $("#endDateh").val();
|
||||||
|
$("#beginDate").val(starth);
|
||||||
|
$("#endDate").val(endh);
|
||||||
|
var appType=$("#appType").val();
|
||||||
|
var entranceId=$("#entranceId").val();
|
||||||
|
appTransAjax(starth,endh,appType,entranceId);
|
||||||
|
appTop100List(starth,endh,appType,entranceId);
|
||||||
|
//筛选功能初始化
|
||||||
|
$("#resetBtn").on("click",function() {
|
||||||
|
$("select.selectpicker").each(function() {
|
||||||
|
$(this).selectpicker('val',$(this).find('option:first').val());
|
||||||
|
$(this).find("option").attr("selected",false);
|
||||||
|
$(this).find("option:first").attr("selected",true);
|
||||||
|
});
|
||||||
|
$(".Wdate").attr("value", '');
|
||||||
|
$("#searchForm")[0].reset();
|
||||||
|
});
|
||||||
|
$('.pageView').hide();
|
||||||
|
});
|
||||||
|
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 {
|
||||||
|
var appType=$("#appType").val();
|
||||||
|
var entranceId=$("#entranceId").val();
|
||||||
|
appTransAjax(start,end,appType,entranceId);// 折线
|
||||||
|
appTop100List(start,end,appType,entranceId);// 列表
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 列表
|
||||||
|
function appTop100List(start,end,appType,entranceId){
|
||||||
|
$.ajax({
|
||||||
|
url : "${ctx}/dashboard/traffic/ajaxAppTopList",
|
||||||
|
type : 'get',
|
||||||
|
dataType : "json",
|
||||||
|
data : {
|
||||||
|
"beginDate" : start,
|
||||||
|
"endDate" : end,
|
||||||
|
"appType" : appType,
|
||||||
|
"entranceId" : entranceId
|
||||||
|
},
|
||||||
|
async : true,
|
||||||
|
timeout : 50000,
|
||||||
|
traditional:true,
|
||||||
|
success : function(data) {
|
||||||
|
if (data != null && data.length > 0 && data[0].error != null) {
|
||||||
|
top.$.jBox.tip( "<spring:message code='request_service_failed'/>", "<spring:message code='info'/>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fileData = data;
|
||||||
|
getPageData(1, 10);//初始化第一页的数据
|
||||||
|
pageJuan(10);//初始化分页
|
||||||
|
closeTip();
|
||||||
|
if (data != null && data.length < 1) {
|
||||||
|
$(".none-data").show();
|
||||||
|
$('.pageView').hide();
|
||||||
|
} else {
|
||||||
|
$('.none-data').hide();
|
||||||
|
$('.pageView').show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error : function(data, textStatus, errorThrown) {
|
||||||
|
closeTip();
|
||||||
|
},
|
||||||
|
complete : function(XMLHttpRequest, status) {//超时设置
|
||||||
|
closeTip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 处理接口数据
|
||||||
|
function htmlData(fileDataS) {
|
||||||
|
$("#tableData").html("");
|
||||||
|
if (fileDataS == null || fileData == '') {
|
||||||
|
$(".none-data").show();
|
||||||
|
$('.pageView').hide();
|
||||||
|
} else {
|
||||||
|
$('.none-data').hide();
|
||||||
|
$('.pageView').show();
|
||||||
|
var start=$("#beginDateh").val();
|
||||||
|
var end=$("#endDateh").val();
|
||||||
|
var totalunique=0;
|
||||||
|
var totalpkt=0;
|
||||||
|
var totalbyte=0;
|
||||||
|
$.each(fileDataS, function(index, data) {
|
||||||
|
totalunique=totalunique+(Number(data.logNum));
|
||||||
|
totalpkt=totalpkt+(Number(data.pktNum));
|
||||||
|
totalbyte=totalbyte+(Number(data.byteNum));
|
||||||
|
})
|
||||||
|
$.each(fileDataS, function(index, data) {
|
||||||
|
if (data != null) {
|
||||||
|
var uniqueper=0;
|
||||||
|
var packper=0;
|
||||||
|
var gbytper=0;
|
||||||
|
if(totalunique!=null&&totalunique!=0 ){
|
||||||
|
uniqueper=((data.logNum/totalunique)*100).toFixed(2);
|
||||||
|
}
|
||||||
|
if(totalpkt!=null&&totalpkt!=0 ){
|
||||||
|
packper=((data.pktNum/totalpkt)*100).toFixed(2);
|
||||||
|
}
|
||||||
|
if(totalbyte!=null&&totalbyte!=0 ){
|
||||||
|
gbytper=((data.byteNum/(totalbyte))*100).toFixed(2);
|
||||||
|
}
|
||||||
|
var html ="<tr>";
|
||||||
|
html += "<td class='tc'>" + data.ipAddr + "</td>";
|
||||||
|
html += "<td class='tc'>" + data.logNum + "</td>";
|
||||||
|
html += "<td class='tc'>" + uniqueper + " %</td>";
|
||||||
|
// html += "<td class='tc'>" + (((data.entranceId)==1) ? "Astana":"Alamty") + "</td>";
|
||||||
|
html += "<td class='tc'>" + Math.round(data.pktNum*100)/100 + "</td>";
|
||||||
|
html += "<td class='tc'>" + packper + " %</td>";
|
||||||
|
html += "<td class='tc'>" + Math.round(data.byteNum*100)/100 + "</td>";
|
||||||
|
html += "<td class='tc'>" + gbytper + " %</td>";
|
||||||
|
html += "</tr>"
|
||||||
|
if(index==fileDataS.length-1){
|
||||||
|
html+="<tr class='tr-total hidden'>"
|
||||||
|
html+= "<td class='tc'>"+"<spring:message code='report_total'/>"+"</td>";
|
||||||
|
html+= "<td class='tc'>"+totalunique+"</td>";
|
||||||
|
html+= "<td class='tc'>" +"100%"+"</td>";
|
||||||
|
html+= "<td class='tc'>"+totalpkt+"</td>";
|
||||||
|
html+= "<td class='tc'>"+"100%"+"</td>";
|
||||||
|
html+= "<td class='tc'>"+totalbyte+"</td>";
|
||||||
|
html+= "<td class='tc'>"+"100%"+"</td>";
|
||||||
|
html+="</tr>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$("#tableData").append(html);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// app曲线图
|
||||||
|
function appTransAjax(beginDate, endDate,appType,entranceId) {
|
||||||
|
loading();
|
||||||
|
|
||||||
|
$.ajax({ url : "${ctx}/dashboard/traffic/ajaxAppTrend?appType="+appType+"&beginDate="+beginDate+"&endDate="+endDate+"&entranceId="+entranceId,
|
||||||
|
type : "get",
|
||||||
|
dataType : "json",
|
||||||
|
async : true,
|
||||||
|
success : function(rs) {
|
||||||
|
var series=new Array();
|
||||||
|
var sipResult=new Array();
|
||||||
|
var dipResult=new Array();
|
||||||
|
var sipData=new Array();
|
||||||
|
var dipData=new Array();
|
||||||
|
var timeData=new Array();
|
||||||
|
var total=[];
|
||||||
|
if(rs!=null&&Object.keys(rs).length>0){
|
||||||
|
sipResult=rs.sipResult;
|
||||||
|
dipResult=rs.dipResult
|
||||||
|
total.push(rs.sipSum,rs.dipSum);
|
||||||
|
// 图表导出用列
|
||||||
|
$(sipResult).each(function(i,d){
|
||||||
|
sipData.push(d[1])
|
||||||
|
timeData.push(d[0])
|
||||||
|
})
|
||||||
|
$(dipResult).each(function(i,d){
|
||||||
|
dipData.push(d[1])
|
||||||
|
})
|
||||||
|
/* series.push({
|
||||||
|
name: "server",
|
||||||
|
data: sipResult,
|
||||||
|
// lineColor:'#a9d4cf',
|
||||||
|
lineWidth:2,
|
||||||
|
marker: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
name: "client",
|
||||||
|
data: dipResult,
|
||||||
|
// lineColor:'#eecf8d',
|
||||||
|
lineWidth:2,
|
||||||
|
marker: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
}); */
|
||||||
|
}else{
|
||||||
|
total.push(0,0);
|
||||||
|
/* series.push({
|
||||||
|
name: " ",
|
||||||
|
data: []
|
||||||
|
}); */
|
||||||
|
|
||||||
|
}
|
||||||
|
showActionTransChart(sipResult,dipResult);
|
||||||
|
$("#total").val(JSON.stringify(total));
|
||||||
|
$("#sipData").val(JSON.stringify(sipData));
|
||||||
|
$("#dipData").val(JSON.stringify(dipData));
|
||||||
|
$("#timeData").val(JSON.stringify(timeData));
|
||||||
|
closeTip();
|
||||||
|
},
|
||||||
|
error : function(data, textStatus, errorThrown) {
|
||||||
|
closeTip();
|
||||||
|
},
|
||||||
|
complete : function(XMLHttpRequest, status) {//超时设置
|
||||||
|
closeTip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取本页数据
|
||||||
|
* @param currentPage 当前页数 【初次查数据,默认第1页】
|
||||||
|
*/
|
||||||
|
var fileData;
|
||||||
|
function getPageData(currentPage, pageNumber) {
|
||||||
|
if (typeof (fileData) != "undefined" && fileData != null ) {
|
||||||
|
//计算每页数据起始和终止数据编号
|
||||||
|
// var pageNumber = 10;
|
||||||
|
var maxLength = currentPage * pageNumber - 1;
|
||||||
|
var minLength = currentPage * pageNumber - pageNumber;
|
||||||
|
var pageData = [];
|
||||||
|
for (var i = minLength; i < fileData.length; i++) {
|
||||||
|
if (maxLength < i) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
pageData.push(fileData[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
htmlData(pageData);
|
||||||
|
} else {
|
||||||
|
//把空数据传到页面中去
|
||||||
|
htmlData(fileData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 导出列表
|
||||||
|
$(".export-btn").click(function(){
|
||||||
|
var nowDate=new Date();
|
||||||
|
var dataType = $(this).attr("data-type");
|
||||||
|
getPageData(1,999999);// 设置导出页条数
|
||||||
|
var start=$("#beginDate").val();
|
||||||
|
var end=$("#endDate").val();
|
||||||
|
var htmlTitle="";
|
||||||
|
htmlTitle+="<tr class='tr-title'>";
|
||||||
|
htmlTitle+= "<th class='tc' colspan='1'>"+"<spring:message code='${appName}'/>"+"</th>";
|
||||||
|
htmlTitle+= "<th class='tc' colspan='2'>"+start+"--"+ end +"</th>";
|
||||||
|
htmlTitle+="</tr>"
|
||||||
|
$("#contentTable thead").prepend(htmlTitle);
|
||||||
|
if(dataType=="xlsx"){
|
||||||
|
getTableContent("contentTable");
|
||||||
|
}else{
|
||||||
|
var te = $("#contentTable").tableExport({
|
||||||
|
headings:true,
|
||||||
|
footers:true,
|
||||||
|
formats:[dataType],
|
||||||
|
fileName:"<spring:message code='${appName}'></spring:message>"+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='${appName}'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds();
|
||||||
|
var exports = JSON.stringify(map);
|
||||||
|
aJaxImportPost("${ctx}/export/ajaxExport",{"exports":exports});
|
||||||
|
}
|
||||||
|
$("#print-btn").click(function() {
|
||||||
|
window.print();
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 分页控件处理
|
||||||
|
*/
|
||||||
|
function pageJuan(showData) {
|
||||||
|
if (typeof (fileData) != "undefined" && fileData != null) {
|
||||||
|
var totalData = fileData.length;
|
||||||
|
// var showData = 10;
|
||||||
|
if (showData > totalData) {
|
||||||
|
showData = totalData;
|
||||||
|
}
|
||||||
|
var current=1;
|
||||||
|
$('.M-box').pagination({
|
||||||
|
totalData : totalData,
|
||||||
|
showData : showData,
|
||||||
|
coping : true,
|
||||||
|
callback : function(index) {
|
||||||
|
//改变显示开始和结束数据编号
|
||||||
|
getPageData(index.getCurrent(), showData);
|
||||||
|
current=index.getCurrent();
|
||||||
|
$(".pageCurrent").val(current);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(totalData<10){
|
||||||
|
$(".pageCurrent").val(1);
|
||||||
|
}
|
||||||
|
$(".pageTotal").text(totalData);
|
||||||
|
$(".pageNum").text(Math.ceil(totalData/10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function activeLastPointToolip(chart) {
|
||||||
|
var points = chart.series[0].points;
|
||||||
|
chart.tooltip.refresh(points[points.length -1]);
|
||||||
|
}
|
||||||
|
// 局点信息
|
||||||
|
function showActionTransChart(sipResult,dipResult) {
|
||||||
|
var nowDate=new Date();
|
||||||
|
Highcharts.setOptions({ global: { useUTC: false } });
|
||||||
|
var num=0;
|
||||||
|
var chart = Highcharts.chart('chart',
|
||||||
|
{
|
||||||
|
chart: {
|
||||||
|
// type: 'spline',
|
||||||
|
marginRight: 10,
|
||||||
|
// events: {
|
||||||
|
// events: {
|
||||||
|
// load: function() {}
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
noData:{
|
||||||
|
style: {//设置字体颜色
|
||||||
|
color: '#413333',
|
||||||
|
fontFamily:'Microsoft YaHei',
|
||||||
|
fontWeight:"unset",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exporting : {
|
||||||
|
filename : '<spring:message code="${appName}"></spring:message>'+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
|
||||||
|
'downloadPNG','downloadPDF',
|
||||||
|
Highcharts.getOptions().exporting.buttons.contextButton.menuItems[4],// excel
|
||||||
|
Highcharts.getOptions().exporting.buttons.contextButton.menuItems[3],// cvs
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
colors:['#a9d4cf','#eecf8d'],
|
||||||
|
title : {
|
||||||
|
text : null
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type:'datetime',
|
||||||
|
dateTimeLabelFormats: {
|
||||||
|
second: '%H:%M:%S',
|
||||||
|
minute: '%H:%M',
|
||||||
|
hour: '%H:%M',
|
||||||
|
day: '%m-%d',
|
||||||
|
week: '%m-%d',
|
||||||
|
month: '%Y-%m',
|
||||||
|
year: '%Y'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'time',
|
||||||
|
align:'high',
|
||||||
|
},
|
||||||
|
labels: {
|
||||||
|
// rotation: -45, //倾斜的角度
|
||||||
|
},
|
||||||
|
},
|
||||||
|
yAxis : {
|
||||||
|
title : {
|
||||||
|
text : null
|
||||||
|
},
|
||||||
|
min:0
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
dateTimeLabelFormats: {
|
||||||
|
millisecond: '%Y-%m-%d %H:%M:%S',
|
||||||
|
second: '%Y-%m-%d %H:%M:%S',
|
||||||
|
minute: '%Y-%m-%d %H:%M:%S',
|
||||||
|
hour: '%Y-%m-%d %H:%M:%S',
|
||||||
|
day: '%Y-%m-%d %H:%M:%S',
|
||||||
|
week: '%Y-%m-%d %H:%M:%S',
|
||||||
|
month: '%Y-%m-%d %H:%M:%S',
|
||||||
|
year: '%Y-%m-%d %H:%M:%S'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
credits : {//是否有highcharts水印
|
||||||
|
enabled : false
|
||||||
|
},
|
||||||
|
plotOptions : {
|
||||||
|
series : {
|
||||||
|
marker : {
|
||||||
|
radius : 2,
|
||||||
|
hover : {
|
||||||
|
enabled : true,
|
||||||
|
radius : 7,
|
||||||
|
radiusPlus : 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// legend: {
|
||||||
|
// layout: 'vertical',
|
||||||
|
// align: 'right',
|
||||||
|
// verticalAlign: 'middle'
|
||||||
|
// },
|
||||||
|
series: [{
|
||||||
|
name: 'server',
|
||||||
|
data: (function () {
|
||||||
|
var data = [];
|
||||||
|
if(sipResult!=null&&sipResult.length>0){
|
||||||
|
var count=10;
|
||||||
|
if(sipResult.length<10){
|
||||||
|
count=sipResult.length;
|
||||||
|
}
|
||||||
|
for (var i = 0; i <= count; i++) {
|
||||||
|
var d =sipResult[i];
|
||||||
|
var x = d[0], // 时间
|
||||||
|
y = d[1];
|
||||||
|
data.push({
|
||||||
|
x: x,
|
||||||
|
y: y
|
||||||
|
});
|
||||||
|
}
|
||||||
|
num=count;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}())
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'client',
|
||||||
|
data: (function () {
|
||||||
|
var data = [];
|
||||||
|
if(dipResult!=null&&dipResult.length>0){
|
||||||
|
var count=10;
|
||||||
|
if(dipResult.length<10){
|
||||||
|
count=dipResult.length;
|
||||||
|
}
|
||||||
|
for (var i = 0; i <= count; i++) {
|
||||||
|
var d =dipResult[i];
|
||||||
|
var x = d[0], // 当前时间
|
||||||
|
y = d[1];
|
||||||
|
data.push({
|
||||||
|
x: x,
|
||||||
|
y: y
|
||||||
|
});
|
||||||
|
}
|
||||||
|
num=count;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}())
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
var timer=null;
|
||||||
|
var series=[];
|
||||||
|
var series1=[];
|
||||||
|
series = chart.series[0];
|
||||||
|
series1 = chart.series[1];
|
||||||
|
window.clearInterval(timer);
|
||||||
|
if(sipResult!=null&&sipResult.length>0){
|
||||||
|
}else{
|
||||||
|
num=0;
|
||||||
|
window.clearInterval(timer);
|
||||||
|
}
|
||||||
|
var temp =num;
|
||||||
|
timer=setInterval(function() {
|
||||||
|
var d =sipResult[num];
|
||||||
|
if(typeof d!='undefined'&&d!=null){
|
||||||
|
series.addPoint([d[0], d[1]], true, true);
|
||||||
|
}else{
|
||||||
|
num=0;
|
||||||
|
window.clearInterval(timer);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var t =dipResult[num];
|
||||||
|
if(typeof t!='undefined'&&t!=null){
|
||||||
|
series1.addPoint([t[0], t[1]], true, true);
|
||||||
|
}else{
|
||||||
|
num=0;
|
||||||
|
clearInterval(timer);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
num=num+1
|
||||||
|
if(num==sipResult.length){
|
||||||
|
num=0;
|
||||||
|
clearInterval(timer);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
(function(H) {
|
||||||
|
H.Chart.prototype.downloadXLS = function() {
|
||||||
|
var nowDate=new Date();
|
||||||
|
var start=$("#beginDateh").val();
|
||||||
|
var end=$("#endDateh").val();
|
||||||
|
var rows = [];
|
||||||
|
var heard = [];
|
||||||
|
/* 调用后台接口导出 */
|
||||||
|
var total = JSON.parse($("#total").val());
|
||||||
|
var timeData = JSON.parse($("#timeData").val());
|
||||||
|
var sipData = JSON.parse($("#sipData").val());
|
||||||
|
var dipData = JSON.parse($("#dipData").val());
|
||||||
|
var map={};
|
||||||
|
heard.push("time","server","client");
|
||||||
|
for(var i=0;i<sipData.length;i++){
|
||||||
|
var colData=[];
|
||||||
|
var time=new Date(timeData[i]); //
|
||||||
|
var ftime=dateFtt("yyyy-MM-dd hh:mm:ss",time);
|
||||||
|
colData.push(ftime,sipData[i],dipData[i])
|
||||||
|
rows.push(colData)
|
||||||
|
}
|
||||||
|
total.unshift('<spring:message code="report_total"/>');
|
||||||
|
rows.push(total)
|
||||||
|
map["titleTime"]='<spring:message code="${appName}"></spring:message>'+","+start+"--"+end;
|
||||||
|
map["heard"]=heard;
|
||||||
|
map["book"]=rows;
|
||||||
|
map["titleCode"]='<spring:message code="${appName}"></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});
|
||||||
|
};
|
||||||
|
}(Highcharts));
|
||||||
|
|
||||||
|
(function(H) {
|
||||||
|
H.Chart.prototype.downloadCSV = function() {
|
||||||
|
var total = JSON.parse($("#total").val());
|
||||||
|
var timeData = JSON.parse($("#timeData").val());
|
||||||
|
var sipData = JSON.parse($("#sipData").val());
|
||||||
|
var dipData = JSON.parse($("#dipData").val());
|
||||||
|
var data=[];
|
||||||
|
for(var i=0;i<sipData.length;i++){
|
||||||
|
var colData=[];
|
||||||
|
var time=new Date(timeData[i]); //
|
||||||
|
var ftime=dateFtt("yyyy-MM-dd hh:mm:ss",time);
|
||||||
|
colData.push(ftime,sipData[i],dipData[i])
|
||||||
|
data.push({
|
||||||
|
num1:ftime,
|
||||||
|
num2:sipData[i],
|
||||||
|
num3:dipData[i],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
data.push({
|
||||||
|
num1:"<spring:message code='report_total'/>",
|
||||||
|
num2:total
|
||||||
|
})
|
||||||
|
var start = $("#beginDateh").val();
|
||||||
|
var end = $("#endDateh").val();
|
||||||
|
exportCsv({
|
||||||
|
title:["<spring:message code='${appName}'/>",start+"--"+end],
|
||||||
|
titleForKey:["num1","num2","num3"],
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
|
var downloadLink = document.createElement("a");
|
||||||
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
|
downloadLink.download = "<spring:message code='${appName}'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
|
document.body.appendChild(downloadLink);
|
||||||
|
downloadLink.click();
|
||||||
|
document.body.removeChild(downloadLink);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -100,6 +100,7 @@
|
|||||||
<table id="contentTable" class="table table-active table-striped table-bordered table-condensed text-nowrap">
|
<table id="contentTable" class="table table-active table-striped table-bordered table-condensed text-nowrap">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th class="tl"><spring:message code="trend"/></th>
|
||||||
<th class="tl"><spring:message code="App"/></th>
|
<th class="tl"><spring:message code="App"/></th>
|
||||||
<th class="tl"><spring:message code="link_num"/></th>
|
<th class="tl"><spring:message code="link_num"/></th>
|
||||||
<th class="tl"><spring:message code="percentage"/> (<spring:message code="link_num"/>)</th>
|
<th class="tl"><spring:message code="percentage"/> (<spring:message code="link_num"/>)</th>
|
||||||
@@ -210,8 +211,8 @@ $(".export-btn").click(function(){
|
|||||||
var nowDate=new Date();
|
var nowDate=new Date();
|
||||||
var dataType = $(this).attr("data-type");
|
var dataType = $(this).attr("data-type");
|
||||||
getPageData(1,999999);// 设置导出页条数
|
getPageData(1,999999);// 设置导出页条数
|
||||||
var start=$("#beginDate").val();
|
var start=$("#beginDateh").val();
|
||||||
var end=$("#endDate").val();
|
var end=$("#endDateh").val();
|
||||||
var htmlTitle="";
|
var htmlTitle="";
|
||||||
htmlTitle+="<tr class='tr-title'>";
|
htmlTitle+="<tr class='tr-title'>";
|
||||||
htmlTitle+= "<th class='tc' colspan='1'>"+"<spring:message code='App'/>"+"</th>";
|
htmlTitle+= "<th class='tc' colspan='1'>"+"<spring:message code='App'/>"+"</th>";
|
||||||
@@ -316,6 +317,7 @@ function htmlData(fileDataS){
|
|||||||
gbytper=((data.GByte/totalGByte)*100).toFixed(2);
|
gbytper=((data.GByte/totalGByte)*100).toFixed(2);
|
||||||
}
|
}
|
||||||
var html = "<tr>";
|
var html = "<tr>";
|
||||||
|
html+= "<td class='tc'><a href='#' onclick='openAppTrend(\""+data.appType+"\",\""+data.appName+"\")'><i class='fa fa-line-chart'></i></a></td>";
|
||||||
html+= "<td class='tc'>"+data.appName+"</td>";
|
html+= "<td class='tc'>"+data.appName+"</td>";
|
||||||
html+= "<td class='tc'>"+data.linkNum+"</td>";
|
html+= "<td class='tc'>"+data.linkNum+"</td>";
|
||||||
html+= "<td class='tc'>"+linkper+"%"+"</td>";
|
html+= "<td class='tc'>"+linkper+"%"+"</td>";
|
||||||
@@ -340,7 +342,13 @@ function htmlData(fileDataS){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 跳转到app访问趋势
|
||||||
|
function openAppTrend(appType,appName){
|
||||||
|
var beginDate=$("#beginDateh").val();
|
||||||
|
var endDate=$("#endDateh").val();
|
||||||
|
var url= "${ctx}/dashboard/traffic/appTrendList?beginDate="+beginDate+"&endDate="+endDate+"&appName="+appName+"&appType="+appType;
|
||||||
|
window.location.href=(url)
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 分页控件处理
|
* 分页控件处理
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -536,10 +536,14 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){
|
|||||||
}
|
}
|
||||||
str.push(temp.join(",")+"\n");
|
str.push(temp.join(",")+"\n");
|
||||||
}
|
}
|
||||||
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
|
||||||
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
var downloadLink = document.createElement("a");
|
var downloadLink = document.createElement("a");
|
||||||
downloadLink.href = uri;
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
downloadLink.download = '<spring:message code="traffic"></spring:message>'+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
downloadLink.download = "<spring:message code='traffic'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
|
|||||||
@@ -303,10 +303,13 @@ function exportCsv(obj){
|
|||||||
}
|
}
|
||||||
str.push(temp.join(",")+"\n");
|
str.push(temp.join(",")+"\n");
|
||||||
}
|
}
|
||||||
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
var downloadLink = document.createElement("a");
|
var downloadLink = document.createElement("a");
|
||||||
downloadLink.href = uri;
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
downloadLink.download = "<spring:message code='domain_name'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
downloadLink.download = "<spring:message code='domain_name'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
|
|||||||
@@ -550,10 +550,14 @@ function showIpActiveChart(xData,series){
|
|||||||
}
|
}
|
||||||
str.push(temp.join(",")+"\n");
|
str.push(temp.join(",")+"\n");
|
||||||
}
|
}
|
||||||
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
|
||||||
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
var downloadLink = document.createElement("a");
|
var downloadLink = document.createElement("a");
|
||||||
downloadLink.href = uri;
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
downloadLink.download = "<spring:message code='traffic_ipactive_hour_trend'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
downloadLink.download = "<spring:message code='traffic_ipactive_hour_trend'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
|
|||||||
@@ -375,10 +375,14 @@ function showPortActiveChart(xData,series){
|
|||||||
}
|
}
|
||||||
str.push(temp.join(",")+"\n");
|
str.push(temp.join(",")+"\n");
|
||||||
}
|
}
|
||||||
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str.join(""));
|
|
||||||
|
str = "\uFEFF"+str.join(""); //
|
||||||
|
var blob = new Blob([str], {type: 'text/plain'});
|
||||||
|
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(blob);
|
||||||
var downloadLink = document.createElement("a");
|
var downloadLink = document.createElement("a");
|
||||||
downloadLink.href = uri;
|
downloadLink.href = window.URL.createObjectURL(blob);
|
||||||
downloadLink.download = "<spring:message code='active_port'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
downloadLink.download = "<spring:message code='active_port'/>"+nowDate.getFullYear()+(nowDate.getMonth()+1)+nowDate.getDate()+nowDate.getHours()+nowDate.getMinutes()+nowDate.getSeconds()+".csv";
|
||||||
|
downloadLink.style.display = 'none';
|
||||||
document.body.appendChild(downloadLink);
|
document.body.appendChild(downloadLink);
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
document.body.removeChild(downloadLink);
|
document.body.removeChild(downloadLink);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="contentTable" style="width: 100%;"
|
<table id="contentTable" style="width: 100%;"
|
||||||
class="table table-hover table-striped table-bordered table-condensed text-nowrap">
|
class="table table-striped table-bordered table-condensed text-nowrap">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><spring:message code="domain_name"/></th>
|
<th><spring:message code="domain_name"/></th>
|
||||||
@@ -369,7 +369,8 @@
|
|||||||
if(totalGbyte!=null&&totalGbyte!=0 ){
|
if(totalGbyte!=null&&totalGbyte!=0 ){
|
||||||
gbytper=((data.Gbyte/(totalGbyte))*100).toFixed(2);
|
gbytper=((data.Gbyte/(totalGbyte))*100).toFixed(2);
|
||||||
}
|
}
|
||||||
var html = '<tr onclick="searchByDomain(\''+data.webId+'\',\''+data.website+'\')">';
|
var html = '<tr>';
|
||||||
|
html += '<td class="tc"><a onclick="searchByDomain(\''+data.webId+'\',\''+data.website+'\')"><i class='fa fa-line-chart'></i></a></td>';
|
||||||
html += "<td class='tc'>" + data.website + "</td>";
|
html += "<td class='tc'>" + data.website + "</td>";
|
||||||
html += "<td class='tc'>" + data.uniqueNum + "</td>";
|
html += "<td class='tc'>" + data.uniqueNum + "</td>";
|
||||||
html += "<td class='tc'>" + (((data.entranceId)==1) ? "Astana":"Alamty") + "</td>";
|
html += "<td class='tc'>" + (((data.entranceId)==1) ? "Astana":"Alamty") + "</td>";
|
||||||
|
|||||||
Reference in New Issue
Block a user