老师,
目录树的授权,目录树是四级的,代码怎么写呢?
此主题相关图片如下:四级的目录树.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