以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 根据分组动态加载表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=147259) |
-- 作者:南山南 -- 发布时间:2020/3/12 19:43:00 -- 根据分组动态加载表 下面有两种根据分组条件加载表,加载中以客服和组长加载是会出现问题,多加载:易途、广告费、客服目标、加V。 方案一 Select Case e.DataTableName Case "SEO","SEO分摊","客服","游客跟踪表","行政区域" If User.Group = "客服" Or user.group = "组长" Then e.Cancel = False End If Case "游客跟踪表","易途","广告费","客服目标","客服","加V","SEO分摊","SEO","行政区域" If user.group = "管理员" Then e.cancel = False End If Case Else e.cancel = True End Select 方案二 If User.Group = "客服" Or user.group = "组长" Then DataTables.Load("SEO|SEO分摊|客服|行政区域|游客跟踪表") Else If user.group = "管理员" Then DataTables.Load("SEO|SEO分摊|客服|行政区域|游客跟踪表|易途|广告费|客服目标|加V") End If
|
-- 作者:狐狸爸爸 -- 发布时间:2020/3/12 21:00:00 -- 关于这个Select Case和If的问题,你可以看看: |
-- 作者:南山南 -- 发布时间:2020/3/12 21:43:00 -- 老师修改后,以总经理的分组登录后有底纹区域表无法加载出来 Select Case e.DataTableName Case "SEO","SEO分摊","客服","游客跟踪表","行政区域" If User.Group = "客服" Or user.group = "组长" Then e.Cancel = False End If Case Else e.cancel = True End Select Select Case e.DataTableName Case "游客跟踪表","易途","广告费","客服目标","客服","加V","SEO分摊","SEO","行政区域" If user.group = "总经理" Then e.cancel = False End If Case Else e.cancel = True End Select Select Case e.DataTableName Case "SEO","SEO分摊","游客跟踪表","客服","行政区域" If user.group = "SEO" Then e.cancel = False End If Case Else e.Cancel = True End Select
|
-- 作者:狐狸爸爸 -- 发布时间:2020/3/12 21:54:00 -- 代码逻辑混乱,自己理清楚逻辑再写代码,否则别人看不懂,也帮不了你。 你要是理不清楚,可以简化,一个一个表判断,例如表A只能张三和李四,表B只能李四和王五,表C只能张三和王五: if e.DataTable.Name = "表A" Then Select Case User.Name Case "张三","李四" Case Else e.Cancel = True End If Elseif e.DataTable.Name = "表B" Then Select Case User.Name Case "李四","王五" Case Else e.Cancel = True End If Elseif e.DataTable.Name = "表C" Then Select Case User.Name Case "张三","王五" Case Else e.Cancel = True End If End If |
-- 作者:南山南 -- 发布时间:2020/3/12 22:17:00 -- 老师我把代码改成这样你帮我看看, 以总经理的分组登录后有底纹的表无法加载出来 Select Case e.DataTableName Case "SEO","SEO分摊","客服","游客跟踪表","行政区域" If User.Group = "客服" Or user.group = "组长" Or user.group = "SEO" Then e.Cancel = False End If Case Else e.cancel = True End Select Select Case e.DataTableName Case "游客跟踪表","易途","广告费","客服目标","客服","加V","SEO分摊","SEO","行政区域" If user.group = "总经理" Then e.cancel = False End If Case Else e.cancel = True End Select |
-- 作者:狐狸爸爸 -- 发布时间:2020/3/12 22:31:00 -- 单单上面的代码是不会导致这个结果的,你可以做个小例子发上来测试。或者你再后面的代码代码加上: Select Case e.DataTableName Case "SEO","SEO分摊","客服","游客跟踪表","行政区域" If User.Group = "客服" Or user.group = "组长" Or user.group = "SEO" Then e.Cancel = False End If Case Else e.cancel = True End Select Select Case e.DataTableName Case "游客跟踪表","易途","广告费","客服目标","客服","加V","SEO分摊","SEO","行政区域" If user.group = "总经理" Then e.cancel = False End If Case Else e.cancel = True End Select If e.DataTableName = "易途" Then MessageBox.show(user.Group & ":" & e.Cancel ) MessageBox.show(user.Group = "总经理" & ":" & e.Cancel ) End If 看看显示的是什么。 |
-- 作者:南山南 -- 发布时间:2020/3/14 11:15:00 -- 经过两天的间断测试,发现一个直接无法理解的现象。 第一、有底纹的代码被注释后,需要加载的表无法全部加载,若取消注释则能完全加载。 第二、取消注释后能完全加载,但是加载过程中也不会弹出窗口。 第三、关于老师给的关于检测的窗口代码,同样也是不会弹出的。 Select Case e.DataTableName Case "广告费","加v","分摊","易途","游客跟踪表","客服目标" e.Filter = "[_Identify] Is Null" End Select If e.User.Type = UserTypeEnum.Developer Then \'是开发者加载所有表 DataTables.Load("分摊|PBI|PBIday1|加V|SEO|客服|客服目标|广告费|易途|游客跟踪表") End If Select Case e.DataTableName Case "PBI","PBIday1","行政区域","客服","SEO","广告费","SEO分摊","游客跟踪表" ,"客服目标","易途" If e.User.Group = "数据员" Then \'MessageBox.show(user.Group & ":" & e.Cancel ) e.Cancel = False End If Case Else e.Cancel = True End Select Select Case e.DataTableName Case "SEO","SEO分摊","客服","游客跟踪表" ,"行政区域" If e.User.Group = "客服" Or e.user.group = "组长" Or e.User.Group = "SEO" Then e.Cancel = False End If Case Else e.Cancel = True End Select Select Case e.DataTableName Case "游客跟踪表","易途","广告费","客服目标","客服","加V","SEO分摊","SEO" ,"行政区域" If e.User.Group = "管理员" Then e.Cancel = False End If Case Else e.Cancel = True End Select
|
-- 作者:有点蓝 -- 发布时间:2020/3/14 11:35:00 -- 代码在什么事件的? |
-- 作者:南山南 -- 发布时间:2020/3/14 11:46:00 -- BeforeLoadInnerTable |
-- 作者:有点蓝 -- 发布时间:2020/3/14 11:53:00 -- Select Case e.DataTableName Case "广告费","加v","分摊","易途","游客跟踪表","客服目标" e.Filter = "[_Identify] Is Null" End Select If e.User.Type <> UserTypeEnum.Developer Then \'是开发者加载所有表 Select Case e.User.Group Case "数据员" Select Case e.DataTableName Case "PBI","PBIday1","行政区域","客服","SEO","广告费","SEO分摊","游客跟踪表" ,"客服目标","易途" Case Else e.Cancel = True End Select Case "客服" ,"组长" , "SEO" Select Case e.DataTableName Case "SEO","SEO分摊","客服","游客跟踪表" ,"行政区域" Case Else e.Cancel = True End Select Case "管理员" Select Case e.DataTableName Case "游客跟踪表","易途","广告费","客服目标","客服","加V","SEO分摊","SEO" ,"行政区域" Case Else e.Cancel = True End Select End Select End If
|