list函数
Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
'获取要显示的页
Dim page As Integer = 0 '默认page为0,显示第一页
Dim pageRows As Integer = 10 '每页10行-----------------------
If e.GetValues.ContainsKey("page") Then '如果地址中有page参数
Integer.TryParse(e.GetValues("page"), page) '提取page参数
End If
Dim StartRow As Integer = page * pageRows + 1 '此页第一行
Dim EndRow As Integer = (page + 1) * pageRows '此页最后一行
Dim Filter As String '条件表达式
If e.GetValues.ContainsKey("unfilter") Then
wb.ClearCookie() '清除Cookie
Else
Filter = Functions.Execute("GetFilter", e, wb, "")'合成条件表达式
End If
If Filter Is Nothing Then
Filter = "流程状态 = '完成' OR 流程状态 = '内部' OR 流程状态 = '加急' OR 流程状态 = '正常' OR 流程状态 = '新' OR 流程状态 = 'OK' OR 流程状态 = '调档' OR 流程状态 Is Null"
End If
'msgbox("查询内容 = " & Filter)
'------------获取该页数据-----------------
Dim cmd As New SQLCommand
cmd.C '记得设置数据源名称
cmd.CommandText =
Dim Count As Integer = cmd.ExecuteScalar() '获取总的行数
'msgbox("e.PostValues(查询内容) = " & e.PostValues("查询内容") & " e.Cookies(查询内容) = " & e.Cookies("nr"))
Dim cxnr As String '查询内容 e.Cookies("查询内容")
'If e.PostValues("查询内容") Is Nothing Then
If e.PostValues("查询内容") Is Nothing Then
If e.Cookies("nr") Is Nothing Then
cxnr = "交费情况"'查询内容
Else
cxnr = e.Cookies("nr")'查询内容
End If
Else
cxnr = e.PostValues("查询内容")'查询内容
'cxnr = e.Cookies("nr")'查询内容
End If
'msgbox("查询内容 = " & cxnr)
Dim Pages As Integer = Math.Ceiling(Count / PageRows) '计算出总页数
cmd.CommandText =
Dim dt As DataTable = cmd.ExecuteReader
'根据此页数据生成表格
'wb.AddForm("", "form1", "edit.htm")
With wb.AddTable("", "Table1")
.PageNumber = page '设置页码
'.Highlight = -1 '关闭高亮显示
'.Alternate = 2 '每两行显示一个不同背景颜色的行
.RowHead = 1 '左边第一列作为行头
.ActiveSheet = "menu" '指定菜单
'.ColWidth = "12px,,120px" '设置列宽
.Primarykey = "报告编号" '指定主键,只要是能唯一区分行的列即可,并非一定要表的实际主键.False
'.Primarykey = "_Identify" '设置主键
.CreateFromDataTable(dt, False , "", "", "序号", "报告编号", cxnr, "客户名称", "样品名称")
'DataTables("订单"),False【显示行号】,"客户='CS01【筛选】'","日期 desc【排序】","产品","单价","数量","日期","审核"【列名】
'.Attribute="style='text-align:center;background-color:#FF4500;color:#fff;font-weight:bold'"
.Attribute = "style='text-align:center'" '居中
End With
'设计菜单
With wb.AddActionSheet("", "menu")
.Add("photo1", "样品照片").Attribute = "" 'showphoto
'.Add("photo1", "样品照片").Attribute = "" 'showphoto
.Add("mnuCancel", "取消", "", True)
End With
'生成换页按钮
With wb.AddButtonGroup("", "btg1", False)
'.Add("btnAdd", "增加订单").Attribute = ""
.Add("mnuFirst", "第一页", "", "List.htm?page=0")
.Add("mnuLast", "最末页", "", "List.htm?page=" & pages - 1)
End With
With wb.AddButtonGroup("", "btg2", False)
If page > 0 Then
.Add("btnPrev", "上一页", "", "List.htm?page=" & page - 1)
Else
.Add("btnPrev", "上一页").Kind = 1
End If
If Endrow < count Then
.Add("btnNext", "下一页", "", "List.htm?page=" & page + 1)
Else
.Add("btnNext", "下一页").Kind = 1
End If
End With
With wb.AddButtonGroup("", "btg3", False)
If Filter = "流程状态 = '完成' OR 流程状态 = '内部' OR 流程状态 = '加急' OR 流程状态 = '正常' OR 流程状态 = '新' OR 流程状态 = 'OK' OR 流程状态 = '调档' OR 流程状态 Is Null" Then
.Add("mnuFilter", "筛选数据", "button").Attribute = ""
'.Add("mnuFilter", "筛选数据", "", "filterlist.htm")
Else
.Add("mnuUnFilter", "撤销筛选", "", "List.htm?page=0&unfilter=true")
End If
.Add("mnuCancel", "返回", "", "filterlist.htm").Kind = 2
'.Add("photo", "照片", "button").Attribute = "" 'showphoto
End With
‘wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
’e.WriteString(wb.Build)
[此贴子已经被作者于2023/9/1 9:54:34编辑过]