以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  授择  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=158227)

--  作者:qazlinle6
--  发布时间:2020/11/11 23:58:00
--  授择
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
Tables("表权限").Visible = (User.Type <> UserTypeEnum.User )
If  User.Type <> UserTypeEnum.User Then
    Return
End If
For Each dr As DataRow In DataTables("表权限").Select("\',\'+角色用户+\',\' like \'%," & user.Roles & ",%\'" )
    If dr.IsNull("列名") Then
        For Each t As Table In Tables
            If t.DataTable.Name = dr("表名") Then
                t.Visible = Not dr("权限表不可见")
                t.AllowEdit = Not dr("权限表不可编缉")
            End If
        Next
    Else
        For Each t As Table In Tables
            If t.DataTable.Name = dr("表名") Then
                For Each c As Col In t.Cols
                    If c.Name = dr("列名") Then
                        c.Visible = Not dr("权限表不可见")
                        c.AllowEdit = Not dr("权限表不可编缉")
                    End If
                Next
            End If
        Next
    End If
Next



什么没反应
[此贴子已经被作者于2020/11/12 0:51:18编辑过]

--  作者:有点蓝
--  发布时间:2020/11/12 9:43:00
--  
角色可能会有多个,参考这里的方法生成查询条件

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=158117&replyID=104985&skin=1

--  作者:qazlinle6
--  发布时间:2020/11/12 10:22:00
--  
For Each dr As DataRow In DataTables("表权限").Select("\',\'+角色用户+\',\' like \'%," & user.Roles & ",%\' " )
    If dr.IsNull("列名") Then
        For Each t As Table In Tables
            If t.DataTable.Name = dr("表名") Then
                t.Visible = Not dr("权限表不可见")
                t.AllowEdit = Not dr("权限表不可编缉")
            End If
        Next
    Else
        For Each t As Table In Tables
            If t.DataTable.Name = dr("表名") Then
                For Each c As Col In t.Cols
                    If c.Name = dr("列名") Then
                        c.Visible = Not dr("权限表不可见")
                        c.AllowEdit = Not dr("权限表不可编缉")
                    End If

                Next
            End If
        Next
End If
Next



日期 <= \'" & Date.Today.AddDays(dr("权限表编辑时间")) & "\'"  这个权限表可以把这个权限表编辑时间加上去不,空值可以编缉全部日期,如果0就是当天的,-1就是昨天的

--  作者:有点蓝
--  发布时间:2020/11/12 11:07:00
--  
这种代码只能控制表格和列可见还是不可见。数据的筛选控制使用其它代码处理,比如:http://www.foxtable.com/webhelp/topics/2256.htm