如下代码,上传文件进度显示100%后,弹出上传成功提示要等10秒左右,不知为何?
If e.postvalues.count =0 Then
wb.AddTopTips("","toptip1","") '用于显示动态错误提示
wb.AddForm("","form1","HRLogsAddNew.htm")
With wb.AddInputGroup("form1","ipg0","日志标题")
With .AddTextArea("rzbt",1)
.Placeholder = "名称或摘要:"
.Required = "true"
End With
End With
With wb.AddInputGroup("form1","ipg1","日志内容")
.AddTextArea("rznr",3).Placeholder = "此处输入日志内容,字数不限!"
End With
With wb.AddInputGroup("form1","ipg2","不选择默认当天")
.AddInput("sjrq","事件日期:","date")
End With
With wb.AddInputGroup("form1","ipg3","文件上传") '文件上传
With .AddUploader("up1","选择文件:",True)
.TextPosition = 0 '标题靠左
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "提交", "button").Attribute= "" '调用js函数上传
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
wb.AppendHTML("<script src='./lib/HRlogsMsg.js'></script>") '引入脚本文件
Else
If e.PostValues.ContainsKey("rzbt") Then
'生成编号
Dim c md As new SQLCommand
cmd.Co nnecti
cmd.C ommandText = "s elect Max(记录编号) f rom LogsMaintable where 记录编号 like 'rzbh-" & Format(Date.Now,"yyyyMMdd") & "%'"
Dim maxID As String
Dim newID As String
maxID = CMD.E xecuteScalar
If maxID Is Nothing Then
newID = "rzbh" & "-" & Format(Date.Now,"yyyyMMdd") & "-" & "0001"
Else
newID = "rzbh" & "-" & Format(Date.Now,"yyyyMMdd") & "-" & CStr(Val(Right(maxID,4)) + 1).PadLeft(4,"0")
End If
cmd.C ommandText = "s elect * from LogsMaintable where [_identify] is null"
Dim dt As DataTable
dt = cmd.E xecuteReader(True)
Dim dr As DataRow = dt.AddNew()
dr("记录编号") = newID
dr("记录名称") = e.PostValues("rzbt")
If e.PostValues.ContainsKey("rznr")
dr("记录内容") = e.PostValues("rznr")
End If
'messagebox.show(CDate(e.PostValues("sjrq")))
If e.PostValues.ContainsKey("sjrq") Then
dr("事件日期") = CDate(e.PostValues("sjrq"))
End If
dr("记录人") = cs
dr("记录日期") = Format(Date.Now,"yyyy-MM-dd hh:mm:ss")
dt.Save()
Dim filenames As new List(of String)
If e.Files.ContainsKey("up1") Then
For Each key As String In e.Files.Keys
For Each fln As String In e.Files(key)
e.SaveFile(key,fln, ProjectPath & "Attachments\HRlogsFiles\" & fln) '存接收到的文件
filenames.Add(fln)
Next
Next
End If
If filenames.Count > 0 Then
For Each f As String In filenames
cmd.C ommandText = "i nsert i nto LogsFileDetail (记录编号,文件名,记录人,记录日期) values ('" & newID & "','" & f & "','" & cs & "','" & Format(Date.Now,"yyyy-MM-dd hh:mm:ss") & "')"
cmd.ExecuteNonQuery
Next
End If
e.WriteString("OK")
End If
End If
e.WriteString(wb.Build) '生成网页
End If
[此贴子已经被作者于2018/11/9 11:53:17编辑过]