在com.justep.system.opm.OrgUtils提供了根据人员ID可以到获取到人员成员的函数
public static void findDeptByPersonID(String personID){
List<OrgUnit> orgUtils = OrgUtils.findPersonMembersByID("", personID);//根据人员ID获取人员成员
for (OrgUnit person : orgUtils) {
String fid = person.getFID();//获取人员成员sFID的值
String fname = person.getFName();//获取人员成功sFName的值
String deptName = OrgUtils.getDeptNameByFName(fid, fname);//从下向上找,根据FName获取最近的部门的名称
}
}
js中调用action,并传入personID
Model.prototype.button9Click = function(event){
var personID = this.getContext().getCurrentPersonID();// 获取当前人员成员关联的人的ID
var params = new biz.Request.ActionParam();
params.setString("personID", personID);// 给调用的action中的参数赋值
biz.Request.sendBizRequest({
context : this.getContext(),
dataType : "json",
action : "findDeptByPersonIDAction",
parameters : params,
callback : function(result) {
if (result.state) {
alert("调用成功");
} else {
throw new Error("调用失败!|" + result.response.message);
}
}
});
};

评一波