<td><div class="button"><div class="buttonContent"><button class="saveAssPersonnelUser">保存联系人</button></div></div></td>
//常用联系人添加
$(".saveAssPersonnelUser").click(function(){
var org3_ids=$("#org3_ids").val();
var user_id=$("#user_id").val();
jQuery.ajax({
type: 'POST',
dataType:'json',//设置为json 类型后返回数据不需要 再次转换;
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
url: '${contextPath}/wzoa/associatedpersonnel/save?org3_ids='+org3_ids+'&user_id='+user_id,
error: function() {
alertMsg.error('联系人添加失败!');
},
success: function(data) {
$("#tbody_index_html").html("");
var tbody_index_html="";
for(var p in data){//for循环直接遍历数据
tbody_index_html+="<tr id='personRoleRow_"+data[p].id+"'>";
tbody_index_html+="<td>"+(parseInt(p)+1)+"</td>";
tbody_index_html+="<td>"+data[p].recipient_name+"</td>";
tbody_index_html+="<td>"+data[p].organization_name+"</td>";
tbody_index_html+="<td>"+data[p].recipient_dept_name+"</td>";
tbody_index_html+="<td>"+data[p].post+"</td>";
tbody_index_html+="<td>"+data[p].posttype+"</td>";
tbody_index_html+="<td>"+data[p].direct_leadership=='00'?'否':'是'+"</td>";
tbody_index_html+="<td>";
tbody_index_html+="<div class='button'><div class='buttonContent'><button id='submit_"+data[p].id+"' class='assPersonnelUser'>移除</button></div></div>";
tbody_index_html+="<div class='button' style='margin-left: 10px;'><div class='buttonContent'><button id='update_"+data[p].id+"' class='updateAssPersonnelUser'>设置/取消(直接领导)</button></div></div>";
tbody_index_html+="</td>";
tbody_index_html+="</tr>";
}
$("#tbody_index_html").html(tbody_index_html);
}
});
});
@RequiresPermissions("AssociatedPersonnel:save")
@RequestMapping(value = "/save")
public @ResponseBody
Object save(HttpServletRequest request,@RequestParam(value = "org3_ids") String org3_ids,
@RequestParam(value = "user_id") int user_id) {
try{//保存基本信息附件信息
associatedPersonnelService.save(request,user_id,org3_ids);
//关联人员列表
Map<String,Object> condition = new HashMap<String,Object>();
condition.put("personnel_id",user_id);
List<Map<String,Object>> personnelList = associatedPersonnelService.getAssociatedPersonnelList(condition);
return JSON.toJSON(personnelList);//返回json格式数据 }catch(Exception e){ log.error("{}",e); return AjaxObject.newError("保存信息失败!").toString(); } }