内部自定义函数:Edit
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim PageNumber As Integer = e.GetValues("page")
Dim PrimaryKey As String = e.GetValues("key")
Dim PageURL = "zxz.htm?page=" & PageNumber
If e.PostValues.Count = 0 Then '生成编辑页面
Dim dr As DataRow = DataTables("demand").SQLFind("[de_coding]=" & PrimaryKey)
If dr IsNot Nothing Then
wb.AddForm("","form1","edit.htm?key=" & PrimaryKey & "&page=" & 0)
With wb.AddInputGroup("form1","ipg1","编辑")
With .AddInputCell("ic1")
With .AddLabel("ysbm","验收部门",0)
.attribute="style=': gray;text-align: left;font-size: 13px;'"
End With
With .AddInput("department","text",2) '0显示在右边
.attribute="style=': gray;text-align: right;font-size: 13px;'"
.Value = dr("department")
.Readonly= True
End With
End With
With .AddInputCell("ic2")
With .AddLabel("ysr","验收人",0)
.attribute="style=': gray;text-align: left;font-size: 13px;'"
End With
With .AddInput("contact_person","text",2) '0显示在右边
.attribute="style=': gray;text-align: right;font-size: 13px;'"
.Value = dr("contact_person")
.Readonly= True
End With
End With
End With
With wb.AddInputGroup("form1","ipg4","简称")
.AddTextArea("abbreviation",1).Value = dr("abbreviation")
.attribute="style='color: gray;text-align: right;font-size: 10px;'"
End With
With wb.AddInputGroup("form1","ipg2","目的意义(why)")
.AddTextArea("why",5).Value = dr("why")
.attribute="style='color: gray;text-align: right;font-size: 10px;'"
End With
With wb.AddInputGroup("form1","ipg3","内容概要(who.where.when.what.how)")
.AddTextArea("content",20).Value = dr("content")
.attribute="style='color: gray;text-align: right;font-size: 10px;'"
End With
If dr("uineed")=False Then
With wb.AddRadioGroup("form1","uineed","是否需要")
.Add("true1","是").value= True
.Add("true2","否",True).value= False
.attribute="style=': black;text-align: left;font-size: 13px;'"
End With
Else
With wb.AddRadioGroup("form1","uineed","是否需要")
.Add("true1","是",True).value= True
.Add("true2","否").value= False
.attribute="style=': black;text-align: left;font-size: 13px;'"
End With
End If
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
Else
With wb.AddMsgPage("","msgpage","编辑失败", "此订单可能已经被删除!") '提示用户此订单不存在.
.icon= "Warn"
.AddButton("btn1","返回",PageURL) '生成返回原来页面的按钮
End With
End If
Else '保存编辑结果
Dim dr As DataRow = DataTables("demand").SQLFind("[de_coding]=" & PrimaryKey)
If dr IsNot Nothing Then
Dim nms() As String = {"uineed","abbreviation","why","content"}
For Each nm As String In nms
dr(nm) = e.PostValues(nm)
Next
dr.Save()
'显示完成提示,2妙手自动返回原来的页面
wb.AppendHtml("<meta http-equiv='refresh' c>",True)
wb.AddToast("","t1", "编辑完成",0).Visible = True
Else
With wb.AddMsgPage("","msgpage","保存失败", "此订单可能已经被删除!") '提示用户此订单不存在.
.icon= "Warn"
.AddButton("btn1","返回",PageURL) '生成返回原来页面的按钮
End With
End If
End If
e.WriteString(wb.Build) '生成网页
[此贴子已经被作者于2017/10/28 16:04:47编辑过]