
var vmn=-1;var IsSearch=0;var AddedAll=false;var hsy=null;var txj=null;var idu={};var utv={};var gzg={};var ser={};var hkc={};var spTree_NodeContainerObj={};DcxTree.ClickIcon=bjy;DcxTree.ClickNode=npj;DcxTree.jeaRight=eru;DcxTree.ReturnVal=plg;DcxTree.pcg=kvw;DcxTree.ptq=null;DcxTree.egm=null;DcxTree.ptq2=null;$(document).ready(function(){try{}catch(er){}});$(window).load(function(){try{Dcx.Utility.cdt(true)}catch(er){}});function kvw(a,b){if(!ymr(b)&&b>0&&!ymr(ser["sp"+b])&&ser["sp"+b].length>0)return ser["sp"+b];var c=null;if(a!=undefined&&a!=null)c=$(a);if(ymr(c)&&(ymr(b)||b<1))return null;if(ymr(c)&&!ymr(b)&&b>0)return $("#sptree"+b);if(!ymr(c)&&c.attr("isfield")!="1"){var d=c.parent();while(!ymr(d)&&d.length>0){if(!ymr(d.attr("treeid"))&&d.attr("istree")=="1")break;d=d.parent()}
if(!ymr(d)&&d.length>0)ser["sp"+b]=d;return d}else return null}
function wbi(a,b){if(ymr(a)||a<1)return null;if(!ymr(b)&&$(b).length>0){var c=$(b);var c=c.parent();while(!ymr(c)&&c.length>0){if(c.attr("tagName").toLowerCase()=="dt")break;c=c.parent()}
$group_dt=c;var d=null;if(!ymr(c)&&c.length>0)d=c.next();if(ymr(d)||d.length<1){return null}
return d}else{var e=kvw(null,a);return e.find("#sptree_left"+a)}}
function igt(a,b){if(!ymr(b)&&b>0&&!ymr(hkc["sp"+b]))return hkc["sp"+b];var c=kvw(a,b);return xmt(c);if(!ymr(c)&&c.length>0){var d=c.prev();while(!ymr(d)&&d.length>0){if(d.attr("tagName").toLowerCase()=="input")return d;d=d.prev()}
hkc["sp"+b]=d;return d}
return null}
function xmt(a,b){if(!ymr(a)&&a.length>0){var b=a.attr("TreeId");if(!ymr(b)&&b>0&&!ymr(hkc["sp"+b]))return hkc["sp"+b];var c=a.prev();while(!ymr(c)&&c.length>0){if(c.attr("tagName").toLowerCase()=="input")return c;c=c.prev()}
hkc["sp"+b]=c;return c}else{if(!ymr(b)&&!ymr(hkc["sp"+b]))return hkc["sp"+b]}
return null}
function jse(a){var b=null;var c=$(a);b=wyb(c,null);if(ymr(b)||b.length<1)return null;else return b}
function vip(a){var b=$(a);var c=jpy(b,null);return c.find("[CId]:first")}
function hoa(c){c=ymr(c)?"11":c;if(!ymr(utv["sp"+c]))return utv["sp"+c];var d="/WebServices/Report/Report_Run.asmx/ccw";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:d,async:false,data:"{TreeId:"+c+"}",dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("读取系统类别失败。详情："+b);return false},success:function(a){a=hmy(a);treeObj=a;treeObj.CreateTime=new Date();treeObj.EditTime=new Date();utv["sp"+c]=treeObj}});return treeObj}
function wtm(a){a=ymr(a)?"11":a;if(!ymr(utv["sp"+a]))return utv["sp"+a];var b=igt(null,a);var c={};if(ymr(b)||b.length<1){c=hoa(a);return c}
c.TreeId=parseInt(a,10);c.TreeName=$.trim(b.attr("TreeName"));c.EntId=parseInt($.trim(b.attr("EntId")),10);c.IsDoubleDataSource=$.trim(b.attr("IsDoubleDataSource"))=="1"?true:false;c.BindFieldName=$.trim(b.attr("FieldName"));c.IsBindToValue=$.trim(b.attr("IsBindToValue"))=="1"?true:false;c.FieldDType=parseInt($.trim(b.attr("FieldDType")),10);c.LeftBoxWidth=parseInt($.trim(b.attr("LeftBoxWidth")),10);c.LeftBoxWidth=isNaN(c.LeftBoxWidth)?0:c.LeftBoxWidth;c.RightBoxWidth=parseInt($.trim(b.attr("RightBoxWidth")),10);c.RightBoxWidth=isNaN(c.RightBoxWidth)?0:c.RightBoxWidth;c.Height=parseInt($.trim(b.attr("Height")),10);c.Height=isNaN(c.Height)?0:c.Height;c.TreeTitle=$.trim(b.attr("TreeTitle"));c.SearchIputDefaultText=$.trim(b.attr("SearchIputDefaultText"));c.TextFieldName1=$.trim(b.attr("TextFieldName1"));c.ValueFieldName1=$.trim(b.attr("ValueFieldName1"));c.ParentFieldName1=$.trim(b.attr("ParentFieldName1"));c.IconUrlFieldName1=$.trim(b.attr("IconUrlFieldName1"));c.ExIconUrlFieldName1=$.trim(b.attr("ExIconUrlFieldName1"));c.TopNode_ParentValue1=$.trim(b.attr("TopNode_ParentValue1"));c.TreeNode_JSonClick1=$.trim(b.attr("TreeNode_JSonClick1"));c.Tree_Dynamic1=$.trim(b.attr("Tree_Dynamic1"))=="1"?true:false;c.UseCache1=$.trim(b.attr("UseCache1"))=="1"?true:false;c.TextFieldName2=$.trim(b.attr("TextFieldName2"));c.ValueFieldName2=$.trim(b.attr("ValueFieldName2"));c.ParentFieldName2=$.trim(b.attr("ParentFieldName2"));c.IconUrlFieldName2=$.trim(b.attr("IconUrlFieldName2"));c.ExIconUrlFieldName2=$.trim(b.attr("ExIconUrlFieldName2"));c.TopNode_ParentValue2=$.trim(b.attr("TopNode_ParentValue2"));c.TreeNode_JSonClick2=$.trim(b.attr("TreeNode_JSonClick2"));c.Tree_Dynamic2=$.trim(b.attr("Tree_Dynamic2"))=="1"?true:false;c.UseCache2=$.trim(b.attr("UseCache2"))=="1"?true:false;c.LinkFieldName=$.trim(b.attr("LinkFieldName"));c.Right_ListBoxTitle=$.trim(b.attr("Right_ListBoxTitle"));c.AddAllAlertText=$.trim(b.attr("AddAllAlertText"));c.Right_Hidden=$.trim(b.attr("Right_Hidden"))=="0"?false:true;c.LeftRightSpace_Width=parseInt($.trim(b.attr("LeftRightSpace_Width")),10);c.LeftRightSpace_Width=isNaN(c.LeftRightSpace_Width)?0:c.LeftRightSpace_Width;c.FormType=parseInt($.trim(b.attr("formtype")),10);c.FormType=isNaN(c.FormType)?5:c.FormType;c.TreeNodeCount=parseInt($.trim(b.attr("TreeNodeCount")),10);c.TreeNodeCount=isNaN(c.TreeNodeCount)?0:c.TreeNodeCount;c.DoCallback=$.trim(b.attr("docallback"))=="1"?true:false;utv["sp"+a]=c;return c}
function izx(a,b){if(!ymr(a)&&parseInt(a,10)>0){idu["sp"+a]=b;return true}else return false}
function uei(a){if(!ymr(a)&&parseInt(a,10)>0)return idu["sp"+a];else return null}
function kvt(a,b){if(!ymr(a)&&parseInt(a,10)>0){var c=gzg["sp"+a];if(!ymr(c)&&c.length>0)c.removeClass("selected");b.addClass("selected");gzg["sp"+a]=b;return true}else return false}
function wbe(a){if(!ymr(a)&&parseInt(a,10)>0)return gzg["sp"+a];else return null}
function ige(a,b){if(!ymr(a)&&parseInt(a,10)>0&&!ymr(b)&&b>=0){var c=wtm(a);c.TreeNodeCount=b;utv["sp"+a]=c;var d=igt(null,a);d.attr("TreeNodeCount",b);return true}else return false}
function umq(a,b){b=parseInt(b,10);if(!ymr(a)&&parseInt(a,10)>0&&!isNaN(b)){var c=wtm(a);c.TreeNodeCount=(ymr(c.TreeNodeCount)?0:parseInt(c.TreeNodeCount,10))+b;utv["sp"+a]=c;var d=igt(null,a);d.attr("TreeNodeCount",c.TreeNodeCount);return true}else return false}
function jrb(a){if(!ymr(a)&&parseInt(a,10)>0){var b=wtm(a);return ymr(b.TreeNodeCount)||isNaN(b.TreeNodeCount)||parseInt(b.TreeNodeCount,10)<1?0:parseInt(b.TreeNodeCount,10)}else return-1}
function vim(a){if(!ymr(a)&&parseInt(a,10)>0){var b=wtm(a);if(!ymr(b))return b.FormType;else return 5}else return 5}
function hnx(a){if(!ymr(a)){var b=$(a).parent().parent().parent();if(b.attr("tagName").toLowerCase()!="dd")return"无父级";else return b.prev().find("a.nd-text").html()}else return null}
function tti(a){if(!ymr(a)){var b=$(a).parent().parent().parent();if(b.attr("tagName").toLowerCase()!="dd")return null;else return b.parent().attr("tvalue")}else return null}
function izu(a,b){var c=$(a);var d=c.attr("TId");if(isNaN(d)||ymr(d)||parseInt(d,10)==0)return false;b=ymr(b)||b.length<1?kvw(a,d):b;var e=xmt(b);var f=c.attr("IsField");if(ymr(f)||isNaN(f))f=false;else if(f=="1")f=true;else f=false;var g=null;var h=null;if(!f){h=c;g=jse(a);if(ymr(g)||g.length<1)return false}else{g=c;h=vip(a)}
if(ymr(g)||g.length<1)return false;var j="";var k=$.trim(g.val());if(!ymr(k)){var l=b.find("#sptree_left"+d);k=k.split(",");var m=0;for(var i=0;i<k.length;i++){var v=$.trim(k[i]);if(!ymr(v)){var n=l.find("dl[tvalue='"+v+"'][IsData=1]");if(!ymr(n)&&n.length>0){m++;j=j+$.trim(n.children("dt").find(".nd-text").text()).replace(new RegExp(",","gm"),"")+","}}}
if(j.length>0)j=j.substr(0,j.length-1)}
if(!ymr(h)&&h.length>0){if(!ymr(j)){if(h.attr("tagName").toLowerCase()=="textarea")h.val(j);else h.val(j)}
return true}
return false}
function uef(b,c,d){var e=$(b);c=ymr(c)||c.length<1?kvw(b,d):c;var f=xmt(c);if(f.attr("righthidden")!="0")return;var g=e.attr("IsField");if(ymr(g)||isNaN(g))g=false;else if(g=="1")g=true;else g=false;var h=null;if(!g)h=jse(b);else h=e;if(ymr(h)||h.length<1)return;var j=h.val();var k="";if(e.attr("tagName").toLowerCase()!="input")k=e.val();else k=e.html();var l=c.find("#sptree_left"+d);var m=c.find("#sptree_searchlist"+d);if(!ymr(j)){j=j.split(",");k=k.split(",");for(var i=0;i<j.length;i++){var v=$.trim(j[i]);if(!ymr(v)){var n=l.find("dl[tvalue='"+v+"'][IsData=1]");if(!ymr(n)&&n.length>0)dgy(v,n.children("dt").find(".nd-text").text(),n.attr("index"),d,1,true,n,c);else{if(k.length>i)dgy(v,k[i],-1,d,1,true,l,c)}}}}else{var o=c.find("#rightlist_ul"+d);o.html("");c.find("#sptree-rightCount"+d).html("(<span>0</span>)");var p=c.find("#sptree_left"+d);p.find("dt").each(function(){var a=$(this);a.find(".nd-checked").hide()});var q=m.children("ul");q.children().each(function(){var a=$(this);a.find(".nd-checked").hide()})}
p.show();m.hide()}
function gkf(b,c,d,e){var c=ymr(c)||c.length<1?kvw(clickedObj,b):c;var f=xmt(c);if(f.attr("righthidden")!="0")return;var g=Val;var h=c.find("#sptree_left"+b);var j=c.find("#sptree_searchlist"+b);if(!ymr(val)){val=val.split(",");g=g.split(",");for(var i=0;i<val.length;i++){var v=$.trim(val[i]);if(!ymr(v)){var k=h.find("dl[tvalue='"+v+"'][IsData=1]");if(!ymr(k)&&k.length>0)dgy(v,k.children("dt").find(".nd-text").text(),k.attr("index"),b,1,true,k,c);else{if(g.length>i)dgy(v,g[i],-1,b,1,true,h,c)}}}}else{var l=c.find("#rightlist_ul"+b);l.html("");c.find("#sptree-rightCount"+b).html("(<span>0</span>)");var m=c.find("#sptree_left"+b);m.find("dt").each(function(){var a=$(this);a.find(".nd-checked").hide()});var n=j.children("ul");n.children().each(function(){var a=$(this);a.find(".nd-checked").hide()})}
m.show();j.hide()}
DcxTree.zit2=gkf;function saq(e,f,g){var h=$(e);g=ymr(g)||g.length<1?kvw(e,f):g;var j=xmt(g);if(j.attr("righthidden")!="0")return null;f=isNaN(f)||f<1?parseInt(j.attr("treeId"),10):f;var k=new nzy();k.append("{root:[");var l=g.find("#rightlist_ul"+f);l.find("li").each(function(i){var a=$(this);var b=a.attr("tvalue");var c=a.find("a.nd-right").html();var d=a.attr("tvalue2");if(!ymr($.trim(d)))b=b+"#"+d;if(i>0)k.append(",");k.append("{text:\""+c+"\",value:\""+b+"\"}")});k.append("]}");return k.toString()}
function hgb(a,b,c,d){var e=kvw(null,a);var f=wtm(a);var g=wbe(a);var h=new Array();var i={};i[f.TextFieldName1]=b;i[f.ValueFieldName1]=c;h.push(i);var j=f.FormType;var k=stf(f,h,null,f.TreeNodeCount,j);if(ymr(g)||g.length<1){var l=e.find("div.left").find("div.sptree-list");if(ymr(l)||l.length<1){return false}
l.prepend(k);umq(a,1);var m=l.find("dl[tvalue='"+c+"']").children("dt:first");kvt(a,m);return true}
var m=d==1?g:null;if(d==1){var n=g.next();if(ymr(n)||n.length<1){n=$("<dd></dd>");g.after(n)}
n.append(k);m=n.find("dl[tvalue='"+c+"']").children("dt:first")}else{var o=g.parent();var p=$(k);o.after(p);m=o.next().children("dt:first")}
if(parseInt(d,10)==1)rxj(a);umq(a,1);kvt(a,m);return true}
function tmm(a,b,c){var d=wbe(a);if(ymr(d)||d.length<1){alert("请点击目标节点，再修改节点。");return false}
if(!ymr(b))d.find("a.nd-text").html(b);if(!ymr(c))d.parent().attr("tvalue",c);return true}
function fry(a){var b=wbe(a);if(ymr(b)||b.length<1){alert("请点击目标节点，再删除节点。");return false}
var c=b.parent();var d=0-c.find("dl[isdata=1]").length-1;c.remove();umq(a,d);return true}
function rxj(a,b){var b=ymr(b)||b.length<1?wbe(a):b;if(ymr(b)||b.length<1){alert("请点击目标节点，再展开节点。");return false}
var c=b.parent();while(!ymr(c)&&c.length>0&&c.attr("tagName").toLowerCase()=="dl"){c.removeClass("nd-fold").addClass("nd-unfold").attr("isfold","0");b=c.children("dt");var d=b.find(".spicon-close");if(ymr(d)||d.length<1){d=b.find(".spicon-no");if(!ymr(d)&&d.length>0)d.removeClass("spicon-no").addClass("spicon-close")}
if(!ymr(d)&&d.length>0)d.show().removeClass("spicon-close").addClass("spicon-open").next().show().removeClass("spicon-fold").addClass("spicon-unfold");c=c.parent().parent()}
return true}
function gnu(a){var c=wbe(a);if(ymr(c)||c.length<1){alert("请点击目标节点，再折叠节点。");return false}
var d=c.parent();d.removeClass("nd-unfold").addClass("nd-fold").attr("isfold","1");var e=c.filter(".spicon-open");if(!ymr(e)&&e.length>0){var b=e.hasClass("spicon-unfold");e.show().removeClass("spicon-open").addClass("spicon-close").next().show();if(b)e.removeClass("spicon-unfold").addClass("spicon-fold")}
return true}
function stf(a,b,c,d,e,f){if(f!=true)f=false;var g=null;var h=null;if(a.TreeNode_JSonClick1==null||a.TreeNode_JSonClick1.ngj()=="")a.TreeNode_JSonClick1="npj(";if(b==null||b.length<1)return"";var j=new nzy();var k=b.length;var l="";var m="";var n=null;if(d<0)d=0;var o=d+1;var p=a.Tree_Dynamic1||a.ParentFieldName1==""?false:true;var q=g==null||g.length<1||a.LinkFieldName==""||!a.IsDoubleDataSource?false:true;var r=!a.Right_Hidden?true:false;var s=q?0:1;var t=a.IsDoubleDataSource;var u=a.TextFieldName1;var v=a.ValueFieldName1;var w=a.ParentFieldName1;var x=a.BindFieldName;var y=a.IconUrlFieldName1.ngj();var z="";var A=y==""?false:true;var B=a.TreeNode_JSonClick1;var C=a.TreeId.toString();var D=1;var E=(!a.IsDoubleDataSource&&p)||(a.IsDoubleDataSource&&!a.Tree_Dynamic2&&a.ParentFieldName1!="")?1:0;if(f)E=1;for(var i=0;i<b.length;i++){n=b[i];l=n[u];m=n[v];o++;j.append("\n<dl id='t_"+o+C+"' tvalue='"+m+"' IsData="+s+" geted="+E+" index="+o+" dsl="+D+" ");if(i==0&&p)j.append(" class='nd-unfold'isfold=0 ");else j.append(" class='nd-fold' isfold=1 ");j.append(" "+c+" >\n");j.append("<dt>\n");if(!f){if(p){if(h!=null&&h.length>0){if(i==0)j.append("<span class='spicon-open' onclick=\"javascript:bjy(this);\">d</span>");else j.append("<span class='spicon-close' onclick=\"javascript:bjy(this);\">r</span>")}else j.append("<span class='spicon-no' onclick=\"javascript:bjy(this);\"></span>")}else j.append("<span class='spicon-close' onclick=\"javascript:bjy(this);\">r</span>")}else j.append("<span class='spicon-no' onclick=\"javascript:bjy(this);\"></span>");if(A){z=n[y];if(z!="")j.append("<span style='background-image: url("+z+");"+(f?"display:none;":"")+"' class='nd-icon'></span>");else{if(i==0&&p)j.append("<span class='spicon-unfold' style=\""+(f?"display:none;":"")+"\"></span>");else j.append("<span class='spicon-fold' style=\""+(f?"display:none;":"")+"\"></span>")}}else{if(i==0&&p)j.append("<span class='spicon-unfold' style=\""+(f?"display:none;":"")+"\"></span>");else j.append("<span class='spicon-fold' style=\""+(f?"display:none;":"")+"\"></span>")}
j.append("<a class='nd-text' href='javascript:void(0);' onclick=\"javascript:"+B+"this);\">"+l+"</a>");if(r&&(q||(!q&&(a.Tree_Dynamic1||(h!=null&&h.length!=0))))){j.append("<a class='nd-add-all");if(a.Tree_Dynamic1)j.append(" hide");j.append("' title='"+a.AddAllAlertText+"' href='javascript:void(0);'  onclick=\"javascript:otr(this);\">"+a.AddAllAlertText+"</a>\n")}
if(!q&&(a.Tree_Dynamic1||(h!=null&&h.length==0)))j.append("<span class='nd-checked hide' >已选中</span>\n");j.append("</dt>\n");j.append("<dd>\n");j.append("</dd>\n</dl>\n")}
return j.toString()}
function eyf(a,b,c){var d=wbi(a,null);if(!ymr(d)&&d.length>0){var e=d.find("dl[tvalue='"+b+"']");if(!ymr(e)&&e.length>0){var f=e.find("dl[tvalue='"+c+"']");if(!ymr(f)&&f.length>0)return true;else return false}else return false}
return false}
function qeq(a){var b=a;var c=a.parent().parent();while(!ymr(c)&&c.length>0&&c.attr("tagName").toLowerCase()=="dl"){b=c;c=c.parent().parent()}
return b}
function fkc(a,b,c,d){var e=wbi(a,null);if(!ymr(e)&&e.length>0){var f=e.find("dl[tvalue='"+c+"']");if(!ymr(f)&&f.length>0){var g=e.find("dl[tvalue='"+b+"']");if(!ymr(g)&&g.length>0){g.children("dd").append(f);rxj(a,g.children("dt"))}else if(!ymr(d)&&d.length>0){var h=d;var i=d.parent();var j=false;while(!ymr(i)&&i.length>0&&i.attr("tagName").toLowerCase()=="dd"){i=i.parent();var v=$.trim(i.attr("tvalue"));if(ymr(v))break;g=e.find("dl[tvalue='"+v+"']");if(!ymr(g)&&g.length>0){j=true;break}
h=i;i=i.parent()}
h=h.clone();if(!j)g=e;else g=g.children("dd");g.append(h);h.find("dl[tvalue='"+c+"']").remove();if(h.attr("tvalue")==b)i=h;else i=h.find("dl[tvalue='"+b+"']");if(!ymr(i)&&i.length>0)i.children("dd").append(f);if(j){rxj(a,h.children("dt"));rxj(a,g.prev())}}}else return false}
return false}
function rpn(a,b,c){var d=$(a).parent();var e=d.attr("tvalue");var f=d.attr("index");var g=0;var h=d.find(".nd-text").text();dgy(""+e,h,f,c,g,b,d)}
function dgy(c,d,e,f,g,h,i,j){if(ymr(j)&&j.length<1&&!ymr(i)&&i.length>0)j=kvw(i.get(0));var k=!ymr(j)&&j.length>0?j.find("#rightlist_ul"+f):$("#rightlist_ul"+f);var l=k.find("li").length;var m=!ymr(j)&&j.length>0?j.find("#sptree-rightCount"+f):$("#sptree-rightCount"+f);var n=xmt(j);var o=n.attr("Js_removeRight");if(ymr(o))o="plj(";if(k.find("li[tvalue="+c+"]").length>0){if(h){k.find("li[tvalue="+c+"]").remove();l--;m.html("(<span>"+l+"</span>)");if(i!=undefined)i.find(".nd-checked:first").hide()}
return}
c=""+c;l++;e=ymr(e)||isNaN(e)?"0":e;var p=new nzy();p.append("<li tvalue=\""+c+"\" TreeId=\""+f+"\" "+(!ymr(txj)?" tvalue2=\""+txj+"\" ":"")+">");var q="移除";var r="删除";p.append("<a class='nd-remove' title='"+q+"' href=\"javascript:void(0);\" onclick=\"javascript:"+o+"this,'"+f+"',"+l+",'"+e+"');\">"+r+"</a>");p.append("<a class=\"nd-right\" href='javascript:void(0);'>"+d+"</a>");p.append("</li>");k.append(p.toString());m.html("(<span>"+l+"</span>)");if(i!=undefined){var s=i.find(".nd-add-all");i.find(".nd-checked:first").show()}
try{k.unbind("sortable").sortable({update:function(a,b){}}).disableSelection()}catch(err){}}
function plj(b,c,d,e){var f=kvw(b);var g=xmt(f);var c=g.attr("TreeId");var h=f.find("#rightlist_ul"+c);var i=$(b).parent();var j=i.attr("tvalue");var g=igt(i.get(0));i.remove();var k=$("#sptree_left"+g.attr("TreeId"));k.find("dl[tvalue="+j+"]").each(function(){var a=$(this);a.find(".nd-checked:first").hide()});f.find("#sptree-rightCount"+c).html("(<span>"+h.children().length+"</span>)")}
function eru(b,c){c=ymr(c)||c.length<1?kvw(b):c;var d=xmt(c);var e=d.attr("TreeId");var f=c.find("#rightlist_ul"+e);f.html("");c.find("#sptree-rightCount"+e).html("(<span>0</span>)");var g=c.find("#sptree_left"+e);g.find("dt").each(function(){var a=$(this);a.find(".nd-checked").hide()});var h=c.find("#sptree_searchlist"+e).children("ul");h.children().each(function(){var a=$(this);a.find(".nd-checked").hide()})}
function qwf(d,e,f){var g=$(d);f=ymr(f)||f.length<1?kvw(d,e):f;var h=xmt(f);if(h.attr("righthidden")!="0")return null;e=isNaN(e)||e<1?parseInt(h.attr("treeId"),10):e;var j=new Array();var k=f.find("#rightlist_ul"+e);k.find("li").each(function(i){var a=$(this);var b=a.attr("tvalue");var c=a.attr("tvalue2");if(!ymr($.trim(c)))b=b+"#"+c;j.push(b)});return j}
function ccr(f,g,h){var j=$(f);h=ymr(h)||h.length<1?kvw(f,g):h;var k=xmt(h);if(k.attr("righthidden")!="0")return null;g=isNaN(g)||g<1?parseInt(k.attr("treeId"),10):g;var l=new Array();var m=h.find("#rightlist_ul"+g);m.find("li").each(function(i){var a=$(this);var b=a.attr("tvalue");var c=a.find("a.nd-right").html();var d=a.attr("tvalue2");if(!ymr($.trim(d)))b=b+"#"+d;var e={"text":c,"value":b};l.push(e)});return l}
function otr(b){if(ymr(b))return;AddedAll=false;hsy=null;var c=null;var d=null;if(ymr($(b).attr("isAddAllTree"))){c=$(b).parent();d=c.parent();var e=kvw(b);var f=xmt(e);var g=parseInt(f.attr("TreeId"),10);var h=parseInt(d.attr("index"),10);if(isNaN(h))h=0;var i=0;if(d.attr("geted")=="0"){npj(c.children(":first").get(0),true)}else{var j=f.attr("IsDoubleDataSource");var k=f.attr("RightHidden");if(k=="1")return;var l=c.next();if(ymr(l)||l.length<1)l=c.prev();l.find("dl[IsData=1]").each(function(){var a=$(this);i++;dgy(a.attr("tvalue"),a.children().filter("dt").find(".nd-text").text(),h,g,1,true,a,e)});hsy=d.attr("tvalue");if(ymr(hsy))hsy=null}
if(i>0){d.children("dt").children(".spicon-close:first").removeClass("spicon-close").addClass("spicon-open").next().removeClass("spicon-fold").addClass("spicon-unfold");d.removeClass("nd-fold").addClass("nd-unfold")}
AddedAll=true}else{var e=kvw(b);var f=xmt(e);var g=parseInt(f.attr("TreeId"),10);var h=0;var i=0;var j=f.attr("IsDoubleDataSource");var k=f.attr("RightHidden");if(k=="1")return;e.find("dl[IsData=1]").each(function(){var a=$(this);i++;dgy(a.attr("tvalue"),a.children().filter("dt").find(".nd-text").text(),h,g,1,false,a,e)})}}
function dyc(a){if(AddedAll){AddedAll=false;return}
var b=kvw(a);var c=xmt(b);var d=parseInt(c.attr("TreeId"),10);var e=c.attr("FieldName");var f=c.attr("isdoubledatasource");if(f=="1")f=true;else f=false;var g=$.trim(c.attr("RightHidden"));var h=$(a).parent("li");var i=h.attr("tvalue");var j=$(a).text();var k=h.attr("index");var l=h.attr("dl_id");if(ymr(k)||isNaN(k))k=-1;if(g=="1"){var m=1;if(f)m=2;brr(c.attr("EntId"),c.attr("CtrlPrex"),i,j,c.attr("FieldName"),c.attr("IsBindToValue"),k,d,m,c.attr("IsDoubleDataSource"),c.attr("FormType"),a)}else{var n=b.find("#rightlist_ul"+d);var o=h.find(".nd-checked");var p=n.find("li[tvalue='"+i+"']");var q=n.find("li").length;if(p.length>0){if(o.css("display").toLowerCase()!="none"){p.remove();o.hide();q--;b.find("#sptree-rightCount"+d).html("(<span>"+q+"</span>)");if(!ymr(l))b.find("#"+l).children("dt").find(".nd-checked").hide()}else o.show();return}
var r=c.attr("JsRightRemove");if(ymr(r))r="plj(";var s="<li tvalue=\""+i+"\" TreeId='"+d+"'><a class='nd-remove'   title='移除' href=\"javascript:"+r+"this,'"+d+"',"+q+",'"+k+"');\">删除</a><a class='nd-right' href='javascript:void(0);'>"+j+"</a></li>";n.append(s);q++;b.find("#sptree-rightCount"+d).html("(<span>"+q+"</span>)");o.show();if(!ymr(l))b.find("#"+l).children("dt").find(".nd-checked").show()}}
function pen(c,d){var e=kvw(c);var f=xmt(e);d=f.attr("TreeId");var g=e.find("#sptree_left"+d);var h=$(c);var i=e.find("#sptree_searchlist"+d);var j=e.find("#txt_search_sptree"+d);if(h.attr("IsSearch")=="1"){h.removeClass("nd-search-del");i.addClass("none");i.hide();g.show();h.attr("IsSearch","0");h.attr("title","点击搜索");j.val("");j.focus();return}
var k=$.trim(j.val());if(ymr(k)||k=="请输入关键字"){alert("请输入搜索内容");return}
var l=f.attr("isdoubledatasource");if(l=="1")l=true;else l=false;var m=parseInt(f.attr("tree_dynamic1"),10);var n=parseInt(f.attr("tree_dynamic2"),10);if(ymr(m)||isNaN(m))m=0;if(ymr(n)||isNaN(n))n=0;var o=0;var p=1;if(l&&o>1)p=0;var q=new nzy();var r=0;g.find("dl[IsData=1]").each(function(){var a=$(this);var b=a.children("dt").children(".nd-text").text();if(b.indexOf(k)>=0){r++;q.append("<li tvalue=\""+a.attr("tvalue")+"\" index=\""+a.attr("index")+"\" dl_id=\""+a.attr("id")+"\"><a class='nd-checked hide' title='已选' href=\"javascript:void(0);\">已选</a><a  class='nd-right' href=\"javascript:void(0);\" onclick=\"javascript:dyc(this);\">"+b+"</a></li>")}});if(r<1)i.find("ul").show().html("<li ><a  class='nd-no-item' href='javascript:void(0);'>抱歉，没有找到相关结果</a></li>");else i.find("ul").show().html(q.toString());h.addClass("nd-search-del");i.removeClass("none").show();g.hide();h.attr("title","退出搜索");h.attr("IsSearch","1");return}
function bjy(a){npj(a,false,true)}
function npj(a,c,d,e){if(e==undefined)e=false;if(!d)d=false;if(AddedAll&&c==true){AddedAll=false;if($(a).parent().parent().attr("tvalue")==hsy)return;else hsy=null}else{AddedAll=false;hsy=null}
var f=kvw(a);var g=xmt(f);if(parseInt(g.attr("EntId"),10)<1)g.attr("EntId","0");var h=parseInt(g.attr("TreeId"),10);var i=parseInt(g.attr("FormType"),10);var j=g.attr("FieldName");var k=parseInt($.trim(g.attr("FieldDType")),10);var l=g.attr("IsBindToValue");var m=g.attr("isdoubledatasource");if(m=="1")m=true;else m=false;var n=g.attr("tree_dynamic1");var o=g.attr("tree_dynamic2");n=n=="1"?true:false;o=o=="1"?true:false;var p=g.attr("UseCache1");var q=g.attr("UseCache2");var r=g.attr("RightHidden");r=r=="1"?true:false;var s=$(a);var t=s.parent();var u=t.parent();var v=t.children();var w=u.attr("tvalue");var x=parseInt($.trim(u.attr("index")),10);var y=parseInt(u.attr("dsl"),10);var z=parseInt(u.attr("IsData"),10);var A=g.attr("doCallBack")=="0"?false:true;var B=u.attr("geted")=="1"?true:false;var C=u.attr("isfold")=="1"?true:false;var D=true;var E=1;if(m&&y>1){D=u.attr("geted2")=="1"?true:false;B=D;E=0}else if(m){D=u.attr("geted2")=="1"?true:false}
if(m&&D)B=true;if(!d){var F=wbe(h);if(!ymr(F)&&F.length>0)F.removeClass("selected")}
kvt(h,t);$idu=w;var G=true;if(E&&m)G=false;var H=d;if(!d&&!G)d=true;if(!C){if(!d){if(!r){if(!e)dgy(u.attr("tvalue"),t.find(".nd-text").text(),x,h,1,true,u,f)}else brr(g.attr("EntId"),g.attr("CtrlPrex"),w,t.find(".nd-text").text(),j,l,x,h,y,g.attr("IsDoubleDataSource"),i,a,k);return}
if(H){u.removeClass("nd-unfold").addClass("nd-fold").attr("isfold","1");if(y==1){v.filter(".spicon-open").removeClass("spicon-open").addClass("spicon-close").html("r").next().removeClass("spicon-unfold").addClass("spicon-fold")}else v.filter(".spicon-open").removeClass("spicon-open").addClass("spicon-close").html("r").next().removeClass("spicon-unfold2").addClass("spicon-fold2")}}else{var I=false;if((!m&&!n)||(m&&!o&&!n)||(B&&D)){var J=t.next();if(!ymr(J)&&J.length<1||J.children().length<1)v.first().removeClass("spicon-close spicon-open").addClass("spicon-no");I=true}
u.removeClass("nd-fold").addClass("nd-unfold").attr("isfold","0");if(y==1){v.filter(".spicon-close").removeClass("spicon-close").addClass("spicon-open").html("d");var J=v.next();var b=J.hasClass("spicon-unfold");if(b)J.removeClass("spicon-fold").addClass("spicon-unfold")}else v.filter(".spicon-close").removeClass("spicon-close").addClass("spicon-open").html("d").next().removeClass("spicon-fold2").addClass("spicon-unfold2")}
if(B&&D){if(!d){if(!r){if(!e)dgy(u.attr("tvalue"),t.find(".nd-text").text(),x,h,1,true,u,f)}else brr(g.attr("EntId"),g.attr("CtrlPrex"),w,t.find(".nd-text").text(),j,l,x,h,y,g.attr("IsDoubleDataSource"),i,a,k)}
return}
if((!m&&!n)||(m&&!o&&!n)){if(!d){if(!r){if(!e)dgy(u.attr("tvalue"),t.find(".nd-text").text(),x,h,1,true,u,f)}else brr(g.attr("EntId"),g.attr("CtrlPrex"),w,t.find(".nd-text").text(),j,l,x,h,y,g.attr("IsDoubleDataSource"),i,a,k)}
return}
if(!d&&G){if(!r){if(!e)dgy(u.attr("tvalue"),t.find(".nd-text").text(),x,h,1,true,u,f)}else brr(g.attr("EntId"),g.attr("CtrlPrex"),w,t.find(".nd-text").text(),j,l,x,h,y,g.attr("IsDoubleDataSource"),i,a,k)}
if(A)dfv(f,g,u,t,w,x,j,h,r,m,E,i,c,d);else nwr(g.attr("EntId"),g.attr("CtrlPrex"),w,t.find(".nd-text").text(),j,l,x,h,y,g.attr("IsDoubleDataSource"),i,a,k);return true}
function dfv(i,j,k,l,m,n,o,p,q,r,s,t,u,v){var w=j.attr("TreeNodeCount");if(w=="0"||w==undefined){w=$("#sptree_left"+p).find("dl").length;j.attr("TreeNodeCount",w)}else w=parseInt(w,10);var x="";var y="/Js/Control/LTreeRList/getLTreeRListLi.aspx";var z="?entid="+escape(escape(j.attr("EntId")))+"&issearch=0&stext="+escape(escape(m))+"&IsFirstDataSource="+s+"&pindex="+n+"&fieldname="+escape(escape(o))+"&TreeId="+p+"";z+="&UseCache1="+escape(escape(j.attr("UseCache1")))+"&UseCache2="+escape(escape(j.attr("UseCache2")))+"&TreeNode_JSonClick1="+escape(escape(j.attr("TreeNode_JSonClick1")))+"&TreeNode_JSonClick2="+escape(escape(j.attr("TreeNode_JSonClick2")));z+="&stn="+escape(escape(j.attr("SearchTreeNode")))+"&maxindex="+w+"&FormType="+t+"&LinkFieldValue="+escape(escape(m));$.ajax({type:"GET",url:y,dataType:"text",data:""+z+"",beforeSend:function(a){},success:function(a){a=hmy(a);x=a;var c=0;var d=l.next();if(ymr(d)||d.length<1){d=l.prev();if(ymr(d)||d.length<1){var e=$("<dd ></dd>");l.after(e);d=l.next()}}
d.append(x);var f=c=d.children();c=f.length;if(!r||s==0){if(q=="0"&&c==0){dgy(k.attr("tvalue"),l.find(".nd-text").text(),n,o,1,true,l,i)}}
if(c>0){if(!r||s==0)l.find(".nd-add-all").show();else if(f.filter("[dsl=2]").length>0)l.find(".nd-add-all").show()}
var g=l.children();if(c>0){g.first().removeClass("spicon-close spicon-no").addClass("spicon-open");g.first().next().removeClass("spicon-fold").addClass("spicon-unfold");w=w+c;j.attr("TreeNodeCount",w)}else{g.first().removeClass("spicon-close spicon-open").addClass("spicon-no");var h=g.first().next();var b=h.hasClass("spicon-unfold");if(b)h.removeClass("spicon-unfold").addClass("spicon-fold");g.filter(".nd-add-all").hide()}
k.removeClass("nd-fold").addClass("nd-unfold");k.attr("geted","1").attr("geted2","1");if(u==true&&j.attr("RightHidden")=="0"&&c.length>0)otr(l.children().first().get(0))},complete:function(a,b){},error:function(){}})}
function plg(e){var f=kvw(e);var g=xmt(f);var h=f.find("#rightlist_ul"+f.attr("TreeId"));var j=new nzy();var k=new nzy();h.find("li").each(function(i){var a=$(this);var b=a.attr("tvalue");var c=a.find("a.nd-right").text();var d=a.attr("tvalue2");if(!ymr($.trim(d)))b=b+"#"+d;if(i>0)j.append(",");j.append(b);if(i>0)k.append(",");k.append(c)});j=j.toString();k=k.toString();brr(g.attr("EntId"),g.attr("CtrlPrex"),j,k,g.attr("FieldName"),g.attr("IsBindToValue"),-1,g.attr("TreeId"),-1,g.attr("IsDoubleDataSource"),g.attr("FormType"),null)}
function brr(a,b,c,d,e,f,g,h,i,j,k,l,m){try{kvt(h,$(l).parent())}catch(err){alert(err)}
if(e==""){try{art.VLdialog.alert('请设置与本树绑定的实体的字段名称！',function(){})}catch(err){alert('请设置与本树绑定的实体的字段名称！')}}
if(a==""){try{art.VLdialog.alert('请设置与本树绑定的实体！',function(){})}catch(err){alert('请设置与本树绑定的实体！')}}
if(j=="1"&&i=="1"){ccc(a,b,c,d,e,f,g,h,i,j)}else{var n=c;if(f=="0")n=d;var o=e+"='"+n+"'";if(k==0){eon(a,b,e,n,o,c,d,g,h,l,m)}else if(k==1){ayz(a,b,e,n,o,c,d,g,h,l,m)}else if(k==2){bjv(a,b,e,n,o,c,d,g,h,l,m)}else if(k==3){rpn(l,true,h)}else if(k==4){bjv(a,b,e,n,o,c,d,g,h,l,m)}else if(k==5){ayz(a,b,e,n,o,c,d,g,h,l,m)}else if(k==6){bjv(a,b,e,n,o,c,d,g,h,l,m)}else{if(!ymr(DcxTree.ptq)){DcxTree.ptq(a,b,e,n,o,c,d,g,h,l,m)}else{if(!ymr(DcxTree["T"+a+"_"+h])){if(!ymr(DcxTree["T"+a+"_"+h].ptq)){DcxTree["T"+a+"_"+h].ptq(a,b,e,n,o,c,d,g,h,l,m)}else art.VLdialog.alert('您还没定义函数：DcxTree["T'+a+'_'+h+'"].ptq(EntId,CtrlPrex,BindFieldName,BindValue,OtherSqlCondition,NodeValue,NodeText,NodeIndex,TreeId,ClickedObj, BindFieldDType) ！',function(){})}else{art.VLdialog.alert('您还没定义 DcxTree["T'+a+'_'+h+'"] ，请在您的JS代码文件中，插入 DcxTree["T'+a+'_'+h+'"]={};这段代码 ！',function(){})}}}}
return true}
function nwr(a,b,c,d,e,f,g,h,i,j,k,l,m){if(e==""){try{art.VLdialog.alert('请设置与本树绑定的实体的字段名称！',function(){})}catch(err){alert('请设置与本树绑定的实体的字段名称！')}}
if(a==""){try{art.VLdialog.alert('请设置与本树绑定的实体！',function(){})}catch(err){alert('请设置与本树绑定的实体！')}}
if(j=="1"&&i=="1"){ccc(a,b,c,d,e,f,g,h,i,j,l,m)}else{var n=c;if(f=="0")n=d;if(a<1)a=0;var o=e+"='"+n+"'";if(!ymr(DcxTree.egm)){DcxTree.egm(a,b,e,n,o,c,d,g,h,l,m)}else{if(!ymr(DcxTree["T"+a+"_"+h])){if(!ymr(DcxTree["T"+a+"_"+h].egm)){DcxTree["T"+a+"_"+h].egm(a,b,e,n,o,c,d,g,h,l,m)}else art.VLdialog.alert('您还没定义函数：DcxTree["T'+a+'_'+h+'"].egm(EntId,CtrlPrex,BindFieldName,BindValue,OtherSqlCondition,NodeValue,NodeText,NodeIndex,TreeId,ClickedObj, BindFieldDType) ！',function(){})}else{art.VLdialog.alert('您还没定义 DcxTree["T'+a+'_'+h+'"] ，请在您的JS代码文件中，插入 DcxTree["T'+a+'_'+h+'"]={};这段代码 ！',function(){})}}}
return true}
function ccc(a,b,c,d,e,f,g,h,i,j,k,l){var m=c;if(f=="0")m=d;var n=e+"='"+m+"'";if(!ymr(DcxTree["T"+a+"_"+h])){if(!ymr(DcxTree["T"+a+"_"+h].egm)){DcxTree["T"+a+"_"+h].egm(a,b,e,m,n,c,d,g,h,k,l)}else art.VLdialog.alert('您还没定义函数：DcxTree["T'+a+'_'+h+'"].egm(EntId,CtrlPrex,BindFieldName,BindValue,OtherSqlCondition,NodeValue,NodeText,NodeIndex,TreeId,ClickedObj, BindFieldDType) ！',function(){})}else{art.VLdialog.alert('您还没定义 DcxTree["T'+a+'_'+h+'"] ，请在您的JS代码文件中，插入 DcxTree["T'+a+'_'+h+'"]={};这段代码 ！',function(){})}}
function ohn(c,d,f,g,h,i){var j=wyb($(c),null);if($(c).attr("disabled"))return false;var k="d"+f+"_"+g;DcxTree.zcb=$('#sptree'+d);var l=xfx(c,"Left");var m=xfx(c,"Top");DcxTree.zcb.css('left',(l-4)+'px');DcxTree.zcb.css('top',m+$(c).height()+'px');DcxTree.zcb.attr("LastEntId",f);DcxTree.zcb.attr("LastFieldName",g);if(h==false)DcxTree.zcb.show();DcxTree.zcb.css('display','block').css('position','absolute');DcxTree.vzw='sptree'+d;DcxTree.CurFormCtrlId_LF=$(c).attr("id");DcxTree.$targetObj=$(c);DcxTree.TreeId=d;DcxTree.EntId=f;DcxTree.FieldName=g;DcxTree.CtrlPrex="AjaxF_";try{if(DcxTree.zcb.attr("LastEntId")!=f+""||DcxTree.zcb.attr("LastFieldName")!=g)izu(c,DcxTree.zcb,d)}catch(e){}
DcxTree.zcbMsg=$('#vl_superTreeMsg'+d);DcxTree.zcbMsg.attr("EntId",f);DcxTree.zcbMsg.attr("FieldName",g);if(DcxTree.zcb.attr("isNotFirstTime")!="1"){$(document).mouseup(function(a){var b=$(a.target);if(!Dcx.wsj(b,DcxTree.zcb.attr("id"),20))DcxTree.zcb.hide()});DcxTree.zcb.attr("isNotFirstTime","1")}}
DcxTree.ShowDialogAf=ohn;function ayz(a,b,c,d,e,f,g,h,i){var a=DcxTree.zcb.attr("LastEntId");var j=DcxTree.zcb.attr("LastFieldName");DcxTree.$targetObj.val(g);var k=wyb(DcxTree.$targetObj);k.val(f);if(!ymr(DcxTree.$targetObj)&&DcxTree.$targetObj.length>0){try{DcxTree.$targetObj.blur()}catch(err){}}
try{DcxTree.$targetObj.keyup()}catch(err){}
DcxTree.zcb.hide();if(!ymr(DcxTree.$targetObj)&&DcxTree.$targetObj.length>0){try{DcxTree.$targetObj.change();DcxTree.$targetObj.focus()}catch(err){}
DcxTree.zcb.hide()}}
DcxTree.GetNodeValueAf=ayz;function mdk(c,d,e,f,g){var h=wyb($(c),null);if($(c).attr("disabled"))return false;var i="d"+e+"_"+f;DcxTree.zcb=$('#sptree'+d);var j=xfx(c,"Left");var k=xfx(c,"Top");DcxTree.zcb.css('left',(j-5)+'px');DcxTree.zcb.css('top',k+$(c).height()+7+'px');DcxTree.zcb.attr("LastEntId",e);DcxTree.zcb.attr("LastFieldName",f);if(g==false)DcxTree.zcb.show();DcxTree.zcb.css('display','block').css('position','absolute');DcxTree.vzw='sptree'+d;DcxTree.CurFormCtrlId_LF=$(c).attr("id");DcxTree.$targetObj=$(c);DcxTree.TreeId=d;DcxTree.EntId=e;DcxTree.FieldName=f;DcxTree.CtrlPrex="ListF_";var l=DcxForm.IsChildEnt(e,DcxTree.CtrlPrex);if(l)DcxTree.CtrlPrex="AjaxF_";DcxTree.$rowObj=DcxForm.GetRow(c,e,DcxTree.CtrlPrex);DcxTree.rowIndex=DcxForm.GetRowIdx2(DcxTree.$rowObj,e,DcxTree.CtrlPrex);lsm(e,DcxTree.rowIndex,DcxTree.CtrlPrex);if(DcxTree.zcb.attr("LastEntId")!=e+""||DcxTree.zcb.attr("LastFieldName")!=f)izu(c,DcxTree.zcb,d);DcxTree.zcbMsg=$('#vl_superTreeMsg'+d);DcxTree.zcbMsg.attr("EntId",e);DcxTree.zcbMsg.attr("FieldName",f);if(DcxTree.zcb.attr("isNotFirstTime")!="1"){$(document).mouseup(function(a){var b=$(a.target);if(!Dcx.wsj(b,DcxTree.zcb.attr("id"),20))DcxTree.zcb.hide()});DcxTree.zcb.attr("isNotFirstTime","1")}}
DcxTree.ShowDialogLf=mdk;function bjv(a,b,c,d,e,f,g,h,i){var a=DcxTree.zcb.attr("LastEntId");var j=DcxTree.zcb.attr("LastFieldName");igj(DcxTree.$rowObj);DcxTree.$targetObj.val(g);var k=wyb(DcxTree.$targetObj);k.val(f);if(!ymr(DcxTree.$targetObj)&&DcxTree.$targetObj.length>0){try{DcxTree.$targetObj.blur()}catch(err){}}
try{DcxTree.$targetObj.keyup()}catch(err){}
DcxTree.zcb.hide();if(!ymr(DcxTree.$targetObj)&&DcxTree.$targetObj.length>0){try{DcxTree.$targetObj.change();DcxTree.$targetObj.focus()}catch(err){}
DcxTree.zcb.hide()}}
DcxTree.GetNodeValueLf=bjv;