Foxtable(狐表)用户栏目专家坐堂 → 可视化授权加载表的问题


  共有2825人关注过本帖树形打印复制链接

主题:可视化授权加载表的问题

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/21 10:21:00 [显示全部帖子]

上传例子说明

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/21 11:26: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("用户名 = '" & User.Name & "'" )
    If dr.IsNull("列名") Then
        For Each t As Table In Tables
            If t.DataTable.Name = dr("表名") Then
                If dr("加载表") = False Then
                    DataTables.Unload(dr("表名"))
                Else
                    t.Visible = Not dr("不可见")
                    t.AllowEdit = Not dr("不可编辑")
                End If
            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

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/5 16:18:00 [显示全部帖子]

试试

For Each dr As DataRow In DataTables("授权表").Select("用户名 = '" & User.Name & "'" )
    If dr.IsNull("列名") Then
        For i As Integer = Tables.Count - 1 To 0 Step -1
            Dim t2 As Table = Tables(i)
            If t2.DataTable.Name = dr("表名") Then
                If dr("加载表") = False Then
                    DataTables.Unload(dr("表名"))
                Else
                    t2.Visible = Not dr("不可见")
                    t2.AllowEdit = Not dr("不可编辑")
                End If
            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

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/7 11:04:00 [显示全部帖子]

请重新上传有问题的项目看看


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/7 14:08: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
For Each dr As DataRow In DataTables("授权表").Select("用户名 = '" & User.Name & "'" )
    If dr.IsNull("列名") Then
        For i As Integer = DataTables.Count - 1 To 0 Step -1
            Dim t2 As DataTable = DataTables(i)
            If t2.Name = dr("表名") Then
                If dr("加载表") = False Then
                    DataTables.Unload(dr("表名"))
                Else
                    Tables(t2.Name).Visible = Not dr("不可见")
                    Tables(t2.Name).AllowEdit = Not dr("不可编辑")
                End If
            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

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/7 23:20:00 [显示全部帖子]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:综合类 (1).rar


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/8 12:07:00 [显示全部帖子]

If user.Type <> UserTypeEnum.Developer Then
    Tables("授权表").Visible =  False
End If

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/8 14:15:00 [显示全部帖子]

这个表不能不加载的,只能隐藏。

不加载后面的权限判断数据从哪取值啊。

把18楼代码放到afteropenproject事件

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109728 积分:558356 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/11/8 17:29:00 [显示全部帖子]

BeforeLoadInnerTable事件

Select Case e.DataTableName
    Case "授权表"
    Case Else
        If e.User.Type <> UserTypeEnum.Developer Then
            e.Cancel = True
        End If
End Select

 回到顶部