Dim wb As New weui
Select Case e.Path
Case "gh.htm"
If e.PostValues.Count = 0 Then
wb.AddForm("","线上报装","gh.htm")
With wb.AddInputGroup("线上报装","ipg1","线上报装")
.AddInput("申报人手机号","申报人手机号","text")
.AddInput("申报人姓名","申报人姓名","text")
.AddSelect("接入方式","接入方式","地上|地下|[]")
.AddSelect("客户类型","客户类型","|商业客户|工业客户|学校客户|相关政府单位|其他")
.AddSelect("建设方式","建设方式","|代建|自建")
.AddSelect("项目类型","项目类型","|老城区改造项目|新建项目|其他")
.AddInput("填报时间","填报时间","datetime-local").Value=Format(Date.now,"yyyy-MM-ddTHH:mm")
End With
With wb.AddInputGroup("线上报装","ipg2","工程基本资料")
.AddInput("工程名称","工程名称","text")
.AddTextArea("工程地址",2).Placeholder = "请输入详细地址(楼号\单元\门牌号)"
.AddInput("建设单位","建设单位","text")
.AddInput("联系人","联系人","text")
.AddInput("联系电话","联系电话","text")
.AddInput("计划用气时间","计划用气时间","datetime-local")
.AddInput("装表容量","装表容量","text").Placeholder = "m3/h"
.AddUploader("相关材料附件","相关材料附件",True) 'True表示允许上传多个文件
End With
With wb.AddInputGroup("线上报装","ipg3","申请单位意见")
.AddTextArea("申请单位意见",3).Placeholder = "请将控制在输入200字以内"
.AddUploader("其他附件","其他附件",True) 'True表示允许上传多个文件
End With
With wb.AddButtonGroup("线上报装","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
For Each key As String In e.Files.Keys
If key = "相关材料附件" Then
For Each fln As String In e.Files(key)
e.SaveFile(key, fln, ProjectPath & "Attachments\" & fln)
Next
dr.Lines("相关材料附件") = e.Files(key)
ElseIf key = "其他附件" Then
For Each f2n As String In e.Files(key)
e.SaveFile(key, f2n, ProjectPath & "Attachments\" & f2n)
Next
dr.Lines("其他附件") = e.Files(key)
End If
Next
'保存并生成增加成功提示页面
dr.save()
With wb.AddMsgPage("","msgpage","操作完成", "查询编号为:" & dr("编号") & ",请截图留存,以便查询项目进度") '生成成功提示页
.AddButton("btn1","退出","gh.htm")
End With
e.WriteString(wb.Build)
End If
End Select
蓝总:多点了几次,就重复保存了,怎么避免?