87,907
社区成员
发帖
与我相关
我的任务
分享
/////////////////////////////部门员工树///////////
function createDiv( obj, id ){
var closeDiv = document.createElement("div");
window.document.body.appendChild(closeDiv);
closeDiv.id = id + "_close";
closeDiv.style.position = "absolute";
closeDiv.style.textAlign = 'right';
closeDiv.style.zIndex = 100;
closeDiv.style.visibility = 'hidden';
closeDiv.style.borderColor = '#FFFFFF';
closeDiv.style.border = '0px';
closeDiv.style.borderColor = '#000000';
closeDiv.style.borderStyle = 'solid';
closeDiv.innerHTML = "<a href=javascript:_closeDiv('"+id+"'); class='btnCls2' title='关闭' ></a>";
var topDiv = document.createElement("div");
window.document.body.appendChild(topDiv);
topDiv.id = id;
topDiv.style.zIndex = 99;
topDiv.style.display = 'block';
topDiv.style.position = "absolute";
topDiv.style.backgroundColor = '#FFFFFF';
topDiv.style.border = '1px';
topDiv.style.borderColor = '#000000';
topDiv.style.borderStyle = 'solid';
topDiv.style.fontSize = '12px';
topDiv.style.padding = '0px';
topDiv.style.visibility = 'hidden';
topDiv.style.overFlow = 'true';
_moveDiv(obj, id);
}
function _moveDiv(obj, id){
$(id).style.width= getClientWidth(obj) + "px";
$(id).style.height= getClientHeight(obj) + "px";
$(id+"_close").style.width= 21 + "px";
$(id+"_close").style.height= 18 + "px";
var x = 0;
var y = 0;
if(is_ie){
x= document.body.scrollLeft + obj.getBoundingClientRect().left;
y=document.body.scrollTop + obj.getBoundingClientRect().top + obj.clientHeight + 3;
$(id).style.filter = "alpha(opacity=100)";
}else if(is_moz){
x=document.body.scrollLeft + document.getBoxObjectFor(obj).x;
y=document.body.scrollTop + document.getBoxObjectFor(obj).y + obj.clientHeight + 3;
$(id).style.opacity = "1.0";
}
try{
$(id).style.left = x+ "px";
$(id).style.top = y+"px";
}catch(e){}
try{
$(id+"_close").style.left = (parseInt(x) + parseInt(getClientWidth(obj)) -22)+ "px";
$(id+"_close").style.top = (parseInt(y)+2)+"px";
}catch(e){}
}
function openDiv(obj, id){
if( $(id) == null ){
createDiv(obj, id);
_showDiv(id, true);
_showDiv(id+"_close", true);
}
else{
_showDiv(id, true);
_showDiv(id+"_close", true);
}
fixSelectBug(false);
}
function _showDiv(id, isShow){
var x = $(id).style;
x.visibility = (isShow) ? 'visible':'hidden';
}
function _closeDiv(id){
_showDiv(id, false);
_showDiv(id+"_close", false);
fixSelectBug(true);
try{
this.afterClosed();//这里就我问的问题 } catch(exception){}
}
function setDivContext(id, context){
$(id).innerHTML = context;
}
var dhtmlTree_list = {};//树对象集合<Object{id 层编号,obj 表单对象,tree dhtmlTree对象(对象的属性方法请查阅官方文档)}>
dhtmlTree_list.size = 0;//集合大小
dhtmlTree_list.curIndex;//当前操作Object在集合中的下标
function getOrgEmp(obj){
var dhtmlTree = _getDhtmlTree(obj);
var div_id = dhtmlTree==null? new Date().getTime()+"_div" : dhtmlTree.id;
var tree_div_id = div_id+"_tree";
openDiv(obj, div_id);
if( $(tree_div_id) == null ){
setDivContext(div_id,"<div id='"+tree_div_id+"' style='OVERFLOW-x:auto;OVERFLOW-y:auto;width:"+getClientWidth(obj)+";height:"+getClientHeight(obj)+";'></div>");
var url = ajaxPath + "/OrgEmpTree.do";
var orgEmp_tree_obj=new dhtmlXTreeObject(tree_div_id,"100%","100%",0);
orgEmp_tree_obj.setImagePath(appPathTmp+"js/dhtmlxtree/codebase/imgs/csh_bluebooks/");
orgEmp_tree_obj.enableCheckBoxes(1);
orgEmp_tree_obj.enableThreeStateCheckboxes(true);
orgEmp_tree_obj.enableTreeImages(0);
orgEmp_tree_obj.setXMLAutoLoading(url);
orgEmp_tree_obj.loadXML(url);
orgEmp_tree_obj.attachEvent("onCheck",function(id, state){
if( state == "1" )
orgEmp_tree_obj.openAllItems(id);
else
orgEmp_tree_obj.closeAllItems(id);
});
var dhtmlTree = new Object();
dhtmlTree.id = div_id;
dhtmlTree.obj = obj;
dhtmlTree.tree = orgEmp_tree_obj;
dhtmlTree_list[dhtmlTree_list.size] = dhtmlTree;
dhtmlTree_list.curIndex = dhtmlTree_list.size;
dhtmlTree_list.size++;
try{
this.afterloaded();
} catch(exception){}
}
}
function _getDhtmlTree( obj ){
for(var i=0; i<dhtmlTree_list.size; i++){
if( dhtmlTree_list[i].obj === obj ){
dhtmlTree_list.curIndex = i;
return dhtmlTree_list[i];
}
}
return null;
}