物联网平台 +Web 组态
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

46 lines
1.1 KiB

function SelectTree(req,first){
var setting = {
view: {
dblClickExpand: false
},
data: {
simpleData: {
enable: true
}
},
callback: {
beforeClick: req.beforeClick
}
};
$("#Sel").click(function(){
var cityObj = $("#Sel");
var cityOffset = $("#Sel").offset();
if(req.isbox){
$("#menuContent").slideDown("fast");
}else{
$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
}
})
doAjaxPostData(req.method, localUrl+req.url,req.data,function(data){
if(data.status == 10001){
var arr = data.data;
var node = new Array();
if(first == "" || first == 'undefined' || first == undefined){
var i=0;
} else{
var i=1;
arr[0] = {"id":first.id,"pId":first.pId,"name":first.name}
}
for(i in arr){
if(arr[i].parent_id == undefined || arr[i].parent_id == "undefined"){
arr[i].parent_id = 1;
}
node[i] = {"id":arr[i].id,"pId":arr[i].parent_id,"name":arr[i].name,"open":true};
}
$.fn.zTree.init($("#tree"), setting, node);
}else{
}
});
}