var tree; function $(id){ return document.getElementById(id); } function createTree(){ tree = new dhtmlXTreeObject("treeBox","100%","100%",0); tree.setSkin('dhx_skyblue'); tree.setImagePath("../images/csh_dhx_skyblue/"); var url = "WorkFlowGridSource.aspx?handle=usertree&uid="+newGuid(); tree.loadJSON(url); tree.attachEvent("onSelect", function(id){ }); // setTimeout(function(){ // var id = $("h_moduleid").value; // // tree.selectItem(id,false); // tree.openItem(id); // },100); } function newGuid(){ var guid = ""; for (var i = 1; i <= 32; i++){ var n = Math.floor(Math.random()*16.0).toString(16); guid += n; if((i==8)||(i==12)||(i==16)||(i==20)) guid += "-"; } return guid.toUpperCase(); } function focusOnTree(){; // if(tree != null){ // if($("h_moduleid").value != ""){ // var id = $("h_moduleid").value; // } // } } function addUser(){ var userList = $("sel_auditor"); if(userList.options.length > 0){ alert("不能添加,请将原审核人移除后,再指定新的审核人"); }else{ if(tree.getSelectedItemId().trim() == ""){ alert("没有选择要添加的审核人,请选择"); }else{ if(validateType(tree.getSelectedItemId()) > 1){ alert("只能选择用户添加,请重新选择要添加的审核人"); }else{ var auditiorId = getID(tree.getSelectedItemId()); var auditiorName = tree.getSelectedItemText(); var workFlowID = $("h_workflow").value; var workFlowStepID = $("h_step").value; var url = "WorkFlowGridSource.aspx?handle=updateauditor&flowid="+workFlowID+"&stepid="+workFlowStepID+"&auditor="+auditiorId+"&uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); var postStatus = loader.xmlDoc.responseText; var status = parseInt(postStatus); if(status == 1){ var varItem = new Option(auditiorName, auditiorId); userList.options.add(varItem); }else if(status == -1 || status == -2){ alert("更新异常"); }else if(status == -3){ alert("工作流内存在未完成的审核记录,不能修改工作流审核人信息"); } } } return; } } function removeUser(){ var userList = $("sel_auditor"); if(userList.options.length > 0){ if(userList.value.trim() == ""){ alert("没有要操作的审核人信息"); }else{ for(var i=0;i