Dim wb As New weui
Select Case e.Path
Case "AddNew.htm"
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","addnew.htm")
With wb.AddInputGroup("form1","ipg1","信息编辑")
.AddInput("信息时间","信息时间","date") '前一个"姓名"是ID,后一个"姓名"是标题
.AddInput("信息类别","信息类别","text")
.AddInput("发送对象","发送对象","text")
.AddInput("发送人员","发送人员","text")
.AddSelect("发送平台","发送平台","移动短信|阿里云短信")
.AddInput("拟发送时间","拟发送时间","date")
'.AddInput("信息内容","信息内容","text")
'.AddSwitch("自动发送","自动发送").Value = "True"
End With
With wb.AddInputGroup("form1","ipg2","信息内容")
.AddTextArea("信息内容",10).Placeholder = "请输入500字以内的备注"
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "submit")
End With
e.WriteString(wb.Build)
Else
Dim nms() As String = {"信息时间","信息类别","发送平台","信息内容"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1","返回").Attribute = ""
End With
e.WriteString(wb.Build)
Return '必须返回
End If
Next
nms = New String() {"信息时间","信息类别","发送对象","发送人员","发送平台","拟发送时间","信息内容"} '重新定义了nms数组,增加了两列.
Dim dr As DataRow = DataTables("信息列表").AddNew()
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr(nm) = e.PostValues(nm)
End If
Next
Functions.Execute("yidongduanzengjiagaozhi")
With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") '生成成功提示页
.AddButton("btn1","继续增加","addnew.htm")
End With
e.WriteString(wb.Build)
End If
End Select