Foxtable(狐表)用户栏目专家坐堂 → [求助]列授权


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

主题:[求助]列授权

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


加好友 发短信
等级:七尾狐 帖子:1710 积分:11410 威望:0 精华:0 注册:2015/6/22 8:11:00
[求助]列授权  发帖心情 Post By:2017/12/18 22:21: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("(',' + Name + ',' like '%," & User.Name & ",%' or ',' + Config + ',' like '%," & User.group & ",%')")
    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

 


图片点击可在新窗口打开查看此主题相关图片如下:图像 13.png
图片点击可在新窗口打开查看


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


加好友 发短信
等级:超级版主 帖子:106680 积分:542589 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/12/18 22:34:00 [只看该作者]

For Each dr As DataRow In DataTables("授权表").Select("(',' + Name + ',' like '%," & User.Name & ",%' or ',' + Config + ',' like '%," & User.group & ",%')")
    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
                Dim cls() As String = dr("列名").split(",")
                For Each c As String In cls
                    If t.Cols.Contains(c) Then
                        t.Cols(c).Visible = Not dr("不可见")
                        t.Cols(c).AllowEdit = Not dr("不可编辑")
                    End If
                Next
            End If
        Next
    End If
Next

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


加好友 发短信
等级:七尾狐 帖子:1710 积分:11410 威望:0 精华:0 注册:2015/6/22 8:11:00
  发帖心情 Post By:2017/12/19 20:45:00 [只看该作者]

谢谢老师

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


加好友 发短信
等级:幼狐 帖子:153 积分:1895 威望:0 精华:0 注册:2017/3/21 22:40:00
  发帖心情 Post By:2018/4/17 10:10:00 [只看该作者]

上面代码是放到项目事件LoadUserSetting中,如果列视图里面有跟可见性相矛盾的,以哪个为准?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/17 10:12:00 [只看该作者]

以下是引用new4w在2018/4/17 10:10:00的发言:
上面代码是放到项目事件LoadUserSetting中,如果列视图里面有跟可见性相矛盾的,以哪个为准?

 

看谁先执行。如果先执行隐藏,再执行显示,列自然是显示的。反之,就是隐藏的。


 回到顶部