1、在后端初始化的方法中添加获取到用户信息;
@Override
public EiInfo initLoad(EiInfo inInfo) {
Uuser uuser = new Uuser();
uuser = UserBelong.getUserInfo(UserSession.getLoginName());
EiBlock org = new EiBlock("org");
org.setCell(0, "orgEname", uuser.getOrgEname());
org.setCell(0, "orgCname", uuser.getOrgCname());
EiInfo outInfo = new EiInfo();
outInfo.addBlock("result2");
outInfo.addBlock(org);
HashMap map = new HashMap();
List list = dao.query("AQJY01.query", map);
EiBlock result1 = outInfo.addBlock("result1");
result1.addRows(list);
return outInfo;
}
2、js控制部门从用户当前部门进行下拉
var row=null;//该变量定义一定是放在$(function()){}外面的
row = __eiInfo.getBlock("org").getMappedRows();//获取到从初始化方法里面取到的数组
IPLATUI.EFTreeInput = {
"inqu_status-0-organizationDepartment": {
// ROOT: {orgEname: "10201", orgCname: "运营分公司", leaf: true, icon: "folder", expanded: true},//配置根节点
ROOT: {orgEname: row[0].orgEname, orgCname: row[0].orgCname, leaf: true, icon: "folder", expanded: true},//配置根节点
backFill: function (e) {
// if (e.node.orgEname != "10201") {
if (e.node.orgEname != row[0].orgEname) { //当其返回值不等于当前节点时,说明下面还有子节点,可以继续进行赋值操作
IPLAT.EFTreeInput.setAllFields($("#inqu_status-0-organizationDepartment"), e.node.orgEname, e.node.orgCname);
} else {
IPLAT.EFTreeInput.setAllFields($("#inqu_status-0-organizationDepartment"), row[0].orgEname, row[0].orgCname);
}
},
}
};