以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]菜单中项目已经删除干净如何把功能组也删除?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=119438)

--  作者:新福星
--  发布时间:2018/5/24 19:39:00
--  [求助]菜单中项目已经删除干净如何把功能组也删除?


此主题相关图片如下:qq截图20180524193226.jpg
按此在新窗口浏览图片

 

问题如标题。

 

 

在主菜单的系统事件的Load事件

Dim zc As String=Nothing

If _username="超级用户" Then
    zc="" \'Else
    Dim js() As String=_userrule.split(",")
   
   
    For Each  x As String In js
        If zc=Nothing Then
            zc="角色名称=\'" & x & "\'"
        Else
            zc=zc & " Or 角色名称=\'" & x & "\'"
        End If
    Next
End If

Dim r  As DataRow
Dim rt As  RibbonMenu.Tab
Dim rt1 As  RibbonMenu.Tab
\'---------------------------------------------------------
For Each a1 As RibbonMenu.Tab In RibbonTabs
    For Each a2 As RibbonMenu.group In a1.Groups
        For Each a3 As  RibbonMenu.RibbonItem  In  a2.Items \'  ToolBars
            \'If a3.name.Contains("退出")=True Or a3.name.Contains("标准按钮")=True Then  Continue For
            If zc="" Then
                r=DataTables("角色").sqlfind("功能区=\'" & a1.name & "\' And 菜单分类=\'" & a2.name & "\' And 模块名称=\'" & a3.name & "\'")
               
            Else
                r=DataTables("角色").sqlfind("功能区=\'" & a1.name & "\' And 菜单分类=\'" & a2.name & "\' And 模块名称=\'" & a3.name & "\' And " & zc)
            End If
            If r Is Nothing Then
                a3.Visible=False
            End If
        Next
        \'  If a2.Items.Count =0 Then a2.Visible =False
        \'\'\'
    Next
Next


 


--  作者:有点甜
--  发布时间:2018/5/24 20:03:00
--  

For Each a1 As RibbonMenu.Tab In RibbonTabs
    Dim count1 As Integer = 0
    For Each a2 As RibbonMenu.group In a1.Groups
        Dim count2 As Integer = 0
        For Each a3 As  RibbonMenu.RibbonItem  In  a2.Items \'  ToolBars
            \'If a3.name.Contains("退出")=True Or a3.name.Contains("标准按钮")=True Then  Continue For
            If zc="" Then
                r=DataTables("角色").sqlfind("功能区=\'" & a1.name & "\' And 菜单分类=\'" & a2.name & "\' And 模块名称=\'" & a3.name & "\'")
               
            Else
                r=DataTables("角色").sqlfind("功能区=\'" & a1.name & "\' And 菜单分类=\'" & a2.name & "\' And 模块名称=\'" & a3.name & "\' And " & zc)
            End If
            If r Is Nothing Then
                a3.Visible=False
            Else
                a3.Visible=True
                count2 += 1
            End If
        Next
        If count2 = 0 Then
            a2.Visible = False
        Else
            a2.Visible=True
            count1 += 1
        End If
    Next
    If count1 = 0 Then
        a1.Visible = False
    else
        a1.Visible=true
    End If
Next