前端页面JS处理:
$("#save").click( function(){
var zTree = $.fn.zTree.getZTreeObj("treeDemo" );
if(projectType == "" || projectType == null || projectType == undefined){
alert( "请选择项目类型!" ); return false;
}
taskList = getCheckValue( "taskCheck");
if(taskList.length <= 0){
alert( "请选择流程环节!" ); return false;
}
userList = getCheckValue("defaultCheck" );
console.log(zTree.getCheckedNodes(true));
$.ajax({
url : "${ctx}/main/taskroleset/saveRoleData" ,
type: "POST",
data: {
projectType : projectType,
taskList : taskList,
"ztreeModelList" : JSON.stringify(zTree.getCheckedNodes(true )),
userList : userList
},
success: function(data){
alert(data);
$( 'input:checkbox').attr('checked' , false);
}
});
});
后端Java程序处理:
@RequestMapping(value="saveRoleData" , method = RequestMethod.POST)
public @ResponseBody String saveRoleData(String projectType, @RequestParam (value = "taskList[]", required = false) List<String> taskList, String ztreeModelList, @RequestParam(value = "userList[]" , required = false) List<String> userList, HttpServletRequest request, HttpSession session) throws Exception {
return kwpTaskRoleRefService.createTaskRoleRef(projectType, taskList, ztreeModelList, userList, request);
}