页面JS调用,待接口可用之后调整返回数据

This commit is contained in:
wangxin
2018-06-14 10:16:19 +08:00
parent d9a7693ae5
commit 7334247f5b
3 changed files with 27 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nis.domain.FunctionServiceDict;
@@ -35,10 +36,10 @@ import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/logs")
public class NtcPzReportController extends BaseController{
@RequestMapping(value="ajaxGetLogTotal")
@RequestMapping(value="ajaxGetLogTotal",method=RequestMethod.POST)
@ResponseBody
public String ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,String compileIds){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mi:ss");
public String ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,Integer compileId){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int interval=Constants.LOG_TIME_RANGE;
Date endDate=new Date(endTime);
Date startDate=new Date(endTime-interval);
@@ -50,7 +51,7 @@ public class NtcPzReportController extends BaseController{
break;
}
}
ReportResultLog result=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, compileIds, String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
ReportResultLog result=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, String.valueOf(compileId), String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
if(result.getData()!=null&&result.getData().getList()!=null){
model.addAttribute("data", result.getData().getList());
}

View File

@@ -5,6 +5,14 @@
<title><spring:message code="${cfgName}"></spring:message></title>
<script>
$(document).ready(function() {
$("td[compileId]").each(function(){
var data={};
data.date=new Date();
data.compileId=$(this).attr("compileId");
data.action=$(this).attr("action");
data.functionId=$(this).attr("functionId");
GetLogTotal('${ctx}',data);
});
//$("#loadingModal").modal("show");
//setTimeout(function(){
// $("#loadingModal").modal("hide");
@@ -311,7 +319,7 @@
<c:if test="${cfg.isAudit eq auditC.itemCode and auditC.itemValue eq 'cancel'}"><span class="label label-warning"><spring:message code="cancel_approved"></spring:message></span></c:if>
</c:forEach>
</td>
<td compileId="${cfg.compileId}" ><div class="loading-total"></div></td>
<td functionId="${cfg.functionId}" compileId="${cfg.compileId}" action="${cfg.action}"><div class="loading-total"></div></td>
<td>${cfg.creatorName }</td>
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>${cfg.editorName }</td>

View File

@@ -618,18 +618,24 @@ var viewAreaInfo=function(path,areaEffectiveIds,compileId){
});
}
var GetLogTotal=function(){
var GetLogTotal=function(path,data){
console.log(data);
var timeStamp=0;
if(data.date){
timeStamp=data.date.valueOf();
}else{
timeStamp=(new Date()).valueOf();
}
$.ajax({
type:'post',
timeout:1000,//超时时间设置,查询接口时间过长超时
timeout:10000,//超时时间设置,查询接口时间过长超时
url:path+'/logs/ajaxGetLogTotal',
data:function(){//处理数据
return {"functionId":functionId,"compileIds":compileIds};
},
data:{"endTime":timeStamp,"action":data.action,"functionId":data.functionId,"compileId":data.compileId},
dataType:'json',
async:false,
async:true,
success:function(data,textStatus){//处理返回结果
if(textStatus=="success"){
}
},
complete:function(XMLHttpRequest,status){//超时设置
if(status=="timeout"){