afterload代码如下。
如果加上红色的代码,第一次打开窗口目录树创建正确,可是再次打开窗口目录树就创建不对了,少了不少,感觉只把加载的第一页创建了。
如果把红色代码注释掉,每次打开窗口目录树创建都正确。这怎么解决?
If user.IsRole("测试部经理") Then
DataTables("BUG录入表").LoadFilter =""
DataTables("BUG录入表").Load
Tables("BUG录入表").sort = "BUG_ID DESC"
Dim cnt As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","[严重程度] = '死机' And (状态 = '待解决' or 状态 = '未解决')")
e.Form.Controls("超严重BUG").text = "超严重BUG(" & cnt & ")"
Dim cnt11 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","[优先级别] = '立刻(Immediate)' And (状态 = '待解决' or 状态 = '未解决')")
e.Form.Controls("超紧急BUG").text = "超紧急BUG(" & cnt11 & ")"
Dim Page As WinForm.TopicPage
Dim cnt1 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = '待解决' and 提交人邮箱 = '" & user.name & "'")
Dim cnt2 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = '已更新' and 提交人邮箱 = '" & user.name & "'")
Dim cnt3 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = '已解决' and 提交人邮箱 = '" & user.name & "'")
Dim cnt4 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = '未解决' and 提交人邮箱 = '" & user.name & "'")
Dim cnt5 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","提交人邮箱 = '" & user.name & "'")
Page = e.Form.Controls("TopicBar1").Pages.Add("测试部BUG统计","测试部BUG统计")
Page.Links.Add("待解决的BUG","待解决的BUG(" & cnt1 & ")" )
Page.Links.Add("待验证的BUG","待验证的BUG(" & cnt2 & ")" )
Page.Links.Add("已解决的BUG","已解决的BUG(" & cnt3 & ")" )
Page.Links.Add("未解决的BUG","未解决的BUG(" & cnt4 & ")" )
Page.Links.Add("部组个和BUG","部组个和BUG(" & cnt5 & ")" )
Dim t1 As WinForm.TreeView = e.Form.Controls("TreeView1")
t1.BuildTree("BUG录入表","测试组名|提交人","测试部门 = '测试部部门'")
t1.Nodes.Insert("显示测试部门所有测试人员提交的BUG",0)
Dim t2 As WinForm.TreeView = e.Form.Controls("TreeView2")
t2.CreateTree("BUG录入表","怀疑模块","","测试部门 = '测试部部门'")
t2.Nodes.Insert("显示测试部门所有模块的BUG",0)
Dim t3 As WinForm.TreeView = e.Form.Controls("TreeView3")
t3.CreateTree("BUG录入表","测试机型","","测试部门 = '测试部部门'")
t3.Nodes.Insert("显示测试部门所有机型的BUG",0)
Dim t4 As WinForm.TreeView = e.Form.Controls("TreeView4")
t4.CreateTree("BUG录入表","测试项目名称","","测试部门 = '测试部部门'")
t4.Nodes.Insert("显示测试部门所有项目的BUG",0)
Dim t5 As WinForm.TreeView = e.Form.Controls("TreeView5")
t5.CreateTree("BUG录入表","软件版本","","测试部门 = '测试部部门'")
t5.Nodes.Insert("显示测试部门所有环境的BUG",0)
End If
With DataTables("BUG录入表")
.LoadOver = "BUG_ID"
.LoadReverse=True
.LoadTop = 22
.LoadPage = 0
.Load()
If .TotalPages = 0 Then
.LoadPage = 0
e.Form.Controls("TextBox1").Value = .LoadPage & "/" & .TotalPages
Else
e.Form.Controls("TextBox1").Value = .LoadPage + 1 & "/" & .TotalPages
End If
End With