2018-09-30 10:54:30 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 处理配置日志总量以及跳转日志界面
|
|
|
|
|
|
*/
|
|
|
|
|
|
$(function(){
|
|
|
|
|
|
//获取配置日志总数
|
|
|
|
|
|
getTotalLog();
|
|
|
|
|
|
});
|
2018-12-25 15:44:24 +08:00
|
|
|
|
|
2019-01-03 20:27:40 +08:00
|
|
|
|
/*function setTime(){
|
2018-12-25 15:44:24 +08:00
|
|
|
|
var chooseDate=new Date($('#beginDate').val());
|
|
|
|
|
|
chooseDate=chooseDate.setDate(chooseDate.getDate()+7);
|
|
|
|
|
|
var modifyTime=new Date(chooseDate);
|
2018-12-25 16:22:33 +08:00
|
|
|
|
$('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds()));
|
2019-01-03 20:27:40 +08:00
|
|
|
|
}*/
|
|
|
|
|
|
function setTime(dayData){
|
|
|
|
|
|
var useTime=$('#beginDate').val();
|
|
|
|
|
|
if(useTime==''){
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var chooseDate=new Date(useTime);
|
|
|
|
|
|
chooseDate=chooseDate.setDate(chooseDate.getDate()+dayData);
|
|
|
|
|
|
var now =new Date();
|
|
|
|
|
|
if(now.getTime()<new Date(chooseDate).getTime()){
|
|
|
|
|
|
chooseDate=now;
|
|
|
|
|
|
}
|
|
|
|
|
|
var modifyTime=new Date(chooseDate);
|
|
|
|
|
|
$('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds()));
|
2018-12-26 15:32:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
function setTimee(){
|
|
|
|
|
|
var chooseDate=new Date($('#searchFoundStartTime').val());
|
|
|
|
|
|
chooseDate=chooseDate.setDate(chooseDate.getDate()+1);
|
|
|
|
|
|
var modifyTime=new Date(chooseDate);
|
|
|
|
|
|
$('#searchFoundEndTime').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds()));
|
2018-12-25 15:44:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-03 20:27:40 +08:00
|
|
|
|
function currentTime() {
|
|
|
|
|
|
var now = new Date();
|
|
|
|
|
|
|
|
|
|
|
|
var year = now.getFullYear();
|
|
|
|
|
|
var month = now.getMonth() + 1;
|
|
|
|
|
|
var day = now.getDate();
|
|
|
|
|
|
|
|
|
|
|
|
var hh = now.getHours();
|
|
|
|
|
|
var mm = now.getMinutes();
|
|
|
|
|
|
|
|
|
|
|
|
var clock = year + "-";
|
|
|
|
|
|
|
|
|
|
|
|
if (month < 10) clock += "0";
|
|
|
|
|
|
clock += month + "-";
|
|
|
|
|
|
|
|
|
|
|
|
if (day < 10) clock += "0";
|
|
|
|
|
|
clock += day + " ";
|
|
|
|
|
|
|
|
|
|
|
|
if (hh < 10) clock += "0";
|
|
|
|
|
|
clock += hh + ":";
|
|
|
|
|
|
|
|
|
|
|
|
if (mm < 10) clock += '0';
|
|
|
|
|
|
clock += mm;
|
|
|
|
|
|
return (clock);
|
|
|
|
|
|
}
|
|
|
|
|
|
function getMaxDate(day){
|
|
|
|
|
|
var clock=currentTime();
|
|
|
|
|
|
var dt;
|
|
|
|
|
|
var times=0;
|
|
|
|
|
|
dt=$("#beginDate").val();
|
|
|
|
|
|
if(dt!=''){
|
|
|
|
|
|
times =Date.parse(dt.replace(/-/g,'/'))+day*24*60*60*1000;//时间间隔为10天
|
|
|
|
|
|
|
|
|
|
|
|
if(times-Date.parse(clock.replace(/-/g,'/'))<0){
|
|
|
|
|
|
var d1 = new Date(times);
|
|
|
|
|
|
var year = d1.getFullYear();
|
|
|
|
|
|
var month = d1.getMonth() + 1; //月份以0开头
|
|
|
|
|
|
var day = d1.getDate();
|
|
|
|
|
|
|
|
|
|
|
|
var hh = d1.getHours();
|
|
|
|
|
|
var mm = d1.getMinutes();
|
|
|
|
|
|
|
|
|
|
|
|
var clock = year + "-";
|
|
|
|
|
|
|
|
|
|
|
|
if (month < 10) clock += "0";
|
|
|
|
|
|
clock += month + "-";
|
|
|
|
|
|
|
|
|
|
|
|
if (day < 10) clock += "0";
|
|
|
|
|
|
clock += day + " ";
|
|
|
|
|
|
|
|
|
|
|
|
if (hh < 10) clock += "0";
|
|
|
|
|
|
clock += hh + ":";
|
|
|
|
|
|
|
|
|
|
|
|
if (mm < 10) clock += '0';
|
|
|
|
|
|
clock += mm;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return clock;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-30 10:54:30 +08:00
|
|
|
|
var getTotalLog=function(){
|
|
|
|
|
|
/*
|
|
|
|
|
|
td需要配置属性有,audit,functionId,compileId,action
|
|
|
|
|
|
*/
|
|
|
|
|
|
var data={};
|
|
|
|
|
|
//data.date=new Date();
|
|
|
|
|
|
data.compileIds=[];
|
|
|
|
|
|
data.serviceIds=[];
|
|
|
|
|
|
data.objs=[];
|
|
|
|
|
|
$("td[compileId]").each(function(){
|
|
|
|
|
|
var audit=$(this).attr("audit");
|
|
|
|
|
|
var compileId=$(this).attr("compileId");
|
|
|
|
|
|
var serviceId=$(this).attr("serviceId");
|
|
|
|
|
|
var functionId=$(this).attr("functionId");
|
|
|
|
|
|
if(audit&&compileId&&functionId&&serviceId){
|
2018-12-22 16:07:00 +06:00
|
|
|
|
if(audit != 0){
|
2018-09-30 10:54:30 +08:00
|
|
|
|
var has=false;
|
|
|
|
|
|
for(var i=0;i<data.serviceIds.length;i++){
|
|
|
|
|
|
if(data.serviceIds[i]==$(this).attr("serviceId")){
|
|
|
|
|
|
has=true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!has){
|
|
|
|
|
|
data.serviceIds.push($(this).attr("serviceId"));
|
|
|
|
|
|
}
|
|
|
|
|
|
//$(this).attr("date",data.date.getTime());
|
|
|
|
|
|
data.compileIds.push($(this).attr("compileId"));
|
|
|
|
|
|
data.functionId=$(this).attr("functionId");
|
|
|
|
|
|
data.objs.push($(this));
|
|
|
|
|
|
}else{
|
|
|
|
|
|
$(this).html("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
$(this).html("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
if(data.compileIds.length>0){
|
|
|
|
|
|
GetLogTotal(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
var GetLogTotal=function(_data){
|
|
|
|
|
|
var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4);
|
|
|
|
|
|
var timeStamp;
|
|
|
|
|
|
if(_data.date){
|
|
|
|
|
|
timeStamp=_data.date.valueOf();
|
|
|
|
|
|
}/*else{
|
|
|
|
|
|
timeStamp=(new Date()).valueOf();
|
|
|
|
|
|
}*/
|
|
|
|
|
|
var totalTrs=$(_data.objs);
|
|
|
|
|
|
var timeout=$.validator.messages.timeout;
|
|
|
|
|
|
var failed=$.validator.messages.failed;
|
|
|
|
|
|
var request=$.ajax({
|
|
|
|
|
|
type:'post',
|
|
|
|
|
|
timeout:10000,//超时时间设置,查询接口时间过长超时
|
|
|
|
|
|
url:pathName+'/report/ajaxGetLogTotal',
|
|
|
|
|
|
data:{"endTime":timeStamp,"serviceIds":_data.serviceIds.join(','),"functionId":_data.functionId,"compileIds":_data.compileIds.join(',')},
|
|
|
|
|
|
dataType:'json',
|
|
|
|
|
|
async:true,
|
|
|
|
|
|
success:function(data,textStatus){//处理返回结果
|
|
|
|
|
|
if(textStatus=="success"){
|
|
|
|
|
|
totalTrs.each(function(){
|
|
|
|
|
|
var hasLog=false;
|
|
|
|
|
|
for(var i=0;i<data.length;i++){
|
|
|
|
|
|
if($(this).attr("compileId")==data[i].compileId){
|
|
|
|
|
|
$(this).attr("id",i+"logTotal");
|
2018-12-05 15:32:50 +08:00
|
|
|
|
$(this).html(data[i].sum);
|
|
|
|
|
|
$(this).parent("tr").find("td:eq(1)").html("<a href='javascript:;' onclick='toLogSearch("+i+")'>"+data[i].compileId+"<a>");
|
2018-09-30 10:54:30 +08:00
|
|
|
|
hasLog=true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!hasLog){
|
|
|
|
|
|
$(this).html("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
complete:function(XMLHttpRequest,status){//超时设置
|
|
|
|
|
|
if(status=="timeout"){
|
|
|
|
|
|
totalTrs.each(function(){
|
|
|
|
|
|
$(this).html(timeout);
|
|
|
|
|
|
})
|
|
|
|
|
|
}else if(status !="success"){
|
|
|
|
|
|
totalTrs.each(function(){
|
|
|
|
|
|
$(this).html(failed);
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var toLogSearch = function(index){
|
|
|
|
|
|
// 保存配置界面URL
|
|
|
|
|
|
$("#searchForm").each(function(){
|
|
|
|
|
|
var cfgUrl = $(this).attr("action");
|
2018-12-14 14:17:09 +08:00
|
|
|
|
sessionStorage.removeItem('cfg_url');
|
|
|
|
|
|
sessionStorage.setItem('cfg_url',cfgUrl);
|
2018-09-30 10:54:30 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var td = document.getElementById(index+"logTotal");
|
|
|
|
|
|
$("td[compileId]").each(function(){
|
|
|
|
|
|
if($(this).attr("id") == index+"logTotal"){
|
|
|
|
|
|
// 获取检索日志参数
|
|
|
|
|
|
var serviceId=$(this).attr("serviceId");
|
|
|
|
|
|
var compileId=$(this).attr("compileId");
|
|
|
|
|
|
var functionId=$(this).attr("functionId");
|
|
|
|
|
|
var date=$(this).attr("date");
|
|
|
|
|
|
var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4);
|
|
|
|
|
|
|
2018-12-09 17:12:40 +08:00
|
|
|
|
switchMenu("152",functionId);
|
2018-09-30 10:54:30 +08:00
|
|
|
|
window.location.href = pathName+"/toLogSearch?service="+serviceId+"&functionId="+functionId+"&cfgId="+compileId+"&date="+date+"&isLogTotalSearch=yes";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2018-11-29 11:26:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-12-14 14:17:09 +08:00
|
|
|
|
var switchMenu = function(topMenuId,functionId,oldMenuName){
|
2018-11-29 11:26:53 +08:00
|
|
|
|
// 顶部菜单切换 menuId: Policies/86 Logs/152
|
|
|
|
|
|
$(".hor-menu ul li",parent.document).each(function(){
|
|
|
|
|
|
var id = $(this).children("a").attr("id");
|
|
|
|
|
|
if(id == topMenuId){
|
|
|
|
|
|
$(this).addClass("active");
|
|
|
|
|
|
}else{
|
|
|
|
|
|
$(this).removeClass("active");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 保留左侧菜单特征
|
|
|
|
|
|
var menusObj = $(".page-sidebar ul[class!='hide'] .active",parent.document);
|
|
|
|
|
|
var firstMenuName = menusObj.attr("menu-name");
|
|
|
|
|
|
var lastMenuName = $(menusObj,parent.document).last("li[class='nav-item active']").attr("menu-name");
|
|
|
|
|
|
|
|
|
|
|
|
var middleMenu = new Array();
|
|
|
|
|
|
$(menusObj,parent.document).find("li").each(function(){
|
|
|
|
|
|
if($(this).hasClass("active")){
|
|
|
|
|
|
middleMenu.push($(this).attr("menu-name"));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2018-12-14 14:17:09 +08:00
|
|
|
|
|
|
|
|
|
|
if(topMenuId == 152){
|
|
|
|
|
|
if(functionId == 8 || functionId == 35){// HTTP or Mail
|
|
|
|
|
|
lastMenuName = middleMenu[0];
|
|
|
|
|
|
}
|
|
|
|
|
|
sessionStorage.removeItem('old_memu_name');
|
|
|
|
|
|
sessionStorage.setItem('old_memu_name',middleMenu[middleMenu.length-1]);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
lastMenuName = oldMenuName;
|
2018-12-09 17:12:40 +08:00
|
|
|
|
}
|
2018-11-29 11:26:53 +08:00
|
|
|
|
|
|
|
|
|
|
// 左侧菜单切换
|
|
|
|
|
|
$(".page-sidebar",parent.document).find("ul[id]").each(function(){
|
|
|
|
|
|
var id = $(this).attr("id")
|
|
|
|
|
|
if(id.indexOf(topMenuId) != -1){
|
|
|
|
|
|
$(this).removeClass("hide");
|
2018-12-14 14:17:09 +08:00
|
|
|
|
// 收回原展开的菜单
|
2018-11-29 11:26:53 +08:00
|
|
|
|
$(this).find("li").each(function(index){
|
|
|
|
|
|
$(this).children("a").children("span").next().removeClass("open");
|
|
|
|
|
|
$(this).children("ul").hide();
|
|
|
|
|
|
});
|
2018-12-14 14:17:09 +08:00
|
|
|
|
var count = 0;
|
2018-11-29 11:26:53 +08:00
|
|
|
|
// 选中左侧菜单
|
2018-12-14 14:17:09 +08:00
|
|
|
|
$(this).find("li").each(function(index){
|
|
|
|
|
|
if($(this).attr("menu-name") == lastMenuName){
|
|
|
|
|
|
count++;
|
|
|
|
|
|
$(this).children("a").trigger("click");// 选中底层菜单
|
|
|
|
|
|
$(this).parents("li").each(function(){
|
|
|
|
|
|
$(this).addClass("active open");
|
|
|
|
|
|
$(this).children("a").children("span").next().addClass("open");
|
|
|
|
|
|
$(this).children("ul").show();
|
2018-11-29 11:26:53 +08:00
|
|
|
|
});
|
2018-12-14 14:17:09 +08:00
|
|
|
|
if(topMenuId == 86){
|
|
|
|
|
|
if(functionId == 35 && count == 1){// HTTP/Mail(Advanced)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2018-11-29 11:26:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2018-12-14 14:17:09 +08:00
|
|
|
|
|
2018-11-29 11:26:53 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
$(this).addClass("hide");
|
2018-12-14 14:17:09 +08:00
|
|
|
|
|
2018-11-29 11:26:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//loading('onloading');
|
|
|
|
|
|
}
|