/**
追加事项处理人
*/
var fields=[
"field13915", //事项处理人
"field14267" //事项处理复制
];
$("#"+fields[0]).bindPropertyChange(function(){
var before=$("#"+fields[1]).val();
var after=$("#"+fields[0]).val();
// console.log("after:"+after+",before:"+before);
$.ajax({
url:"/byfunds/jsp/basic_data/ForwordWorkFlow.jsp?type=bindchange&after="+after+"&before="+before,
type:"post",
dataType:"json",
success:function (data){
//var length= Object.keys(data).length;
var strBrowseBox="";
var lastid="";
for( var attr in data )
{
//alert(data[attr]);
var arr=data[attr].split(",")
var textId =arr[1];
lastid +=textId+",";
var textValue =arr[0];
var ahtml = "<a title='" + textId + "' >" + textValue + "</a> ";
strBrowseBox += BrowseBoxData('1',ahtml,textId);
}
var fieldID=fields[0];
$("#" + fieldID + "span").html(strBrowseBox);
$("#" + fieldID ).val(lastid.substr(0,lastid.length-1));
},
error:function (){
console.log("error");
}
})
})
//ahtml 为a 标签 拼接成隐藏值与显示值, id为该浏览框主键对应的
function BrowseBoxData(viewtype, ahtml, id) {
var ismust = 1;
if (viewtype == '1') {
ismust = 2;
}
var str = "<span class=\"e8_showNameClass\">";
str += ahtml;
str += "<span class=\"e8_delClass\" id=\"" + id + "\" onclick=\"del(event,this," + ismust + ",false,{});\" style=\"opacity: 1; visibility: visible;\"> x </span></span>";
return str;
}
/**
* 拼接人力资源浏览框信息
* @param beforids
* @param afterids
* @return
*/
public JSONObject getNewCombination(String beforids, String afterids){
String last_str="";
JSONObject jsonObject=new JSONObject();
String afterarr[] =afterids.split(",");
for (int i = 0; i < afterarr.length; i++) {
if (null != afterarr[i] && !afterarr[i].isEmpty()) {
if (! afterids.contains( afterarr[i]) || !afterids.equals(afterarr[i])){
last_str+=afterarr[i]+",";
}
}
}
last_str=last_str.endsWith(",")? last_str.substring(0,last_str.length()-1):last_str;
last_str=last_str.isEmpty()?beforids:last_str+","+beforids;
String sql="select id,lastname from hrmresource where id in ("+last_str+") order by id";
RecordSet recordSet=new RecordSet();
recordSet.executeSql(sql);
int i=0;
while (recordSet.next()){
i++;
String value=recordSet.getString("lastname");
String key=recordSet.getString("id");
jsonObject.put("data"+i,value+","+key);
}
return jsonObject;
}