博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zTree树
阅读量:5128 次
发布时间:2019-06-13

本文共 122098 字,大约阅读时间需要 406 分钟。

 

 

 

     

    var tree_str = (eval(treeData.deptTreeData)).replace('"isleader"','isleader').replace('"core_user_id"','core_user_id').replace('"name"','name').replace('"pId"','pId').replace('"id"','id').replace('"ispost"','ispost').replace('"open"','open').replace('"iconSkin"','iconSkin');            var zNodes = eval(tree_str);            //zTree点击事件            function zTreeOnClick(event, treeId, treeNode) {                //确认框                currentClickedNode = treeNode.tId;                var treeObj = $.fn.zTree.getZTreeObj("deptTree");                var node = treeObj.getNodeByTId(currentClickedNode);                                $scope.assistDept = node.id;                $scope.assistDeptName = node.name;                $('#assist_dept').val(node.id);                $('#assist_dept_name').val(node.name);                                $scope.assister = "";                $scope.assisterName = "";                $('#assister').val("");                $('#assister_name').val("");                                $scope.closeModel("assist_dept_modal");            }                        $.fn.zTree.init($("#deptTree"),{data:{simpleData:{enable:true}},callback:{onClick:zTreeOnClick}},zNodes);

     

     

    [  {    "isleader": 0,    "core_user_id": "",    "name": "摩贝(上海)生物科技有限公司",    "pId": 0,    "id": 1,    "ispost": 1,    "open": true  },  {    "isleader": 1,    "core_user_id": "",    "name": "总部",    "pId": 1,    "id": 2,    "ispost": 1,    "open": true  },  {    "isleader": 0,    "core_user_id": "33",    "name": "运营部",    "pId": 2,    "id": 5,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "129",    "name": "研发部",    "pId": 2,    "id": 6,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "173",    "name": "人事行政部",    "pId": 2,    "id": 9,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "173",    "name": "财务部",    "pId": 2,    "id": 10,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "销售副总监",    "pId": 187,    "id": 13,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "采购副总监",    "pId": 16,    "id": 14,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "采购组",    "pId": 133,    "id": 16,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "内容运营部",    "pId": 5,    "id": 17,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "翼组",    "pId": 187,    "id": 18,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "风组",    "pId": 187,    "id": 19,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "勤组",    "pId": 187,    "id": 20,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "宇组",    "pId": 187,    "id": 21,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "昊组",    "pId": 187,    "id": 22,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "轩组",    "pId": 187,    "id": 23,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "睿组",    "pId": 538,    "id": 24,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "物流组",    "pId": 133,    "id": 25,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "JAVA组",    "pId": 308,    "id": 28,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品部",    "pId": 6,    "id": 29,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "产品总监",    "pId": 29,    "id": 30,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级产品经理",    "pId": 29,    "id": 31,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "主站PHP",    "pId": 308,    "id": 32,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "商城PHP",    "pId": 308,    "id": 33,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "UED组",    "pId": 6,    "id": 34,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "UED副总监",    "pId": 34,    "id": 35,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "测试组",    "pId": 308,    "id": 37,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "运维组",    "pId": 6,    "id": 38,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "人事副总监",    "pId": 9,    "id": 40,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "行政助理",    "pId": 9,    "id": 41,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "招聘经理",    "pId": 135,    "id": 42,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "采购经理",    "pId": 16,    "id": 43,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "采购助理",    "pId": 16,    "id": 44,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "运营总监",    "pId": 17,    "id": 45,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "数据管理(价格行情)",    "pId": 17,    "id": 46,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "数据分析",    "pId": 17,    "id": 47,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "物流",    "pId": 520,    "id": 48,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "物流专员",    "pId": 48,    "id": 49,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 18,    "id": 50,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 18,    "id": 51,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "移动组",    "pId": 6,    "id": 59,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "资深安卓工程师",    "pId": 59,    "id": 60,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "安卓工程师",    "pId": 59,    "id": 61,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "IOS开发工程师",    "pId": 59,    "id": 62,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "APP测试工程师",    "pId": 59,    "id": 63,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "UI设计师",    "pId": 34,    "id": 64,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "前端工程师",    "pId": 34,    "id": 65,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级测试工程师",    "pId": 37,    "id": 66,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "测试工程师",    "pId": 37,    "id": 67,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级运维工程师",    "pId": 38,    "id": 68,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "运维工程师",    "pId": 38,    "id": 69,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "网络管理员",    "pId": 38,    "id": 70,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "财务总监",    "pId": 10,    "id": 75,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "出纳",    "pId": 452,    "id": 76,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "财务经理资金平台",    "pId": 10,    "id": 77,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "财务主管",    "pId": 452,    "id": 79,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "主站PHPLeader",    "pId": 32,    "id": 80,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "PHP工程师",    "pId": 32,    "id": 81,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "商城PHPleader",    "pId": 33,    "id": 82,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "PHP工程师",    "pId": 33,    "id": 83,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "开发副总监",    "pId": 308,    "id": 84,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 19,    "id": 86,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 19,    "id": 87,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 20,    "id": 88,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 20,    "id": 89,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 21,    "id": 90,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 21,    "id": 91,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 22,    "id": 92,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 22,    "id": 93,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 23,    "id": 94,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 23,    "id": 95,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "商务副总监",    "pId": 24,    "id": 96,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 24,    "id": 97,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "191",    "name": "供应链金融部",    "pId": 2,    "id": 99,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "name": "供应链金融",    "pId": 99,    "id": 100,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "供应链",    "pId": 99,    "id": 101,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "项目经理",    "pId": 426,    "id": 102,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "风控经理",    "pId": 101,    "id": 104,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "风控助理",    "pId": 100,    "id": 106,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "结算主管",    "pId": 100,    "id": 107,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "贷后催收",    "pId": 100,    "id": 108,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "运营",    "pId": 5,    "id": 109,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "SEM专员",    "pId": 474,    "id": 110,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "BI数据分析",    "pId": 109,    "id": 112,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级SEO经理",    "pId": 474,    "id": 116,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "凡组",    "pId": 187,    "id": 121,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 121,    "id": 122,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "销售副总监",    "pId": 121,    "id": 123,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "实习生",    "pId": 16,    "id": 124,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品助理",    "pId": 29,    "id": 127,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "VP",    "pId": 6,    "id": 131,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "174",    "name": "商务部",    "pId": 2,    "id": 133,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "173",    "name": "人力资源部",    "pId": 2,    "id": 135,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "合伙人助理",    "pId": 133,    "id": 137,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "国际事业部",    "pId": 133,    "id": 139,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "战略采购副总监",    "pId": 139,    "id": 141,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "往来会计",    "pId": 452,    "id": 153,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "成本会计",    "pId": 452,    "id": 155,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "财务助理",    "pId": 77,    "id": 157,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "交互设计师",    "pId": 34,    "id": 161,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "人力资源部总监",    "pId": 135,    "id": 165,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "薪酬经理",    "pId": 135,    "id": 169,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品经理",    "pId": 29,    "id": 177,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "招聘主管",    "pId": 135,    "id": 179,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品副总监",    "pId": 29,    "id": 181,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "外贸经理",    "pId": 139,    "id": 183,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "地推",    "pId": 133,    "id": 187,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "CORE",    "pId": 2,    "id": 189,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "单据组",    "pId": 10,    "id": 191,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "商务专员",    "pId": 191,    "id": 193,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "顺组",    "pId": 133,    "id": 195,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 195,    "id": 197,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 195,    "id": 199,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售助理",    "pId": 195,    "id": 201,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "擎组",    "pId": 187,    "id": 203,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级商务经理",    "pId": 203,    "id": 205,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "化工资讯",    "pId": 17,    "id": 207,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "化工资讯高级经理",    "pId": 207,    "id": 213,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "化工资讯专员",    "pId": 207,    "id": 215,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "化学品订制项目经理",    "pId": 538,    "id": 221,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 203,    "id": 229,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "法务",    "pId": 10,    "id": 249,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "法务经理",    "pId": 249,    "id": 251,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "人力资源实习生",    "pId": 135,    "id": 255,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "首席战略官",    "pId": 5,    "id": 260,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品经理",    "pId": 101,    "id": 262,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "火组",    "pId": 187,    "id": 266,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "火组负责人",    "pId": 266,    "id": 268,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "火组成员",    "pId": 266,    "id": 270,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "鸣组",    "pId": 187,    "id": 272,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "鸣组负责人",    "pId": 272,    "id": 274,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "鸣组成员",    "pId": 272,    "id": 276,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "奉组",    "pId": 187,    "id": 278,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "奉组负责人",    "pId": 278,    "id": 280,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "奉组成员",    "pId": 278,    "id": 282,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "朗组",    "pId": 187,    "id": 284,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "朗组负责人",    "pId": 284,    "id": 286,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "朗组成员",    "pId": 284,    "id": 288,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "研发",    "pId": 6,    "id": 308,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "涂料事业部",    "pId": 386,    "id": 320,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "平面设计",    "pId": 328,    "id": 322,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "文案策划 ",    "pId": 328,    "id": 326,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "平台运营",    "pId": 5,    "id": 328,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "平台运营总监",    "pId": 328,    "id": 330,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "涂料事业部经理",    "pId": 320,    "id": 336,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 320,    "id": 338,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "运营经理",    "pId": 328,    "id": 344,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "法务助理",    "pId": 249,    "id": 346,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品营销经理",    "pId": 320,    "id": 348,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 139,    "id": 350,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "大宗溶剂事业部",    "pId": 386,    "id": 360,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "大宗事业部负责人",    "pId": 360,    "id": 364,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "大宗事业部成员",    "pId": 360,    "id": 366,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "大宗无机事业部",    "pId": 386,    "id": 370,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "大宗无机事业部负责人",    "pId": 370,    "id": 372,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "测试",    "pId": 29,    "id": 374,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "测试1",    "pId": 374,    "id": 376,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "测试2",    "pId": 374,    "id": 378,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级人力资源经理",    "pId": 135,    "id": 380,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "事业部",    "pId": 133,    "id": 386,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "事业部负责人",    "pId": 386,    "id": 388,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "香精香料事业部",    "pId": 386,    "id": 392,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "医药事业部",    "pId": 386,    "id": 394,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "大宗无机事业部成员",    "pId": 370,    "id": 402,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "橡塑事业部2",    "pId": 386,    "id": 404,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "橡塑事业部1",    "pId": 386,    "id": 406,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "农药中间体事业部",    "pId": 386,    "id": 410,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品经理",    "pId": 410,    "id": 412,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "农药中间体事业部总经理",    "pId": 410,    "id": 414,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "溶剂油事业部",    "pId": 386,    "id": 422,    "ispost": 1,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "副经理",    "pId": 422,    "id": 424,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "项目",    "pId": 101,    "id": 426,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级项目经理",    "pId": 426,    "id": 428,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "项目助理",    "pId": 426,    "id": 430,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "副总监",    "pId": 101,    "id": 432,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "总监",    "pId": 100,    "id": 434,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "PHP CRM组",    "pId": 308,    "id": 436,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "PHP CRM组组长",    "pId": 436,    "id": 438,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "PHP CRM组组员",    "pId": 436,    "id": 440,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "PHP 运营组",    "pId": 308,    "id": 442,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "PHP运营组组长",    "pId": 442,    "id": 444,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "PHP 运营组组员",    "pId": 442,    "id": 446,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "财务经理",    "pId": 77,    "id": 448,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "出纳",    "pId": 77,    "id": 450,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "财务经理报表汇总",    "pId": 10,    "id": 452,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "财务经理",    "pId": 452,    "id": 454,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "财务专员",    "pId": 452,    "id": 456,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "单据组组长",    "pId": 191,    "id": 458,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "财务专员",    "pId": 191,    "id": 460,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "合同制作",    "pId": 191,    "id": 462,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "客户经理",    "pId": 462,    "id": 464,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "客户助理",    "pId": 462,    "id": 466,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售助理",    "pId": 191,    "id": 468,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "商务专员",    "pId": 328,    "id": 470,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "运营总监",    "pId": 109,    "id": 472,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售组",    "pId": 109,    "id": 474,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级销售经理",    "pId": 474,    "id": 476,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售代表",    "pId": 474,    "id": 478,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "客户经理",    "pId": 474,    "id": 480,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "客户经理",    "pId": 474,    "id": 482,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "商城客户组",    "pId": 109,    "id": 484,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级客户经理",    "pId": 484,    "id": 486,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "商城运营专员",    "pId": 484,    "id": 488,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "试剂外贸专员",    "pId": 484,    "id": 490,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "商城客户代表",    "pId": 484,    "id": 492,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "运营客户",    "pId": 109,    "id": 494,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级客户经理",    "pId": 494,    "id": 496,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "客户专员",    "pId": 494,    "id": 498,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "广告销售",    "pId": 109,    "id": 500,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级市场",    "pId": 5,    "id": 502,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级市场经理",    "pId": 502,    "id": 504,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "活动经理",    "pId": 502,    "id": 506,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "市场专员",    "pId": 502,    "id": 508,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级采购",    "pId": 16,    "id": 510,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级采购经理",    "pId": 510,    "id": 512,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "采购专员",    "pId": 510,    "id": 516,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "供应链总监",    "pId": 25,    "id": 518,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级物流",    "pId": 25,    "id": 520,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级物流经理",    "pId": 520,    "id": 522,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "物流主管",    "pId": 48,    "id": 524,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "客户经理",    "pId": 139,    "id": 526,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "外联组",    "pId": 133,    "id": 528,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "销售总监",    "pId": 528,    "id": 530,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "高级销售经理",    "pId": 528,    "id": 532,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售副总监",    "pId": 528,    "id": 534,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售经理",    "pId": 528,    "id": 536,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "试剂事业部",    "pId": 133,    "id": 538,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "销售副总监",    "pId": 538,    "id": 540,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "统筹经理",    "pId": 538,    "id": 542,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "试剂采购",    "pId": 538,    "id": 544,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "高级采购经理",    "pId": 544,    "id": 546,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "采购成员",    "pId": 544,    "id": 548,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售客服经理",    "pId": 538,    "id": 550,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "销售助理",    "pId": 538,    "id": 552,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "醇钠事业部",    "pId": 386,    "id": 554,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "总经理",    "pId": 554,    "id": 556,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "产品经理",    "pId": 554,    "id": 558,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "甘油事业部",    "pId": 386,    "id": 560,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "甘油事业部负责人",    "pId": 560,    "id": 562,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "甘油事业部成员",    "pId": 560,    "id": 564,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "胶黏剂事业部",    "pId": 386,    "id": 566,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "胶黏剂事业部负责人",    "pId": 566,    "id": 568,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "胶黏剂事业部成员",    "pId": 566,    "id": 570,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "氯碱事业部",    "pId": 386,    "id": 572,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "氯碱事业部负责人",    "pId": 572,    "id": 574,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "氯碱事业部成员",    "pId": 572,    "id": 576,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "总经理",    "pId": 422,    "id": 578,    "ispost": 2,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "橡塑事业部2副经理",    "pId": 404,    "id": 580,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "橡塑事业部2成员",    "pId": 404,    "id": 582,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "电子化学事业部",    "pId": 386,    "id": 584,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "电子化学事业部总经理",    "pId": 584,    "id": 586,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "电子化学事业部成员",    "pId": 584,    "id": 588,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "食品添加剂事业部",    "pId": 386,    "id": 590,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "食品添加剂事业部总经理",    "pId": 590,    "id": 592,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "食品添加剂事业部成员",    "pId": 590,    "id": 594,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "总裁助理",    "pId": 189,    "id": 596,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "苯事业部",    "pId": 386,    "id": 598,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "苯事业部负责人",    "pId": 598,    "id": 600,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "苯事业部成员",    "pId": 598,    "id": 602,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "表面活性剂事业部",    "pId": 386,    "id": 604,    "ispost": 1,    "open": false  },  {    "isleader": 1,    "core_user_id": "",    "iconSkin": "diy",    "name": "表面活性剂事业部负责人",    "pId": 604,    "id": 606,    "ispost": 2,    "open": false  },  {    "isleader": 0,    "core_user_id": "",    "name": "表面活性剂事业部成员",    "pId": 604,    "id": 608,    "ispost": 2,    "open": false  }]

    metroStyle.css

    /*-------------------------------------zTree Styleversion:    3.4author:     Hunter.zemail:      hunter.z@263.netwebsite:    http://code.google.com/p/jquerytree/-------------------------------------*/.ztree * {
    padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}.ztree {
    margin:0; padding:5px; color:#333}.ztree li{
    padding:0; margin:0; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:0}.ztree li ul{
    margin:0; padding:0 0 0 18px}.ztree li ul.line{
    background:url(./img/line_conn.png) 0 0 repeat-y;}.ztree li a {
    padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; vertical-align:top; display: inline-block}.ztree li a:hover {
    text-decoration:underline}.ztree li a.curSelectedNode {
    padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;}.ztree li a.curSelectedNode_Edit {
    padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;}.ztree li a.tmpTargetNode_inner {
    padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid; opacity:0.8; filter:alpha(opacity=80)}.ztree li a.tmpTargetNode_prev {}.ztree li a.tmpTargetNode_next {}.ztree li a input.rename {
    height:14px; width:80px; padding:0; margin:0; font-size:12px; border:1px #585956 solid; *border:0px}.ztree li span {
    line-height:21px; margin-right:2px}.ztree li span.button {
    line-height:0; margin:0; padding: 0; width:21px; height:21px; display: inline-block; vertical-align:middle; border:0 none; cursor: pointer;outline:none; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}.ztree li span.button.chk {
    width:13px; height:13px; margin:0 2px; cursor: auto}.ztree li span.button.chk.checkbox_false_full {
    background-position: -5px -5px;}.ztree li span.button.chk.checkbox_false_full_focus {
    background-position: -5px -26px;}.ztree li span.button.chk.checkbox_false_part {
    background-position: -5px -48px;}.ztree li span.button.chk.checkbox_false_part_focus {
    background-position: -5px -68px;}.ztree li span.button.chk.checkbox_false_disable {
    background-position: -5px -89px;}.ztree li span.button.chk.checkbox_true_full {
    background-position: -26px -5px;}.ztree li span.button.chk.checkbox_true_full_focus {
    background-position: -26px -26px;}.ztree li span.button.chk.checkbox_true_part {
    background-position: -26px -48px;}.ztree li span.button.chk.checkbox_true_part_focus {
    background-position: -26px -68px;}.ztree li span.button.chk.checkbox_true_disable {
    background-position: -26px -89px;}.ztree li span.button.chk.radio_false_full {
    background-position: -47px -5px;}.ztree li span.button.chk.radio_false_full_focus {
    background-position: -47px -26px;}.ztree li span.button.chk.radio_false_part {
    background-position: -47px -47px;}.ztree li span.button.chk.radio_false_part_focus {
    background-position: -47px -68px;}.ztree li span.button.chk.radio_false_disable {
    background-position: -47px -89px;}.ztree li span.button.chk.radio_true_full {
    background-position: -68px -5px;}.ztree li span.button.chk.radio_true_full_focus {
    background-position: -68px -26px;}.ztree li span.button.chk.radio_true_part {
    background-position: -68px -47px;}.ztree li span.button.chk.radio_true_part_focus {
    background-position: -68px -68px;}.ztree li span.button.chk.radio_true_disable {
    background-position: -68px -89px;}.ztree li span.button.switch {
    width:21px; height:21px}.ztree li span.button.root_open{
    background-position:-105px -63px}.ztree li span.button.root_close{
    background-position:-126px -63px}.ztree li span.button.roots_open{
    background-position: -105px 0;}.ztree li span.button.roots_close{
    background-position: -126px 0;}.ztree li span.button.center_open{
    background-position: -105px -21px;}.ztree li span.button.center_close{
    background-position: -126px -21px;}.ztree li span.button.bottom_open{
    background-position: -105px -42px;}.ztree li span.button.bottom_close{
    background-position: -126px -42px;}.ztree li span.button.noline_open{
    background-position: -105px -84px;}.ztree li span.button.noline_close{
    background-position: -126px -84px;}.ztree li span.button.root_docu{
    background:none;}.ztree li span.button.roots_docu{
    background-position: -84px 0;}.ztree li span.button.center_docu{
    background-position: -84px -21px;}.ztree li span.button.bottom_docu{
    background-position: -84px -42px;}.ztree li span.button.noline_docu{
    background:none;}.ztree li span.button.ico_open{
    margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}.ztree li span.button.ico_close{
    margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}.ztree li span.button.ico_docu{
    margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle}.ztree li span.button.edit {
    margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle}/***���Ӹ�����ͼ��**/.ztree li span.button.diy_ico_docu{
    margin-right:2px; background-position: -23px -64px; vertical-align:top; *vertical-align:middle}.ztree li span.button.edit:hover {
    background-position: -168px -21px;}.ztree li span.button.remove {
    margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle}.ztree li span.button.remove:hover {
    background-position: -168px -42px;}.ztree li span.button.add {
    margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle}.ztree li span.button.add:hover {
    background-position: -168px 0;}.ztree li span.button.ico_loading{
    margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}ul.tmpTargetzTree {
    background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}span.tmpzTreeMove_arrow {
    width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}ul.ztreeul.ztreeDragUL {
    margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}.ztreeMask {
    z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}

    jquery.ztree.core-3.5.js

    /* * JQuery zTree core v3.5.19.1 * http://zTree.me/ * * Copyright (c) 2010 Hunter.z * * Licensed same as jquery - MIT License * http://www.opensource.org/licenses/mit-license.php * * email: hunter.z@263.net * Date: 2015-10-26 */(function($){    var settings = {}, roots = {}, caches = {},    //default consts of core    _consts = {        className: {            BUTTON: "button",            LEVEL: "level",            ICO_LOADING: "ico_loading",            SWITCH: "switch"        },        event: {            NODECREATED: "ztree_nodeCreated",            CLICK: "ztree_click",            EXPAND: "ztree_expand",            COLLAPSE: "ztree_collapse",            ASYNC_SUCCESS: "ztree_async_success",            ASYNC_ERROR: "ztree_async_error",            REMOVE: "ztree_remove",            SELECTED: "ztree_selected",            UNSELECTED: "ztree_unselected"        },        id: {            A: "_a",            ICON: "_ico",            SPAN: "_span",            SWITCH: "_switch",            UL: "_ul"        },        line: {            ROOT: "root",            ROOTS: "roots",            CENTER: "center",            BOTTOM: "bottom",            NOLINE: "noline",            LINE: "line"        },        folder: {            OPEN: "open",            CLOSE: "close",            DOCU: "docu"        },        node: {            CURSELECTED: "curSelectedNode"        }    },    //default setting of core    _setting = {        treeId: "",        treeObj: null,        view: {            addDiyDom: null,            autoCancelSelected: true,            dblClickExpand: true,            expandSpeed: "fast",            fontCss: {},            nameIsHTML: false,            selectedMulti: true,            showIcon: true,            showLine: true,            showTitle: true,            txtSelectedEnable: false        },        data: {            key: {                children: "children",                name: "name",                title: "",                url: "url",                icon: "icon"            },            simpleData: {                enable: false,                idKey: "id",                pIdKey: "pId",                rootPId: null            },            keep: {                parent: false,                leaf: false            }        },        async: {            enable: false,            contentType: "application/x-www-form-urlencoded",            type: "post",            dataType: "text",            url: "",            autoParam: [],            otherParam: [],            dataFilter: null        },        callback: {            beforeAsync:null,            beforeClick:null,            beforeDblClick:null,            beforeRightClick:null,            beforeMouseDown:null,            beforeMouseUp:null,            beforeExpand:null,            beforeCollapse:null,            beforeRemove:null,            onAsyncError:null,            onAsyncSuccess:null,            onNodeCreated:null,            onClick:null,            onDblClick:null,            onRightClick:null,            onMouseDown:null,            onMouseUp:null,            onExpand:null,            onCollapse:null,            onRemove:null        }    },    //default root of core    //zTree use root to save full data    _initRoot = function (setting) {        var r = data.getRoot(setting);        if (!r) {            r = {};            data.setRoot(setting, r);        }        r[setting.data.key.children] = [];        r.expandTriggerFlag = false;        r.curSelectedList = [];        r.noSelection = true;        r.createdNodes = [];        r.zId = 0;        r._ver = (new Date()).getTime();    },    //default cache of core    _initCache = function(setting) {        var c = data.getCache(setting);        if (!c) {            c = {};            data.setCache(setting, c);        }        c.nodes = [];        c.doms = [];    },    //default bindEvent of core    _bindEvent = function(setting) {        var o = setting.treeObj,        c = consts.event;        o.bind(c.NODECREATED, function (event, treeId, node) {            tools.apply(setting.callback.onNodeCreated, [event, treeId, node]);        });        o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) {            tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]);        });        o.bind(c.EXPAND, function (event, treeId, node) {            tools.apply(setting.callback.onExpand, [event, treeId, node]);        });        o.bind(c.COLLAPSE, function (event, treeId, node) {            tools.apply(setting.callback.onCollapse, [event, treeId, node]);        });        o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) {            tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]);        });        o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) {            tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]);        });        o.bind(c.REMOVE, function (event, treeId, treeNode) {            tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);        });        o.bind(c.SELECTED, function (event, treeId, node) {            tools.apply(setting.callback.onSelected, [treeId, node]);        });        o.bind(c.UNSELECTED, function (event, treeId, node) {            tools.apply(setting.callback.onUnSelected, [treeId, node]);        });    },    _unbindEvent = function(setting) {        var o = setting.treeObj,        c = consts.event;        o.unbind(c.NODECREATED)        .unbind(c.CLICK)        .unbind(c.EXPAND)        .unbind(c.COLLAPSE)        .unbind(c.ASYNC_SUCCESS)        .unbind(c.ASYNC_ERROR)        .unbind(c.REMOVE)        .unbind(c.SELECTED)        .unbind(c.UNSELECTED);    },    //default event proxy of core    _eventProxy = function(event) {        var target = event.target,        setting = data.getSetting(event.data.treeId),        tId = "", node = null,        nodeEventType = "", treeEventType = "",        nodeEventCallback = null, treeEventCallback = null,        tmp = null;        if (tools.eqs(event.type, "mousedown")) {            treeEventType = "mousedown";        } else if (tools.eqs(event.type, "mouseup")) {            treeEventType = "mouseup";        } else if (tools.eqs(event.type, "contextmenu")) {            treeEventType = "contextmenu";        } else if (tools.eqs(event.type, "click")) {            if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.SWITCH) !== null) {                tId = tools.getNodeMainDom(target).id;                nodeEventType = "switchNode";            } else {                tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);                if (tmp) {                    tId = tools.getNodeMainDom(tmp).id;                    nodeEventType = "clickNode";                }            }        } else if (tools.eqs(event.type, "dblclick")) {            treeEventType = "dblclick";            tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);            if (tmp) {                tId = tools.getNodeMainDom(tmp).id;                nodeEventType = "switchNode";            }        }        if (treeEventType.length > 0 && tId.length == 0) {            tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);            if (tmp) {tId = tools.getNodeMainDom(tmp).id;}        }        // event to node        if (tId.length>0) {            node = data.getNodeCache(setting, tId);            switch (nodeEventType) {                case "switchNode" :                    if (!node.isParent) {                        nodeEventType = "";                    } else if (tools.eqs(event.type, "click")                        || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) {                        nodeEventCallback = handler.onSwitchNode;                    } else {                        nodeEventType = "";                    }                    break;                case "clickNode" :                    nodeEventCallback = handler.onClickNode;                    break;            }        }        // event to zTree        switch (treeEventType) {            case "mousedown" :                treeEventCallback = handler.onZTreeMousedown;                break;            case "mouseup" :                treeEventCallback = handler.onZTreeMouseup;                break;            case "dblclick" :                treeEventCallback = handler.onZTreeDblclick;                break;            case "contextmenu" :                treeEventCallback = handler.onZTreeContextmenu;                break;        }        var proxyResult = {            stop: false,            node: node,            nodeEventType: nodeEventType,            nodeEventCallback: nodeEventCallback,            treeEventType: treeEventType,            treeEventCallback: treeEventCallback        };        return proxyResult    },    //default init node of core    _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {        if (!n) return;        var r = data.getRoot(setting),        childKey = setting.data.key.children;        n.level = level;        n.tId = setting.treeId + "_" + (++r.zId);        n.parentTId = parentNode ? parentNode.tId : null;        n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open;        if (n[childKey] && n[childKey].length > 0) {            n.isParent = true;            n.zAsync = true;        } else {            n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent;            n.open = (n.isParent && !setting.async.enable) ? n.open : false;            n.zAsync = !n.isParent;        }        n.isFirstNode = isFirstNode;        n.isLastNode = isLastNode;        n.getParentNode = function() {
    return data.getNodeCache(setting, n.parentTId);}; n.getPreNode = function() {
    return data.getPreNode(setting, n);}; n.getNextNode = function() {
    return data.getNextNode(setting, n);}; n.getIndex = function() {
    return data.getNodeIndex(setting, n);}; n.getPath = function() {
    return data.getNodePath(setting, n);}; n.isAjaxing = false; data.fixPIdKeyValue(setting, n); }, _init = { bind: [_bindEvent], unbind: [_unbindEvent], caches: [_initCache], nodes: [_initNode], proxys: [_eventProxy], roots: [_initRoot], beforeA: [], afterA: [], innerBeforeA: [], innerAfterA: [], zTreeTools: [] }, //method of operate data data = { addNodeCache: function(setting, node) { data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node; }, getNodeCacheId: function(tId) { return tId.substring(tId.lastIndexOf("_")+1); }, addAfterA: function(afterA) { _init.afterA.push(afterA); }, addBeforeA: function(beforeA) { _init.beforeA.push(beforeA); }, addInnerAfterA: function(innerAfterA) { _init.innerAfterA.push(innerAfterA); }, addInnerBeforeA: function(innerBeforeA) { _init.innerBeforeA.push(innerBeforeA); }, addInitBind: function(bindEvent) { _init.bind.push(bindEvent); }, addInitUnBind: function(unbindEvent) { _init.unbind.push(unbindEvent); }, addInitCache: function(initCache) { _init.caches.push(initCache); }, addInitNode: function(initNode) { _init.nodes.push(initNode); }, addInitProxy: function(initProxy, isFirst) { if (!!isFirst) { _init.proxys.splice(0,0,initProxy); } else { _init.proxys.push(initProxy); } }, addInitRoot: function(initRoot) { _init.roots.push(initRoot); }, addNodesData: function(setting, parentNode, index, nodes) { var childKey = setting.data.key.children, params; if (!parentNode[childKey]) { parentNode[childKey] = []; index = -1; } else if (index >= parentNode[childKey].length) { index = -1; } if (parentNode[childKey].length > 0 && index === 0) { parentNode[childKey][0].isFirstNode = false; view.setNodeLineIcos(setting, parentNode[childKey][0]); } else if (parentNode[childKey].length > 0 && index < 0) { parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false; view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]); } parentNode.isParent = true; if (index<0) { parentNode[childKey] = parentNode[childKey].concat(nodes); } else { params = [index, 0].concat(nodes); parentNode[childKey].splice.apply(parentNode[childKey], params); } }, addSelectedNode: function(setting, node) { var root = data.getRoot(setting); if (!data.isSelectedNode(setting, node)) { root.curSelectedList.push(node); } }, addCreatedNode: function(setting, node) { if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { var root = data.getRoot(setting); root.createdNodes.push(node); } }, addZTreeTools: function(zTreeTools) { _init.zTreeTools.push(zTreeTools); }, exSetting: function(s) { $.extend(true, _setting, s); }, fixPIdKeyValue: function(setting, node) { if (setting.data.simpleData.enable) { node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId; } }, getAfterA: function(setting, node, array) { for (var i=0, j=_init.afterA.length; i
    -1) { result.push(nodes[i]); } result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value)); } return result; }, getNodesByFilter: function(setting, nodes, filter, isSingle, invokeParam) { if (!nodes) return (isSingle ? null : []); var childKey = setting.data.key.children, result = isSingle ? null : []; for (var i = 0, l = nodes.length; i < l; i++) { if (tools.apply(filter, [nodes[i], invokeParam], false)) { if (isSingle) {
    return nodes[i];} result.push(nodes[i]); } var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam); if (isSingle && !!tmpResult) {
    return tmpResult;} result = isSingle ? tmpResult : result.concat(tmpResult); } return result; }, getPreNode: function(setting, node) { if (!node) return null; var childKey = setting.data.key.children, p = node.parentTId ? node.getParentNode() : data.getRoot(setting); for (var i=0, l=p[childKey].length; i
    0))); }, clone: function (obj){ if (obj === null) return null; var o = tools.isArray(obj) ? [] : {}; for(var i in obj){ o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? arguments.callee(obj[i]) : obj[i]); } return o; }, eqs: function(str1, str2) { return str1.toLowerCase() === str2.toLowerCase(); }, isArray: function(arr) { return Object.prototype.toString.apply(arr) === "[object Array]"; }, $: function(node, exp, setting) { if (!!exp && typeof exp != "string") { setting = exp; exp = ""; } if (typeof node == "string") { return $(node, setting ? setting.treeObj.get(0).ownerDocument : null); } else { return $("#" + node.tId + exp, setting ? setting.treeObj : null); } }, getMDom: function (setting, curDom, targetExpr) { if (!curDom) return null; while (curDom && curDom.id !== setting.treeId) { for (var i=0, l=targetExpr.length; curDom.tagName && i
    0 ); }, uCanDo: function(setting, e) { return true; } }, //method of operate ztree dom view = { addNodes: function(setting, parentNode, index, newNodes, isSilent) { if (setting.data.keep.leaf && parentNode && !parentNode.isParent) { return; } if (!tools.isArray(newNodes)) { newNodes = [newNodes]; } if (setting.data.simpleData.enable) { newNodes = data.transformTozTreeFormat(setting, newNodes); } if (parentNode) { var target_switchObj = $$(parentNode, consts.id.SWITCH, setting), target_icoObj = $$(parentNode, consts.id.ICON, setting), target_ulObj = $$(parentNode, consts.id.UL, setting); if (!parentNode.open) { view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE); view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE); parentNode.open = false; target_ulObj.css({ "display": "none" }); } data.addNodesData(setting, parentNode, index, newNodes); view.createNodes(setting, parentNode.level + 1, newNodes, parentNode, index); if (!isSilent) { view.expandCollapseParentNode(setting, parentNode, true); } } else { data.addNodesData(setting, data.getRoot(setting), index, newNodes); view.createNodes(setting, 0, newNodes, null, index); } }, appendNodes: function(setting, level, nodes, parentNode, index, initFlag, openFlag) { if (!nodes) return []; var html = [], childKey = setting.data.key.children; var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting), tmpPChild = tmpPNode[childKey], isFirstNode, isLastNode; if (!tmpPChild || index >= tmpPChild.length) { index = -1; } for (var i = 0, l = nodes.length; i < l; i++) { var node = nodes[i]; if (initFlag) { isFirstNode = ((index===0 || tmpPChild.length == nodes.length) && (i == 0)); isLastNode = (index < 0 && i == (nodes.length - 1)); data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag); data.addNodeCache(setting, node); } var childHtml = []; if (node[childKey] && node[childKey].length > 0) { //make child html first, because checkType childHtml = view.appendNodes(setting, level + 1, node[childKey], node, -1, initFlag, openFlag && node.open); } if (openFlag) { view.makeDOMNodeMainBefore(html, setting, node); view.makeDOMNodeLine(html, setting, node); data.getBeforeA(setting, node, html); view.makeDOMNodeNameBefore(html, setting, node); data.getInnerBeforeA(setting, node, html); view.makeDOMNodeIcon(html, setting, node); data.getInnerAfterA(setting, node, html); view.makeDOMNodeNameAfter(html, setting, node); data.getAfterA(setting, node, html); if (node.isParent && node.open) { view.makeUlHtml(setting, node, html, childHtml.join('')); } view.makeDOMNodeMainAfter(html, setting, node); data.addCreatedNode(setting, node); } } return html; }, appendParentULDom: function(setting, node) { var html = [], nObj = $$(node, setting); if (!nObj.get(0) && !!node.parentTId) { view.appendParentULDom(setting, node.getParentNode()); nObj = $$(node, setting); } var ulObj = $$(node, consts.id.UL, setting); if (ulObj.get(0)) { ulObj.remove(); } var childKey = setting.data.key.children, childHtml = view.appendNodes(setting, node.level+1, node[childKey], node, -1, false, true); view.makeUlHtml(setting, node, html, childHtml.join('')); nObj.append(html.join('')); }, asyncNode: function(setting, node, isSilent, callback) { var i, l; if (node && !node.isParent) { tools.apply(callback); return false; } else if (node && node.isAjaxing) { return false; } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) { tools.apply(callback); return false; } if (node) { node.isAjaxing = true; var icoObj = $$(node, consts.id.ICON, setting); icoObj.attr({
    "style":"", "class":consts.className.BUTTON + " " + consts.className.ICO_LOADING}); } var tmpParam = {}; for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) { var pKey = setting.async.autoParam[i].split("="), spKey = pKey; if (pKey.length>1) { spKey = pKey[1]; pKey = pKey[0]; } tmpParam[spKey] = node[pKey]; } if (tools.isArray(setting.async.otherParam)) { for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) { tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1]; } } else { for (var p in setting.async.otherParam) { tmpParam[p] = setting.async.otherParam[p]; } } var _tmpV = data.getRoot(setting)._ver; $.ajax({ contentType: setting.async.contentType, cache: false, type: setting.async.type, url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url), data: tmpParam, dataType: setting.async.dataType, success: function(msg) { if (_tmpV != data.getRoot(setting)._ver) { return; } var newNodes = []; try { if (!msg || msg.length == 0) { newNodes = []; } else if (typeof msg == "string") { newNodes = eval("(" + msg + ")"); } else { newNodes = msg; } } catch(err) { newNodes = msg; } if (node) { node.isAjaxing = null; node.zAsync = true; } view.setNodeLineIcos(setting, node); if (newNodes && newNodes !== "") { newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes); view.addNodes(setting, node, -1, !!newNodes ? tools.clone(newNodes) : [], !!isSilent); } else { view.addNodes(setting, node, -1, [], !!isSilent); } setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]); tools.apply(callback); }, error: function(XMLHttpRequest, textStatus, errorThrown) { if (_tmpV != data.getRoot(setting)._ver) { return; } if (node) node.isAjaxing = null; view.setNodeLineIcos(setting, node); setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]); } }); return true; }, cancelPreSelectedNode: function (setting, node, excludeNode) { var list = data.getRoot(setting).curSelectedList, i, n; for (i=list.length-1; i>=0; i--) { n = list[i]; if (node === n || (!node && (!excludeNode || excludeNode !== n))) { $$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED); if (node) { data.removeSelectedNode(setting, node); break; } else { list.splice(i, 1); setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]); } } } }, createNodeCallback: function(setting) { if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { var root = data.getRoot(setting); while (root.createdNodes.length>0) { var node = root.createdNodes.shift(); tools.apply(setting.view.addDiyDom, [setting.treeId, node]); if (!!setting.callback.onNodeCreated) { setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]); } } } }, createNodes: function(setting, level, nodes, parentNode, index) { if (!nodes || nodes.length == 0) return; var root = data.getRoot(setting), childKey = setting.data.key.children, openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0); root.createdNodes = []; var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, index, true, openFlag), parentObj, nextObj; if (!parentNode) { parentObj = setting.treeObj; //setting.treeObj.append(zTreeHtml.join('')); } else { var ulObj = $$(parentNode, consts.id.UL, setting); if (ulObj.get(0)) { parentObj = ulObj; //ulObj.append(zTreeHtml.join('')); } } if (parentObj) { if (index >= 0) { nextObj = parentObj.children()[index]; } if (index >=0 && nextObj) { $(nextObj).before(zTreeHtml.join('')); } else { parentObj.append(zTreeHtml.join('')); } } view.createNodeCallback(setting); }, destroy: function(setting) { if (!setting) return; data.initCache(setting); data.initRoot(setting); event.unbindTree(setting); event.unbindEvent(setting); setting.treeObj.empty(); delete settings[setting.treeId]; }, expandCollapseNode: function(setting, node, expandFlag, animateFlag, callback) { var root = data.getRoot(setting), childKey = setting.data.key.children; if (!node) { tools.apply(callback, []); return; } if (root.expandTriggerFlag) { var _callback = callback; callback = function(){ if (_callback) _callback(); if (node.open) { setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]); } else { setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]); } }; root.expandTriggerFlag = false; } if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length>0 && !$$(node[childKey][0], setting).get(0)))) { view.appendParentULDom(setting, node); view.createNodeCallback(setting); } if (node.open == expandFlag) { tools.apply(callback, []); return; } var ulObj = $$(node, consts.id.UL, setting), switchObj = $$(node, consts.id.SWITCH, setting), icoObj = $$(node, consts.id.ICON, setting); if (node.isParent) { node.open = !node.open; if (node.iconOpen && node.iconClose) { icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); } if (node.open) { view.replaceSwitchClass(node, switchObj, consts.folder.OPEN); view.replaceIcoClass(node, icoObj, consts.folder.OPEN); if (animateFlag == false || setting.view.expandSpeed == "") { ulObj.show(); tools.apply(callback, []); } else { if (node[childKey] && node[childKey].length > 0) { ulObj.slideDown(setting.view.expandSpeed, callback); } else { ulObj.show(); tools.apply(callback, []); } } } else { view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE); view.replaceIcoClass(node, icoObj, consts.folder.CLOSE); if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) { ulObj.hide(); tools.apply(callback, []); } else { ulObj.slideUp(setting.view.expandSpeed, callback); } } } else { tools.apply(callback, []); } }, expandCollapseParentNode: function(setting, node, expandFlag, animateFlag, callback) { if (!node) return; if (!node.parentTId) { view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback); return; } else { view.expandCollapseNode(setting, node, expandFlag, animateFlag); } if (node.parentTId) { view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback); } }, expandCollapseSonNode: function(setting, node, expandFlag, animateFlag, callback) { var root = data.getRoot(setting), childKey = setting.data.key.children, treeNodes = (node) ? node[childKey]: root[childKey], selfAnimateSign = (node) ? false : animateFlag, expandTriggerFlag = data.getRoot(setting).expandTriggerFlag; data.getRoot(setting).expandTriggerFlag = false; if (treeNodes) { for (var i = 0, l = treeNodes.length; i < l; i++) { if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign); } } data.getRoot(setting).expandTriggerFlag = expandTriggerFlag; view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback ); }, isSelectedNode: function (setting, node) { if (!node) { return false; } var list = data.getRoot(setting).curSelectedList, i; for (i=list.length-1; i>=0; i--) { if (node === list[i]) { return true; } } return false; }, makeDOMNodeIcon: function(html, setting, node) { var nameStr = data.getNodeName(setting, node), name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g,'&').replace(//g,'>'); html.push("
    ",name,""); }, makeDOMNodeLine: function(html, setting, node) { html.push("
    "); }, makeDOMNodeMainAfter: function(html, setting, node) { html.push(""); }, makeDOMNodeMainBefore: function(html, setting, node) { html.push("
  • "); }, makeDOMNodeNameAfter: function(html, setting, node) { html.push(""); }, makeDOMNodeNameBefore: function(html, setting, node) { var title = data.getNodeTitle(setting, node), url = view.makeNodeUrl(setting, node), fontcss = view.makeNodeFontCss(setting, node), fontStyle = []; for (var f in fontcss) { fontStyle.push(f, ":", fontcss[f], ";"); } html.push(" 0) ? "href='" + url + "'" : ""), " target='",view.makeNodeTarget(node),"' style='", fontStyle.join(''), "'"); if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {html.push("title='", title.replace(/'/g,"'").replace(//g,'>'),"'");} html.push(">"); }, makeNodeFontCss: function(setting, node) { var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss); return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {}; }, makeNodeIcoClass: function(setting, node) { var icoCss = ["ico"]; if (!node.isAjaxing) { icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0]; if (node.isParent) { icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); } else { icoCss.push(consts.folder.DOCU); } } return consts.className.BUTTON + " " + icoCss.join('_'); }, makeNodeIcoStyle: function(setting, node) { var icoStyle = []; if (!node.isAjaxing) { var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node[setting.data.key.icon]; if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;"); if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) { icoStyle.push("width:0px;height:0px;"); } } return icoStyle.join(''); }, makeNodeLineClass: function(setting, node) { var lineClass = []; if (setting.view.showLine) { if (node.level == 0 && node.isFirstNode && node.isLastNode) { lineClass.push(consts.line.ROOT); } else if (node.level == 0 && node.isFirstNode) { lineClass.push(consts.line.ROOTS); } else if (node.isLastNode) { lineClass.push(consts.line.BOTTOM); } else { lineClass.push(consts.line.CENTER); } } else { lineClass.push(consts.line.NOLINE); } if (node.isParent) { lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); } else { lineClass.push(consts.folder.DOCU); } return view.makeNodeLineClassEx(node) + lineClass.join('_'); }, makeNodeLineClassEx: function(node) { return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " "; }, makeNodeTarget: function(node) { return (node.target || "_blank"); }, makeNodeUrl: function(setting, node) { var urlKey = setting.data.key.url; return node[urlKey] ? node[urlKey] : null; }, makeUlHtml: function(setting, node, html, content) { html.push("
      "); html.push(content); html.push("
    "); }, makeUlLineClass: function(setting, node) { return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : ""); }, removeChildNodes: function(setting, node) { if (!node) return; var childKey = setting.data.key.children, nodes = node[childKey]; if (!nodes) return; for (var i = 0, l = nodes.length; i < l; i++) { data.removeNodeCache(setting, nodes[i]); } data.removeSelectedNode(setting); delete node[childKey]; if (!setting.data.keep.parent) { node.isParent = false; node.open = false; var tmp_switchObj = $$(node, consts.id.SWITCH, setting), tmp_icoObj = $$(node, consts.id.ICON, setting); view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU); view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU); $$(node, consts.id.UL, setting).remove(); } else { $$(node, consts.id.UL, setting).empty(); } }, setFirstNode: function(setting, parentNode) { var childKey = setting.data.key.children, childLength = parentNode[childKey].length; if ( childLength > 0) { parentNode[childKey][0].isFirstNode = true; } }, setLastNode: function(setting, parentNode) { var childKey = setting.data.key.children, childLength = parentNode[childKey].length; if ( childLength > 0) { parentNode[childKey][childLength - 1].isLastNode = true; } }, removeNode: function(setting, node) { var root = data.getRoot(setting), childKey = setting.data.key.children, parentNode = (node.parentTId) ? node.getParentNode() : root; node.isFirstNode = false; node.isLastNode = false; node.getPreNode = function() {
    return null;}; node.getNextNode = function() {
    return null;}; if (!data.getNodeCache(setting, node.tId)) { return; } $$(node, setting).remove(); data.removeNodeCache(setting, node); data.removeSelectedNode(setting, node); for (var i = 0, l = parentNode[childKey].length; i < l; i++) { if (parentNode[childKey][i].tId == node.tId) { parentNode[childKey].splice(i, 1); break; } } view.setFirstNode(setting, parentNode); view.setLastNode(setting, parentNode); var tmp_ulObj,tmp_switchObj,tmp_icoObj, childLength = parentNode[childKey].length; //repair nodes old parent if (!setting.data.keep.parent && childLength == 0) { //old parentNode has no child nodes parentNode.isParent = false; parentNode.open = false; tmp_ulObj = $$(parentNode, consts.id.UL, setting); tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting); tmp_icoObj = $$(parentNode, consts.id.ICON, setting); view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU); view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU); tmp_ulObj.css("display", "none"); } else if (setting.view.showLine && childLength > 0) { //old parentNode has child nodes var newLast = parentNode[childKey][childLength - 1]; tmp_ulObj = $$(newLast, consts.id.UL, setting); tmp_switchObj = $$(newLast, consts.id.SWITCH, setting); tmp_icoObj = $$(newLast, consts.id.ICON, setting); if (parentNode == root) { if (parentNode[childKey].length == 1) { //node was root, and ztree has only one root after move node view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT); } else { var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting); view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS); view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); } } else { view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); } tmp_ulObj.removeClass(consts.line.LINE); } }, replaceIcoClass: function(node, obj, newName) { if (!obj || node.isAjaxing) return; var tmpName = obj.attr("class"); if (tmpName == undefined) return; var tmpList = tmpName.split("_"); switch (newName) { case consts.folder.OPEN: case consts.folder.CLOSE: case consts.folder.DOCU: tmpList[tmpList.length-1] = newName; break; } obj.attr("class", tmpList.join("_")); }, replaceSwitchClass: function(node, obj, newName) { if (!obj) return; var tmpName = obj.attr("class"); if (tmpName == undefined) return; var tmpList = tmpName.split("_"); switch (newName) { case consts.line.ROOT: case consts.line.ROOTS: case consts.line.CENTER: case consts.line.BOTTOM: case consts.line.NOLINE: tmpList[0] = view.makeNodeLineClassEx(node) + newName; break; case consts.folder.OPEN: case consts.folder.CLOSE: case consts.folder.DOCU: tmpList[1] = newName; break; } obj.attr("class", tmpList.join("_")); if (newName !== consts.folder.DOCU) { obj.removeAttr("disabled"); } else { obj.attr("disabled", "disabled"); } }, selectNode: function(setting, node, addFlag) { if (!addFlag) { view.cancelPreSelectedNode(setting, null, node); } $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED); data.addSelectedNode(setting, node); setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]); }, setNodeFontCss: function(setting, treeNode) { var aObj = $$(treeNode, consts.id.A, setting), fontCss = view.makeNodeFontCss(setting, treeNode); if (fontCss) { aObj.css(fontCss); } }, setNodeLineIcos: function(setting, node) { if (!node) return; var switchObj = $$(node, consts.id.SWITCH, setting), ulObj = $$(node, consts.id.UL, setting), icoObj = $$(node, consts.id.ICON, setting), ulLine = view.makeUlLineClass(setting, node); if (ulLine.length==0) { ulObj.removeClass(consts.line.LINE); } else { ulObj.addClass(ulLine); } switchObj.attr("class", view.makeNodeLineClass(setting, node)); if (node.isParent) { switchObj.removeAttr("disabled"); } else { switchObj.attr("disabled", "disabled"); } icoObj.removeAttr("style"); icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); icoObj.attr("class", view.makeNodeIcoClass(setting, node)); }, setNodeName: function(setting, node) { var title = data.getNodeTitle(setting, node), nObj = $$(node, consts.id.SPAN, setting); nObj.empty(); if (setting.view.nameIsHTML) { nObj.html(data.getNodeName(setting, node)); } else { nObj.text(data.getNodeName(setting, node)); } if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) { var aObj = $$(node, consts.id.A, setting); aObj.attr("title", !title ? "" : title); } }, setNodeTarget: function(setting, node) { var aObj = $$(node, consts.id.A, setting); aObj.attr("target", view.makeNodeTarget(node)); }, setNodeUrl: function(setting, node) { var aObj = $$(node, consts.id.A, setting), url = view.makeNodeUrl(setting, node); if (url == null || url.length == 0) { aObj.removeAttr("href"); } else { aObj.attr("href", url); } }, switchNode: function(setting, node) { if (node.open || !tools.canAsync(setting, node)) { view.expandCollapseNode(setting, node, !node.open); } else if (setting.async.enable) { if (!view.asyncNode(setting, node)) { view.expandCollapseNode(setting, node, !node.open); return; } } else if (node) { view.expandCollapseNode(setting, node, !node.open); } } }; // zTree defind $.fn.zTree = { consts : _consts, _z : { tools: tools, view: view, event: event, data: data }, getZTreeObj: function(treeId) { var o = data.getZTreeTools(treeId); return o ? o : null; }, destroy: function(treeId) { if (!!treeId && treeId.length > 0) { view.destroy(data.getSetting(treeId)); } else { for(var s in settings) { view.destroy(settings[s]); } } }, init: function(obj, zSetting, zNodes) { var setting = tools.clone(_setting); $.extend(true, setting, zSetting); setting.treeId = obj.attr("id"); setting.treeObj = obj; setting.treeObj.empty(); settings[setting.treeId] = setting; //For some older browser,(e.g., ie6) if(typeof document.body.style.maxHeight === "undefined") { setting.view.expandSpeed = ""; } data.initRoot(setting); var root = data.getRoot(setting), childKey = setting.data.key.children; zNodes = zNodes ? tools.clone(tools.isArray(zNodes)? zNodes : [zNodes]) : []; if (setting.data.simpleData.enable) { root[childKey] = data.transformTozTreeFormat(setting, zNodes); } else { root[childKey] = zNodes; } data.initCache(setting); event.unbindTree(setting); event.bindTree(setting); event.unbindEvent(setting); event.bindEvent(setting); var zTreeTools = { setting : setting, addNodes : function(parentNode, index, newNodes, isSilent) { if (!parentNode) parentNode = null; if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null; var i = parseInt(index, 10); if (isNaN(i)) { isSilent = !!newNodes; newNodes = index; index = -1; } else { index = i; } if (!newNodes) return null; var xNewNodes = tools.clone(tools.isArray(newNodes)? newNodes: [newNodes]); function addCallback() { view.addNodes(setting, parentNode, index, xNewNodes, (isSilent==true)); } if (tools.canAsync(setting, parentNode)) { view.asyncNode(setting, parentNode, isSilent, addCallback); } else { addCallback(); } return xNewNodes; }, cancelSelectedNode : function(node) { view.cancelPreSelectedNode(setting, node); }, destroy : function() { view.destroy(setting); }, expandAll : function(expandFlag) { expandFlag = !!expandFlag; view.expandCollapseSonNode(setting, null, expandFlag, true); return expandFlag; }, expandNode : function(node, expandFlag, sonSign, focus, callbackFlag) { if (!node || !node.isParent) return null; if (expandFlag !== true && expandFlag !== false) { expandFlag = !node.open; } callbackFlag = !!callbackFlag; if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) { return null; } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) { return null; } if (expandFlag && node.parentTId) { view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false); } if (expandFlag === node.open && !sonSign) { return null; } data.getRoot(setting).expandTriggerFlag = callbackFlag; if (!tools.canAsync(setting, node) && sonSign) { view.expandCollapseSonNode(setting, node, expandFlag, true, function() { if (focus !== false) {
    try{$$(node, setting).focus().blur();}catch(e){}} }); } else { node.open = !expandFlag; view.switchNode(this.setting, node); if (focus !== false) {
    try{$$(node, setting).focus().blur();}catch(e){}} } return expandFlag; }, getNodes : function() { return data.getNodes(setting); }, getNodeByParam : function(key, value, parentNode) { if (!key) return null; return data.getNodeByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value); }, getNodeByTId : function(tId) { return data.getNodeCache(setting, tId); }, getNodesByParam : function(key, value, parentNode) { if (!key) return null; return data.getNodesByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value); }, getNodesByParamFuzzy : function(key, value, parentNode) { if (!key) return null; return data.getNodesByParamFuzzy(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value); }, getNodesByFilter: function(filter, isSingle, parentNode, invokeParam) { isSingle = !!isSingle; if (!filter || (typeof filter != "function")) return (isSingle ? null : []); return data.getNodesByFilter(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), filter, isSingle, invokeParam); }, getNodeIndex : function(node) { if (!node) return null; var childKey = setting.data.key.children, parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); for (var i=0, l = parentNode[childKey].length; i < l; i++) { if (parentNode[childKey][i] == node) return i; } return -1; }, getSelectedNodes : function() { var r = [], list = data.getRoot(setting).curSelectedList; for (var i=0, l=list.length; i
    0) { view.createNodes(setting, 0, root[childKey], null, -1); } else if (setting.async.enable && setting.async.url && setting.async.url !== '') { view.asyncNode(setting); } return zTreeTools; } }; var zt = $.fn.zTree, $$ = tools.$, consts = zt.consts;})(jQuery);
  • jquery.ztree.excheck-3.5.js

    /* * JQuery zTree excheck v3.5.19.1 * http://zTree.me/ * * Copyright (c) 2010 Hunter.z * * Licensed same as jquery - MIT License * http://www.opensource.org/licenses/mit-license.php * * email: hunter.z@263.net * Date: 2015-10-26 */(function($){    //default consts of excheck    var _consts = {        event: {            CHECK: "ztree_check"        },        id: {            CHECK: "_check"        },        checkbox: {            STYLE: "checkbox",            DEFAULT: "chk",            DISABLED: "disable",            FALSE: "false",            TRUE: "true",            FULL: "full",            PART: "part",            FOCUS: "focus"        },        radio: {            STYLE: "radio",            TYPE_ALL: "all",            TYPE_LEVEL: "level"        }    },    //default setting of excheck    _setting = {        check: {            enable: false,            autoCheckTrigger: false,            chkStyle: _consts.checkbox.STYLE,            nocheckInherit: false,            chkDisabledInherit: false,            radioType: _consts.radio.TYPE_LEVEL,            chkboxType: {                "Y": "ps",                "N": "ps"            }        },        data: {            key: {                checked: "checked"            }        },        callback: {            beforeCheck:null,            onCheck:null        }    },    //default root of excheck    _initRoot = function (setting) {        var r = data.getRoot(setting);        r.radioCheckedList = [];    },    //default cache of excheck    _initCache = function(treeId) {},    //default bind event of excheck    _bindEvent = function(setting) {        var o = setting.treeObj,        c = consts.event;        o.bind(c.CHECK, function (event, srcEvent, treeId, node) {            event.srcEvent = srcEvent;            tools.apply(setting.callback.onCheck, [event, treeId, node]);        });    },    _unbindEvent = function(setting) {        var o = setting.treeObj,        c = consts.event;        o.unbind(c.CHECK);    },    //default event proxy of excheck    _eventProxy = function(e) {        var target = e.target,        setting = data.getSetting(e.data.treeId),        tId = "", node = null,        nodeEventType = "", treeEventType = "",        nodeEventCallback = null, treeEventCallback = null;        if (tools.eqs(e.type, "mouseover")) {            if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {                tId = tools.getNodeMainDom(target).id;                nodeEventType = "mouseoverCheck";            }        } else if (tools.eqs(e.type, "mouseout")) {            if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {                tId = tools.getNodeMainDom(target).id;                nodeEventType = "mouseoutCheck";            }        } else if (tools.eqs(e.type, "click")) {            if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {                tId = tools.getNodeMainDom(target).id;                nodeEventType = "checkNode";            }        }        if (tId.length>0) {            node = data.getNodeCache(setting, tId);            switch (nodeEventType) {                case "checkNode" :                    nodeEventCallback = _handler.onCheckNode;                    break;                case "mouseoverCheck" :                    nodeEventCallback = _handler.onMouseoverCheck;                    break;                case "mouseoutCheck" :                    nodeEventCallback = _handler.onMouseoutCheck;                    break;            }        }        var proxyResult = {            stop: nodeEventType === "checkNode",            node: node,            nodeEventType: nodeEventType,            nodeEventCallback: nodeEventCallback,            treeEventType: treeEventType,            treeEventCallback: treeEventCallback        };        return proxyResult    },    //default init node of excheck    _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {        if (!n) return;        var checkedKey = setting.data.key.checked;        if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true");        n[checkedKey] = !!n[checkedKey];        n.checkedOld = n[checkedKey];        if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true");        n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck);        if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true");        n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled);        if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true");        n.halfCheck = !!n.halfCheck;        n.check_Child_State = -1;        n.check_Focus = false;        n.getCheckStatus = function() {
    return data.getCheckStatus(setting, n);}; if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) { var r = data.getRoot(setting); r.radioCheckedList.push(n); } }, //add dom for check _beforeA = function(setting, node, html) { var checkedKey = setting.data.key.checked; if (setting.check.enable) { data.makeChkFlag(setting, node); html.push(""); } }, //update zTreeObj, add method of check _zTreeTools = function(setting, zTreeTools) { zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) { var checkedKey = this.setting.data.key.checked; if (node.chkDisabled === true) return; if (checked !== true && checked !== false) { checked = !node[checkedKey]; } callbackFlag = !!callbackFlag; if (node[checkedKey] === checked && !checkTypeFlag) { return; } else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) { return; } if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) { node[checkedKey] = checked; var checkObj = $$(node, consts.id.CHECK, this.setting); if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); view.setChkClass(this.setting, checkObj, node); view.repairParentChkClassWithSelf(this.setting, node); if (callbackFlag) { this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]); } } } zTreeTools.checkAllNodes = function(checked) { view.repairAllChk(this.setting, !!checked); } zTreeTools.getCheckedNodes = function(checked) { var childKey = this.setting.data.key.children; checked = (checked !== false); return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked); } zTreeTools.getChangeCheckedNodes = function() { var childKey = this.setting.data.key.children; return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]); } zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) { disabled = !!disabled; inheritParent = !!inheritParent; inheritChildren = !!inheritChildren; view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren); view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent); } var _updateNode = zTreeTools.updateNode; zTreeTools.updateNode = function(node, checkTypeFlag) { if (_updateNode) _updateNode.apply(zTreeTools, arguments); if (!node || !this.setting.check.enable) return; var nObj = $$(node, this.setting); if (nObj.get(0) && tools.uCanDo(this.setting)) { var checkObj = $$(node, consts.id.CHECK, this.setting); if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); view.setChkClass(this.setting, checkObj, node); view.repairParentChkClassWithSelf(this.setting, node); } } }, //method of operate data _data = { getRadioCheckedList: function(setting) { var checkedList = data.getRoot(setting).radioCheckedList; for (var i=0, j=checkedList.length; i
    -1 && node.check_Child_State < 2) : (node.check_Child_State > 0))) }; return r; }, getTreeCheckedNodes: function(setting, nodes, checked, results) { if (!nodes) return []; var childKey = setting.data.key.children, checkedKey = setting.data.key.checked, onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL); results = !results ? [] : results; for (var i = 0, l = nodes.length; i < l; i++) { if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) { results.push(nodes[i]); if(onlyOne) { break; } } data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results); if(onlyOne && results.length > 0) { break; } } return results; }, getTreeChangeCheckedNodes: function(setting, nodes, results) { if (!nodes) return []; var childKey = setting.data.key.children, checkedKey = setting.data.key.checked; results = !results ? [] : results; for (var i = 0, l = nodes.length; i < l; i++) { if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) { results.push(nodes[i]); } data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results); } return results; }, makeChkFlag: function(setting, node) { if (!node) return; var childKey = setting.data.key.children, checkedKey = setting.data.key.checked, chkFlag = -1; if (node[childKey]) { for (var i = 0, l = node[childKey].length; i < l; i++) { var cNode = node[childKey][i]; var tmp = -1; if (setting.check.chkStyle == consts.radio.STYLE) { if (cNode.nocheck === true || cNode.chkDisabled === true) { tmp = cNode.check_Child_State; } else if (cNode.halfCheck === true) { tmp = 2; } else if (cNode[checkedKey]) { tmp = 2; } else { tmp = cNode.check_Child_State > 0 ? 2:0; } if (tmp == 2) { chkFlag = 2; break; } else if (tmp == 0){ chkFlag = 0; } } else if (setting.check.chkStyle == consts.checkbox.STYLE) { if (cNode.nocheck === true || cNode.chkDisabled === true) { tmp = cNode.check_Child_State; } else if (cNode.halfCheck === true) { tmp = 1; } else if (cNode[checkedKey] ) { tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1; } else { tmp = (cNode.check_Child_State > 0) ? 1 : 0; } if (tmp === 1) { chkFlag = 1; break; } else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) { chkFlag = 1; break; } else if (chkFlag === 2 && tmp > -1 && tmp < 2) { chkFlag = 1; break; } else if (tmp > -1) { chkFlag = tmp; } } } } node.check_Child_State = chkFlag; } }, //method of event proxy _event = { }, //method of event handler _handler = { onCheckNode: function (event, node) { if (node.chkDisabled === true) return false; var setting = data.getSetting(event.data.treeId), checkedKey = setting.data.key.checked; if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true; node[checkedKey] = !node[checkedKey]; view.checkNodeRelation(setting, node); var checkObj = $$(node, consts.id.CHECK, setting); view.setChkClass(setting, checkObj, node); view.repairParentChkClassWithSelf(setting, node); setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]); return true; }, onMouseoverCheck: function(event, node) { if (node.chkDisabled === true) return false; var setting = data.getSetting(event.data.treeId), checkObj = $$(node, consts.id.CHECK, setting); node.check_Focus = true; view.setChkClass(setting, checkObj, node); return true; }, onMouseoutCheck: function(event, node) { if (node.chkDisabled === true) return false; var setting = data.getSetting(event.data.treeId), checkObj = $$(node, consts.id.CHECK, setting); node.check_Focus = false; view.setChkClass(setting, checkObj, node); return true; } }, //method of tools for zTree _tools = { }, //method of operate ztree dom _view = { checkNodeRelation: function(setting, node) { var pNode, i, l, childKey = setting.data.key.children, checkedKey = setting.data.key.checked, r = consts.radio; if (setting.check.chkStyle == r.STYLE) { var checkedList = data.getRadioCheckedList(setting); if (node[checkedKey]) { if (setting.check.radioType == r.TYPE_ALL) { for (i = checkedList.length-1; i >= 0; i--) { pNode = checkedList[i]; if (pNode[checkedKey] && pNode != node) { pNode[checkedKey] = false; checkedList.splice(i, 1); view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); if (pNode.parentTId != node.parentTId) { view.repairParentChkClassWithSelf(setting, pNode); } } } checkedList.push(node); } else { var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); for (i = 0, l = parentNode[childKey].length; i < l; i++) { pNode = parentNode[childKey][i]; if (pNode[checkedKey] && pNode != node) { pNode[checkedKey] = false; view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); } } } } else if (setting.check.radioType == r.TYPE_ALL) { for (i = 0, l = checkedList.length; i < l; i++) { if (node == checkedList[i]) { checkedList.splice(i, 1); break; } } } } else { if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) { view.setSonNodeCheckBox(setting, node, true); } if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) { view.setSonNodeCheckBox(setting, node, false); } if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) { view.setParentNodeCheckBox(setting, node, true); } if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) { view.setParentNodeCheckBox(setting, node, false); } } }, makeChkClass: function(setting, node) { var checkedKey = setting.data.key.checked, c = consts.checkbox, r = consts.radio, fullStyle = ""; if (node.chkDisabled === true) { fullStyle = c.DISABLED; } else if (node.halfCheck) { fullStyle = c.PART; } else if (setting.check.chkStyle == r.STYLE) { fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART; } else { fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART); } var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle; chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName; return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName; }, repairAllChk: function(setting, checked) { if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) { var checkedKey = setting.data.key.checked, childKey = setting.data.key.children, root = data.getRoot(setting); for (var i = 0, l = root[childKey].length; i
    0) { view.repairParentChkClass(setting, node[childKey][0]); } else { view.repairParentChkClass(setting, node); } }, repairSonChkDisabled: function(setting, node, chkDisabled, inherit) { if (!node) return; var childKey = setting.data.key.children; if (node.chkDisabled != chkDisabled) { node.chkDisabled = chkDisabled; } view.repairChkClass(setting, node); if (node[childKey] && inherit) { for (var i = 0, l = node[childKey].length; i < l; i++) { var sNode = node[childKey][i]; view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit); } } }, repairParentChkDisabled: function(setting, node, chkDisabled, inherit) { if (!node) return; if (node.chkDisabled != chkDisabled && inherit) { node.chkDisabled = chkDisabled; } view.repairChkClass(setting, node); view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit); }, setChkClass: function(setting, obj, node) { if (!obj) return; if (node.nocheck === true) { obj.hide(); } else { obj.show(); } obj.attr('class', view.makeChkClass(setting, node)); }, setParentNodeCheckBox: function(setting, node, value, srcNode) { var childKey = setting.data.key.children, checkedKey = setting.data.key.checked, checkObj = $$(node, consts.id.CHECK, setting); if (!srcNode) srcNode = node; data.makeChkFlag(setting, node); if (node.nocheck !== true && node.chkDisabled !== true) { node[checkedKey] = value; view.setChkClass(setting, checkObj, node); if (setting.check.autoCheckTrigger && node != srcNode) { setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); } } if (node.parentTId) { var pSign = true; if (!value) { var pNodes = node.getParentNode()[childKey]; for (var i = 0, l = pNodes.length; i < l; i++) { if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey]) || ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) { pSign = false; break; } } } if (pSign) { view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode); } } }, setSonNodeCheckBox: function(setting, node, value, srcNode) { if (!node) return; var childKey = setting.data.key.children, checkedKey = setting.data.key.checked, checkObj = $$(node, consts.id.CHECK, setting); if (!srcNode) srcNode = node; var hasDisable = false; if (node[childKey]) { for (var i = 0, l = node[childKey].length; i < l && node.chkDisabled !== true; i++) { var sNode = node[childKey][i]; view.setSonNodeCheckBox(setting, sNode, value, srcNode); if (sNode.chkDisabled === true) hasDisable = true; } } if (node != data.getRoot(setting) && node.chkDisabled !== true) { if (hasDisable && node.nocheck !== true) { data.makeChkFlag(setting, node); } if (node.nocheck !== true && node.chkDisabled !== true) { node[checkedKey] = value; if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1; } else { node.check_Child_State = -1; } view.setChkClass(setting, checkObj, node); if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) { setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); } } } }, _z = { tools: _tools, view: _view, event: _event, data: _data }; $.extend(true, $.fn.zTree.consts, _consts); $.extend(true, $.fn.zTree._z, _z); var zt = $.fn.zTree, tools = zt._z.tools, consts = zt.consts, view = zt._z.view, data = zt._z.data, event = zt._z.event, $$ = tools.$; data.exSetting(_setting); data.addInitBind(_bindEvent); data.addInitUnBind(_unbindEvent); data.addInitCache(_initCache); data.addInitNode(_initNode); data.addInitProxy(_eventProxy, true); data.addInitRoot(_initRoot); data.addBeforeA(_beforeA); data.addZTreeTools(_zTreeTools); var _createNodes = view.createNodes; view.createNodes = function(setting, level, nodes, parentNode, index) { if (_createNodes) _createNodes.apply(view, arguments); if (!nodes) return; view.repairParentChkClassWithSelf(setting, parentNode); } var _removeNode = view.removeNode; view.removeNode = function(setting, node) { var parentNode = node.getParentNode(); if (_removeNode) _removeNode.apply(view, arguments); if (!node || !parentNode) return; view.repairChkClass(setting, parentNode); view.repairParentChkClass(setting, parentNode); } var _appendNodes = view.appendNodes; view.appendNodes = function(setting, level, nodes, parentNode, index, initFlag, openFlag) { var html = ""; if (_appendNodes) { html = _appendNodes.apply(view, arguments); } if (parentNode) { data.makeChkFlag(setting, parentNode); } return html; }})(jQuery);

     

    转载于:https://www.cnblogs.com/mingforyou/p/6385753.html

    你可能感兴趣的文章
    HTML标记参考手册
    查看>>
    svn服务器搭建
    查看>>
    使用SpringAop 验证方法参数是否合法
    查看>>
    关于Microsoft.SharePoint.Security的问题
    查看>>
    AndroidManifest.xml详解
    查看>>
    vue学习二:
    查看>>
    在IIS上部署的网站,本机无法浏览解决方法
    查看>>
    JS报表控件highcharts应用
    查看>>
    rsync服务器间文件的传输
    查看>>
    Java(6)for循环
    查看>>
    Redis数据结构之简单动态字符串SDS
    查看>>
    CentOS7 查看硬盘情况
    查看>>
    WPF-3D动效-文字球形环绕
    查看>>
    Asp.Net Core 轻松学-利用xUnit进行主机级别的网络集成测试
    查看>>
    ToList()所带来的性能影响
    查看>>
    WPF 4 日期选择器(DatePicker)
    查看>>
    20几个正则常用正则表达式
    查看>>
    TextArea中定位光标位置
    查看>>
    非常棒的Visual Studo调试插件:OzCode 2.0 下载地址
    查看>>
    判断字符串在字符串中
    查看>>