Authored by qinchao

任务api一键开启

... ... @@ -59,6 +59,7 @@ public class HttpUriContants {
public static final String JAVA_API_GET = "/javaApi/query";
public static final String JAVA_API_DEL = "/javaApi/del";
public static final String JAVA_API_SAVE = "/javaApi/save";
public static final String JAVA_API_TASKENABLEORDISABLE = "/javaApi/taskEnableOrDisable";
public static final String JAVA_API_STATUS = "/javaApiStatus/query";
public static final String JAVA_API_HIS = "/javaApiStatus/queryhis";
public static final String JAVA_API_STATUS_ALL = "/javaApiStatus/queryAll";
... ...
... ... @@ -10,6 +10,9 @@ public class JavaApiInfoReq extends PageRequest {
private Integer serviceId;
//多个id组成的参数
private String serviceIds;
private Integer serviceType;
private String apiName;
... ...
... ... @@ -79,6 +79,12 @@ public class JavaAPICtrl {
return rep;
}
@RequestMapping("/taskEnableOrDisable")
@ResponseBody
public BaseResponse taskEnableOrDisable(JavaApiInfoReq req) {
BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_TASKENABLEORDISABLE, req, BaseResponse.class);
return rep;
}
@RequestMapping("/del")
@ResponseBody
... ...
... ... @@ -115,6 +115,14 @@
<button id="addInfoBtn" class="btn btn-info" style="margin-top: 12px;margin-left: 100px;">
新增
</button>
<button id="taskEnableOrDisable_open" class="btn btn-warning" style="margin-top: 12px;margin-left: 5px;">
开启任务
</button>
<button id="taskEnableOrDisable_close" class="btn btn-warning" style="margin-top: 12px;margin-left: 5px;">
关闭任务
</button>
</div>
</div>
<div id="infoTable">
... ... @@ -326,6 +334,12 @@
getJavaApp();
$("#taskEnableOrDisable_open").click(function () {
taskEnableOrDisable(1);
});
$("#taskEnableOrDisable_close").click(function () {
taskEnableOrDisable(0);
});
$("#addInfoBtn").click(function () {
editJavaInfo(null);
... ... @@ -345,6 +359,31 @@
});
});
//flag 1开启,0关闭
function taskEnableOrDisable(flag) {
var ids=getSelectedServiceIds();
if(ids.length<=0){
localAlert("提示","请至少选择一个任务!");
return ;
}
$.ajax({
url: contextPath + "/javaApi/taskEnableOrDisable",
type: 'post',
dataType: "json",
sync: false,
data: {
'serviceIds': ids,
'apiToggle':flag
},
success: function (data) {
$("#infoTable").table("load");
},
error: function (data) {
}
});
}
function getTableParam() {
var tableParam = {
... ... @@ -367,6 +406,12 @@
//refreshJavaAppStatus();
},
columns: [{
title : " <input type='checkbox' onclick='selectAll(this)' > &nbsp; 全选 " ,
width : "3%",
formatter : function(value, rowData, rowIndex) {
return "<input type='checkbox' name ='checkboxServiceId' data-sign='"+rowData.serviceId+"' >";
}
},{
title: "ID",
field: "serviceId",
width: "4%"
... ... @@ -695,5 +740,36 @@
}]
});
}
//点击表头 的checkbox事件
function selectAll(that){
var isChecked = $(that).is(':checked');
if( isChecked ) {
$("#infoTable tbody").find("input[name='checkboxServiceId']").each(function (index,val) {
$(this).prop("checked",true);
});
}else{
$("#infoTable tbody").find("input[name='checkboxServiceId']").each(function (index,val) {
$(this).prop("checked",false);
});
}
}
function getSelectedServiceIds(){
var ids="";
$("#infoTable tbody").find("input[name='checkboxServiceId']:checked").each(function (index,val) {
var srvId=$(this).attr("data-sign");
if(srvId!=null&&srvId.length>0){
if(ids.length>0){
ids += ",";
}
ids += srvId;
}
});
return ids;
}
</script>
 
\ No newline at end of file
... ...