以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  授权目录树的四级代码怎么写  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=67295)

--  作者:blsu33
--  发布时间:2015/4/21 22:51:00
--  授权目录树的四级代码怎么写

老师,

   目录树的授权,目录树是四级的,代码怎么写呢?

 


图片点击可在新窗口打开查看此主题相关图片如下:四级的目录树.png
图片点击可在新窗口打开查看

 

Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
Dim dr As DataRow
Select Case e.node.Level
    Case 0
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.Name & "\' And 权限 Is Null")
    Case 1
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.Name & "\' And  一级模块 = \'" & e.Node.ParentNode.Name & "\' And  权限 = \'" & e.Node.Name & "\'")
    Case 2
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.Name & "\' And  一级模块 = \'" & e.Node.ParentNode.Name & "\' And  二级模块 = \'" & e.Node.ParentNode.ParentNode.Name & "\' And  权限 = \'" & e.Node.Name & "\'")
    Case 3
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.Name & "\' And  一级模块 = \'" & e.Node.ParentNode.Name & "\' And  二级模块 = \'" & e.Node.ParentNode.ParentNode.Name & "\'And  权限 = \'" & e.Node.ParentNode.ParentNode.ParentNode.Name & "\'")
End Select
Dim nms As New List(of String)
If dr IsNot Nothing AndAlso dr.IsNull("用户") = False
    nms.AddRange(dr("用户").Split(","))
End If
For Each nd As WinForm.TreeNode In trv2.AllNodes
    nd.Checked = nms.Contains(nd.Name)
Next


--  作者:Bin
--  发布时间:2015/4/22 8:51:00
--  
Select Case e.node.Level
    Case 0
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.Name & "\'")
    Case 1
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.ParentNode.Name & "\' And  一级模块 = \'" & e.Node.Name & "\'")
    Case 2
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.ParentNode.ParentNode.Name & "\' And  一级模块 = \'" & e.Node.ParentNode.Name & "\' And  二级模块 = \'" & e.Node.Name & "\'")
    Case 3
        dr = DataTables("授权表").Find("功能主模块 = \'" & e.Node.ParentNode.ParentNode.ParentNode.Name & "\' And  一级模块 = \'" & e.Node.ParentNode.ParentNode.Name & "\' And  二级模块 = \'" & e.Node.ParentNode.Name & "\'And  权限 = \'" & e.Node.Name & "\'")