以文本方式查看主题
- Foxtable(狐表) (http://foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2)
---- 角色显示问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=192012)
|
-- 作者:wlj88868
-- 发布时间:2024/5/23 16:24:00
-- 角色显示问题
老师你好,,角色定义了一个公司,,登入是这个角色的=列管辖部门的显示,其他的不会显示,需要怎么做呀 此主题相关图片如下:1716451991895.png
此主题相关图片如下:1716452072779.png
|
-- 作者:有点蓝
-- 发布时间:2024/5/23 16:34:00
--
如果是外部表,BeforeLoadOuterTable事件
If e.DataTableName = "某表" Then e.SelectString = "Select * From {某表} Where [部门] in (\'" & e.user.Roles.replace(",","\',\'") & "\')" End If
如果是点击某按钮加载数据的
datatables("某表").loadfilter = "[部门] in (\'" & user.Roles.replace(",","\',\'") & "\')" datatables("某表").load
|
-- 作者:wlj88868
-- 发布时间:2024/5/23 17:02:00
--
内部表,,这个就要一个一个表设置吗,,全局的不行吗,登入的时候直接给限制了
|
-- 作者:有点蓝
-- 发布时间:2024/5/23 17:06:00
--
内部表:http://www.foxtable.com/webhelp/topics/0669.htm
如果所有表都有部门列,这样即可 e.Filter = "[部门] in (\'" & user.Roles.replace(",","\',\'") & "\')"
如果只是部分表有部门列
select case e.DataTableName case "表A","表B",......... e.Filter = "[部门] in (\'" & user.Roles.replace(",","\',\'") & "\')" end select
|
-- 作者:wlj88868
-- 发布时间:2024/5/23 17:39:00
--
select case e.DataTableName
case "开票资料","销售资料"
e.Filter = "[管辖部门] in (\'" & user.Roles.replace(",","\',\'") & "\')"
end select
加了这句试了一下,,报错 此主题相关图片如下:1716456962690.png
|
-- 作者:wlj88868
-- 发布时间:2024/5/23 18:51:00
--
不好意思老师,,,好像是切换用户的问题,,我在切换用户里面也加上代码,好像不报错了
|
-- 作者:有点蓝
-- 发布时间:2024/5/23 20:13:00
--
select case e.DataTableName case "开piao资料","销售资料" e.Filter = "[管辖部门] in (\'" & e.user.Roles.replace(",","\',\'") & "\')" end select
|
-- 作者:wlj88868
-- 发布时间:2024/5/24 9:06:00
--
Dim Filter As String With e.Form.Controls("combobox1") If .Value IsNot Nothing Then Filter = "品牌 like \'%" & .Value & "%\'" End If End With With e.Form.Controls("combobox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "销售型号 like\'%" & .Value & "%\'" End If End With With e.Form.Controls("combobox12") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "销售商场 like\'%" & .Value & "%\'" End If End With With e.Form.Controls("StartDate") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "销售日期 >= #" & .Value & "#" End If End With With e.Form.Controls("EndDate") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "销售日期 <= #" & .Value & "#" End If End With If user.IsRole("管辖部门") Then If Filter > "" Then Filter = Filter & " and " End If Filter = "[管辖部门] in (\'" & user.Roles.replace(",", "\',\'") & "\')" End If Dim bd1 As New SqlGroUPTableBuilder("查询表_table1", "销售资料") Dim dt1 As fxDataSource bd1.groups.AddDef("销售商场")\'根据型号分组 bd1.groups.AddDef("品牌")\'根据型号分组 bd1.Groups.AddDef("销售型号")\'根据型号分组 bd1.Groups.AddDef("管辖部门")\'根据型号分组 bd1.Groups.AddDef("销售日期", "月") bd1.Totals.AddDef("数量") bd1.Totals.AddDef("销售单价") bd1.Filter = Filter \'bd1.Subtotal = True \'bd1.SubtotalLevel = 1 dt1 = bd1.BuildDataSource() Tables("查询表_table1").DataSource = dt1 \'将统计结果绑定到Table With Tables("查询表_Table1") Dim g As SubtotalGroup \'定义一个新的分组 .SubtotalGroups.Clear() \'清除原有的分组 g = New SubtotalGroup g.GroupOn = "月" \'分组列为客户 g.TotalOn = "数量,销售单价" \'对数量和金额进行统计 .SubtotalGroups.Add(g) \'加入刚刚定义的分组 g = New SubtotalGroup g.GroupOn = "销售商场" \'分组列为客户 g.TotalOn = "数量,销售单价" \'对数量和金额进行统计 .SubtotalGroups.Add(g) \'加入刚刚定义的分组 g = New SubtotalGroup g.GroupOn = "*" \'分组列为客户 g.TotalOn = "数量,销售单价" \'对数量和金额进行统计 .SubtotalGroups.Add(g) \'加入刚刚定义的分组 .Subtotal() \'生成汇总模式 End With Tables("查询表_Table1").SysStyles("Subtotal0").BackColor = Color.LightSkyBlue\'小计行颜色 Tables("查询表_Table1").SysStyles("Subtotal1").BackColor = Color.Turquoise\'小计2颜色 Tables("查询表_Table1").Cols("销售商场").Width = 160\'列宽设置 Tables("查询表_Table1").Cols("销售型号").Width = 120\'列宽设置 Tables("查询表_Table1").Cols("数量").TextAlign = TextAlignEnum.Center\'数据居中 Tables("查询表_Table1").Cols("销售单价").TextAlign = TextAlignEnum.Center\'数据居中 Tables("查询表_Table1").Cols("月").TextAlign = TextAlignEnum.Center\'数据居中
老师麻烦在给看一下,,查询统计加的代码是不是错的,,也不报错,查询也不起作用
If user.IsRole("管辖部门") Then If Filter > "" Then Filter = Filter & " and " End If Filter = "[管辖部门] in (\'" & user.Roles.replace(",", "\',\'") & "\')" End If
|
-- 作者:有点蓝
-- 发布时间:2024/5/24 9:09:00
--
看看生成的条件
msgbox(Filter )
|
-- 作者:wlj88868
-- 发布时间:2024/5/24 9:28:00
--
谢谢老师已经调试出来了,
多了一个if语句,就加这一句就可以了 Filter = "[管辖部门] in (\'" & user.Roles.replace(",", "\',\'") & "\')"
|