def Loadtree(id):
root={"title": "main","key":0,"children": ""}
root["children"]=bindchildnode(0)
return root
def bindchildnode(did):
nodechild=[]
treeList=Functionmodule.objects.filter(parentid=did)
if treeList.count()>0:
for tree in treeList:
nodechild.append({"title": tree.modulename,"key":tree.id,"children":bindchildnode(tree.id)})
return nodechild
树的循环遍历与递归拼接
最新推荐文章于 2023-11-02 08:00:00 发布