var commonGridObj_range; var comboCustomer;//委托单位 var user_tree; function $(id){ return document.getElementById(id); } function createUserTree(){ user_tree = new dhtmlXTreeObject("dvUserTree","100%","100%",0); user_tree.setSkin('dhx_skyblue'); user_tree.setImagePath("../images/csh_dhx_skyblue/"); var url = "../WorkFlow/WorkFlowGridSource.aspx?handle=usertree&uid="+newGuid(); user_tree.loadJSON(url,function(){ finishLoading(); }); user_tree.enableCheckBoxes(true); user_tree.attachEvent("onClick", function(id){ initLoading(); user_tree.setCheck(id,true); createGrid(id); $("h_checkuser").value = getID(id); var selectedVal = user_tree.getAllChecked(); var selectedArg = new Array(); if(selectedVal.indexOf(",") >= 0){ selectedArg = selectedVal.split(","); }else{ selectedArg.push(selectedVal); } for(var i=0;i= 0){ selectedArg = selectedVal.split(","); }else{ selectedArg.push(selectedVal); } for(var i=0;i 0 && cInd <= 5){ rangeType = 1; switch(cInd){ case 1: rangeValue = 0; break; case 2: rangeValue = 1; break; case 3: rangeValue = 2; break; case 4: rangeValue = 3; break; case 5: rangeValue = 4; break; } url = "UserAuthorityGridSource.aspx?handle=saverange&rtype="+rangeType+"&rval="+rangeValue+"&authgid="+rId+"&checkuser="+checkUser+"&uid="+commonGridObj_range.newGuid(); }else if(cInd > 5 && cInd <= 10){ rangeType = 2; switch(cInd){ case 6: rangeValue = 0; break; case 7: rangeValue = 1; break; case 8: rangeValue = 2; break; case 9: rangeValue = 3; break; case 10: rangeValue = 4; break; } url = "UserAuthorityGridSource.aspx?handle=saverange&rtype="+rangeType+"&rval="+rangeValue+"&authgid="+rId+"&checkuser="+checkUser+"&uid="+commonGridObj_range.newGuid(); } var loader = dhtmlxAjax.getSync(url); var jsonVal = loader.xmlDoc.responseText; var jsonObj = eval('(' + jsonVal + ')'); if(jsonObj != null){ if(jsonObj.authority[0].state == 1){ var rowIndex = commonGridObj_range.getGridObj().getRowIndex(jsonObj.authority[0].id); commonGridObj_range.getGridObj().cellByIndex(rowIndex,1).setValue(jsonObj.authority[0].vall); commonGridObj_range.getGridObj().cellByIndex(rowIndex,2).setValue(jsonObj.authority[0].vcomp); commonGridObj_range.getGridObj().cellByIndex(rowIndex,3).setValue(jsonObj.authority[0].vdept); commonGridObj_range.getGridObj().cellByIndex(rowIndex,4).setValue(jsonObj.authority[0].vself); commonGridObj_range.getGridObj().cellByIndex(rowIndex,5).setValue(jsonObj.authority[0].vnull); commonGridObj_range.getGridObj().cellByIndex(rowIndex,6).setValue(jsonObj.authority[0].oall); commonGridObj_range.getGridObj().cellByIndex(rowIndex,7).setValue(jsonObj.authority[0].ocomp); commonGridObj_range.getGridObj().cellByIndex(rowIndex,8).setValue(jsonObj.authority[0].odept); commonGridObj_range.getGridObj().cellByIndex(rowIndex,9).setValue(jsonObj.authority[0].oself); commonGridObj_range.getGridObj().cellByIndex(rowIndex,10).setValue(jsonObj.authority[0].onull); } }else{ alert("设置失败"); } }else{ var rowIndex = commonGridObj_range.getGridObj().getRowIndex(rId); commonGridObj_range.getGridObj().cellByIndex(rowIndex,cInd).setValue(1); } }); } function reloadEvent(){ commonGridObj_range.reload(); commonGridObj_range.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){ if(state){ var checkUser = $("h_checkuser").value.trim(); var url = ""; var rangeType = 0; var rangeValue = 5; if(cInd > 0 && cInd <= 5){ rangeType = 1; switch(cInd){ case 1: rangeValue = 0; break; case 2: rangeValue = 1; break; case 3: rangeValue = 2; break; case 4: rangeValue = 3; break; case 5: rangeValue = 4; break; } url = "UserAuthorityGridSource.aspx?handle=saverange&rtype="+rangeType+"&rval="+rangeValue+"&authgid="+rId+"&checkuser="+checkUser+"&uid="+commonGridObj_range.newGuid(); }else if(cInd > 5 && cInd <= 10){ rangeType = 2; switch(cInd){ case 6: rangeValue = 0; break; case 7: rangeValue = 1; break; case 8: rangeValue = 2; break; case 9: rangeValue = 3; break; case 10: rangeValue = 4; break; } url = "UserAuthorityGridSource.aspx?handle=saverange&rtype="+rangeType+"&rval="+rangeValue+"&authgid="+rId+"&checkuser="+checkUser+"&uid="+commonGridObj_range.newGuid(); } var loader = dhtmlxAjax.getSync(url); var cacheVal = loader.xmlDoc.responseText; if(cacheVal == 1){ reloadEvent(); }else{ alert("设置失败"); } } }); } 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 initLoading(){ $("progressBar").style.display = ""; } function finishLoading(){ $("progressBar").style.display = "none"; } String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); } function validateType(strObj){ var type = 0; var result = strObj.substring(0,strObj.indexOf("#")); var typeName = strObj.substring(strObj.indexOf("#")+1,strObj.length); switch(typeName){ case "user": type = 1; break; case "comp": type = 2; break; case "dept": type = 3; break; } return type; } function getID(strObj){ var uid = strObj.substring(0,strObj.indexOf("#")); return uid; } function searchUser(txtObjName){ var searchVal = $(txtObjName).value; var searchType = $("sel_type").value; var searchUserObj = null; var searchDeptObj = null; if(searchType == 1){ var url = "../Modules/ModuleGridSource.aspx?handle=checkuser&searchuser="+escape(searchVal)+"&uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); var postStatus = loader.xmlDoc.responseText; if(postStatus != ""){ searchUserObj = JSON.parse(postStatus,function(key,value){ return value; }); } if(user_tree != null){ for(var i=0;i