function recruitment(){} recruitment.prototype.recruitparam = {};//招聘参数 recruitment.prototype.initmethod = function(arg){ recruitment.prototype.recruitparam.recruittype = arg.recruittype; recruitment.prototype.initdata(); recruitment.prototype.bindevent(); recruitment.prototype.pagequerypositioninfo(); } recruitment.prototype.bindevent = function(){ $("#searchbtn").click(function(){ recruitment.prototype.pagequerypositioninfo(); }); $("#queryform\\:name").focus(function(){ recruitment.prototype.cleardefaultvalue("queryform\\:name", "岗位名称"); }); $("#queryform\\:name").blur(function(){ recruitment.prototype.setdefaultvalue("queryform\\:name", "岗位名称"); }); // 查询区enter键keydown事件 $("#queryform").bind("keydown" , function(e){ if(e.keycode == 13){ $("#searchbtn").trigger("click"); } }); } recruitment.prototype.setdefaultvalue = function(id,defaultvalue){ var textvalue = $("#"+id).val(); if(textvalue == ""){ $("#"+id).val(defaultvalue); } } /** * 初始化工作地点值 * @return */ recruitment.prototype.initdata = function(){ $.ajax({ url: root_path + "/sysdict/getsysdictdata" , data: null , type: "post" , datatype: "json" , success: function(result){ recruitment.prototype.setworkaddressandpositiontype(result); }, error: function(){ alert("查询数据字典信息出错!"); } }); } /** * 设置岗位类别和工作地点数据 * @return */ recruitment.prototype.setworkaddressandpositiontype = function(data){ var workaddress = data["workaddress"]; var positiontype = data["positiontype"]; if(workaddress != null && workaddress.length > 0){ recruitment.prototype.setselectvalue(workaddress, "queryform\\:workaddress","工作地点"); } if(positiontype != null && positiontype.length > 0){ recruitment.prototype.setselectvalue(positiontype, "queryform\\:positiontype","请选择职位类别"); } } /** * 填充下拉框值 * @param data * @param id * @return */ recruitment.prototype.setselectvalue = function(data,id,defaultvalue){ var option = $(""); $("#"+id).append(option); for(var index = 0 ; index < data.length; index++){ var name = data[index].name; var value = data[index].value; var option = $(""); option.val(value); option.text(name); $("#"+id).append(option); } $("#"+id).chosen({width:"25%"}); } /** * 填充表格数据 * @param data * @return */ recruitment.prototype.setpostioninfo = function(data){ $("#positioncontent").empty(); if(data != null && data.length > 0){ for(var index = 0; index < data.length;index++){ var positionname = data[index].name; var positiontype = data[index].a1; var recruitnum = data[index].recruitnum; var workaddress = data[index].workaddress; var workplace = ""; if(workaddress != null && workaddress !=""){ workplace = workaddress.substr(workaddress,8); if(workplace.lastindexof(",") == workplace.length-1){ workplace = workplace.replace(workplace.charat(workplace.lastindexof(",")),"..."); }else{ if(workplace.length == 8){ workplace += "..."; } } } var positionid = data[index].positionid; var createdate = data[index].a2 == null?"":data[index].a2; var $str = '