var treeObj = null;
        var setting = {
                data: {
                    simpleData: {
                        enable: true
                    }
                },
        		check : {
        			enable : true,
        			autoCheckTrigger:false,
        			chkStyle: "checkbox",
        			chkboxType: { "Y": "ps", "N": "ps" }
        		}
        };

        function getTree() {
        	jQuery.ajax({
        		type : 'POST',
        		dataType : "json",
        		url : '/pqs9900/report/rptree',
        		data : {},
        		async:false,
        		error : function() {},
        		success : function(data) {
        			var datalist = [];
        			for ( var i = 0; i < data.length; i++) {
        				var str = '';

        				str += '{' + "id:" + data[i].id;
        				str += ',' + "name:'" + data[i].name + "'";
        				str += ',' + "nodeIndex:" + data[i].nodeIndex;
        				str += ',' + "nodeType:" + data[i].nodeType;
        				str += ',' + "ppId:" + data[i].ppId;
        				if(data[i].nodeType == "0"){
        					str += ',' + "open:" + true;
        				}else{
        					str += ',' + "open:" + false;
        				}
        				str += ',' + "describe:" + data[i].describe;
        				str += ',' + "rd_Index:'" + data[i].rdIndex + "'";
        				str += ',' + "pId:" + data[i].pId + '}';
        				datalist.push(str);
        			}
        			datalist = eval('[' + datalist + ']');// string->json数组

        			var zNodes = datalist;
        			
        			treeObj = $.fn.zTree.init($("#tree"), setting, zNodes);
        		}
        	});
        	
//
//            $(document).ready(function(){
//                treeObj = $.fn.zTree.init($("#tree"), setting, zNodes);
//            });
        }


        $(document).ready(function(){
        	getTree();
        });

        