Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim url As String = "editxdbg.htm?page=" & page & "&oid=" & pr("订单编号") '传递页码和订单编号
wb.AddForm("","form10",url)
If e.GetValues.ContainsKey("oid") Then '如果是旧订单,则汇总显示数量和金额
With wb.AddInputGroup("form10","ipg8","问题点")
.AddHiddenValue("订单编号",pr("订单编号"))
.AddTextArea("问题点",3).value = pr("问题点")
With .AddUploader("up1","整改前照片",True) 'True表示允许上传多个文件
.Incremental = True '允许 重复选择文件或连续拍照
.AddImage("./巡店照片/1.jpg")
.AllowDelete = True '允许用户删除图片
End With
End With
Else
With wb.AddInputGroup("form10","ipg3","问题点")
.AddHiddenValue("订单编号",pr("订单编号"))
.AddTextArea("问题点",3) '.Placeholder = "请输入200字以内的备注"
With .AddUploader("up1","照片",True) 'True表示允许上传多个文件
.AllowDelete = True '允许用户删除图片
.Incremental = True '允许 重复选择文件或连续拍照
End With
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
End If
With wb.AddButtonGroup("form10","btg1",False)
.Add("btn2", "保存", "submit").Attribute= "onclic k='submitForm()'" '正常提交,保存后进入编辑状态
If e.GetValues.ContainsKey("oid") = False Then '如过是新增订单
.Add("btn3", "取消", "button","listxdbg.htm?page=" & page & "&deloid=" & pr("订单编号")) '删除新增订单后返回列表
Else
.Add("btn3", "返回", "button","listxdbg.htm?page=" & page) '返回列表
End If
End With
pr.Save() '必须保存,而且必须在最后保存,因为SQLAddNew增加的行,保存之后就会销毁,无法再调用
If e.PostValues.Count > 0 Then '如果是通过提交按钮访问,则给一个已经保存的提示给用户,时长500毫秒
wb.AddToast("","t1", "已经保存",0).Msec= 500
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到列表页
End If
wb.AppendHTML("<script src='./lib/order.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
保存的自定义函数:
Dim e As RequestEventArgs = args(0)
'保存订单
Dim dr As DataRow = DataTables("明细").SQLFind("订单编号='" & e.PostValues("订单编号") & "'")
Dim nms() As String = {"日期" 。。。} '""
If dr IsNot Nothing Then
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr(nm)= e.PostValues(nm)
End If
Next
End If
For Each key As String In e.Files.Keys
If key = "up1" Then
For Each fln As String In e.Files(key)
e.SaveFile(key, fln, "D:\wwwroot\mobo\巡店照片\" & fln)
Next
dr.Lines("整改前图片") = e.Files(key)
End If
Next
dr.Save()
[此贴子已经被作者于2017/6/2 23:43:05编辑过]