以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  菜单可见设置  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=81094)

--  作者:daxis0225
--  发布时间:2016/2/18 14:28:00
--  菜单可见设置

请教各位大神, 我用狐表做了一个查询报表工具,保留了原来的菜单设计—主菜单—功能区—Table-Table-Query查询表工具,希望设置用户权限,使用管理员登陆的时候,可见,其他登陆的时候不可见,如何做?


--  作者:大红袍
--  发布时间:2016/2/18 14:38:00
--  

 登陆的时候隐藏即可。

 

RibbonTabs("Table").Groups("Table").Items("Query").Visible = False


--  作者:daxis0225
--  发布时间:2016/2/18 15:30:00
--  

如下面红色字体部分内容,设置后所有的都不可见,请教

 

Dim UserName As String = e.Form.Controls("UserName").Value
Dim dr As DataRow
If UserName = ""  Then
    Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If

If User.Name <> "管理员" Then
    RibbonTabs("Table").Groups("Table").Items("Query").Visible = False
Else
    RibbonTabs("Table").Groups("Table").Items("Query").Visible = True
End  If

dr = _UserTable.SQLFind("[Name] = \'" & UserName & "\'")
If dr Is Nothing Then
    Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If
If e.Form.Controls("PassWord").Value = dr("Password") Then
    _UserName = UserName
    _UserGroup = dr("Group")
    e.Form.Close
Else
    Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If


\'
For Each t As Table In  Tables
    t.Visible = True
    t.AllowEdit = True
    For Each c As Col  In t.Cols
        c.Visible =  True
        c.AllowEdit =  True
    Next
Next
For Each dc As DataRow In DataTables("授权表").Select("用户名 = \'" & _username & "\'" )
    If dc.IsNull("列名") Then
        Tables(dc("表名")).Visible = Not dc("不可见")
        Tables(dc("表名")).AllowEdit = Not dc("不可编辑")
    Else
       
       
        Tables(dc("表名")).Cols(dc("列名")).Visible = Not dc("不可见")
        Tables(dc("表名")).Cols(dc("列名")).AllowEdit = Not dc("不可编辑")
    End  If
Next
Tables("授权表").Visible = (_UserGroup = "管理员")


--  作者:大红袍
--  发布时间:2016/2/18 15:32:00
--  
If _UserGroup <> "管理员" Then
    RibbonTabs("Table").Groups("Table").Items("Query").Visible = False
Else
    RibbonTabs("Table").Groups("Table").Items("Query").Visible = True
End  If

--  作者:daxis0225
--  发布时间:2016/2/18 17:38:00
--  
解决了,感谢红袍大师
--  作者:daxis0225
--  发布时间:2016/2/24 15:47:00
--  

红袍大师,我想让管理员可以察看相应控件,其他用户不可以,但是会跳错,说不存在名为"Addrow"的项目

 

If _UserGroup <> "管理员" Then
RibbonTabs("Table").Groups("Table").Items("Query").Visible = False
RibbonTabs("Common").Groups("Data").Items("Addrow").Visible = False
RibbonTabs("Common").Groups("Data").Items("Deleterow").Visible = False
RibbonTabs("Common").Groups("Data").Items("Clonerow").Visible = False

Else
RibbonTabs("Table").Groups("Table").Items("Query").Visible = True
RibbonTabs("Common").Groups("Data").Items("Addrow").Visible = True
RibbonTabs("Common").Groups("Data").Items("Deleterow").Visible = True
RibbonTabs("Common").Groups("Data").Items("Clonerow").Visible = True
End  If


--  作者:大红袍
--  发布时间:2016/2/24 16:23:00
--  

大小写要匹配才行

 

RibbonTabs("Common").Groups("Data").Items("AddRow").Visible = True