调整日志配置总量查询,整页配置只查询一次,减小资源浪费
This commit is contained in:
@@ -336,28 +336,8 @@ $(function(){
|
||||
$("input[name$='exprType']:checked").each(function(){
|
||||
setDefaultMatchMethod(this);
|
||||
});
|
||||
/*
|
||||
*配置展示日志总数,审核通过才会调用接口查询日志总量
|
||||
必须放在是否审核一列之后
|
||||
并且是否审核一列的span标签需配置data-audit="xxxx"属性
|
||||
xxxx可用值为created,approved,unapproved,cancel
|
||||
td需要配置属性有,functionId,compileId,action
|
||||
*/
|
||||
$("td[compileId]").each(function(){
|
||||
var audit=$(this).attr("audit");
|
||||
if(audit == 1){
|
||||
var data={};
|
||||
data.date=new Date();
|
||||
data.compileId=$(this).attr("compileId");
|
||||
data.action=$(this).attr("action");
|
||||
data.functionId=$(this).attr("functionId");
|
||||
data.audit=$(this).attr("audit");
|
||||
data.obj=$(this)
|
||||
GetLogTotal(data);
|
||||
}else{
|
||||
$(this).html("0");
|
||||
}
|
||||
});
|
||||
//获取配置日志总数
|
||||
getTotalLog();
|
||||
$(".action").on("change", function() {
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
@@ -1116,32 +1096,77 @@ var viewAreaInfo=function(path,areaEffectiveIds,compileId){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
var GetLogTotal=function(data){
|
||||
var getTotalLog=function(){
|
||||
/*
|
||||
td需要配置属性有,audit,functionId,compileId,action
|
||||
*/
|
||||
var data={};
|
||||
data.date=new Date();
|
||||
data.compileIds=[];
|
||||
data.actions=[];
|
||||
data.objs=[];
|
||||
$("td[compileId]").each(function(){
|
||||
var audit=$(this).attr("audit");
|
||||
var compileId=$(this).attr("compileId");
|
||||
var action=$(this).attr("action");
|
||||
var functionId=$(this).attr("functionId");
|
||||
if(audit&&compileId&&action&&functionId){
|
||||
if(audit == 1){
|
||||
var has=false;
|
||||
for(var i=0;i<data.actions.length;i++){
|
||||
if(data.actions[i]==$(this).attr("action")){
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
data.actions.push($(this).attr("action"));
|
||||
}
|
||||
data.compileIds.push($(this).attr("compileId"));
|
||||
data.functionId=$(this).attr("functionId");
|
||||
data.objs.push($(this));
|
||||
}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=0;
|
||||
if(data.date){
|
||||
timeStamp=data.date.valueOf();
|
||||
if(_data.date){
|
||||
timeStamp=_data.date.valueOf();
|
||||
}else{
|
||||
timeStamp=(new Date()).valueOf();
|
||||
}
|
||||
var totalTr=$(data.obj);
|
||||
var totalTrs=$(_data.objs);
|
||||
var timeout=$.validator.messages.timeout;
|
||||
var request=$.ajax({
|
||||
type:'post',
|
||||
timeout:10000,//超时时间设置,查询接口时间过长超时
|
||||
url:pathName+'/report/ajaxGetLogTotal',
|
||||
data:{"endTime":timeStamp,"action":data.action,"functionId":data.functionId,"compileId":data.compileId},
|
||||
data:{"endTime":timeStamp,"actions":_data.actions.join(','),"functionId":_data.functionId,"compileIds":_data.compileIds.join(',')},
|
||||
dataType:'json',
|
||||
async:true,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(textStatus=="success"){
|
||||
totalTr.html(data.sum);
|
||||
totalTrs.each(function(){
|
||||
for(var i=0;i<data.length;i++){
|
||||
if($(this).attr("compileId")==data[i].compileId){
|
||||
$(this).html(data[i].sum);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
complete:function(XMLHttpRequest,status){//超时设置
|
||||
if(status=="timeout"){
|
||||
totalTr.html(timeout);
|
||||
totalTrs.each(function(){
|
||||
$(this).html(timeout);
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user