页面代码如下:
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Select Case e.Path
Case "xjrjzjf.htm"
With wb.AddTabBar("", "tb1", 0)
.AddPage("page1","微信","./images/button.png")
.AddButton("bt12","通讯录","./images/msg.png")
.AddButton("bt13","发现","./images/article.png")
.AddButton("bt1","首页","./images/help.png","http://www.gzbhkjyxgs.com:8084/default.htm")
End With
If e.PostValues.Count = 0 Then
wb.AddPageTitle("page1","ph1","博融现金日记账")
wb.AddForm("page1","form1","xjrjzjf.htm")
'wb.AddPageTitle("","ph1","博融现金日记账")
'wb.AddForm("","form1","xjrjzjf.htm")
With wb.AddInputGroup("form1","ipg1","现金日记账【收入记账】")
.AddInput("日期","日期","date")
.AddSelect("凭证种类","凭证种类","|fa piao|收据|收条|小piao|物流单|快递单|其它单据")
.AddInput("凭证号数","凭证号数","Text")
.AddSelect("对方科目","科目类别","|日常办公|销售回款|日常开支|货物订货|其它项目")
.AddInput("摘要","内容摘要","Text")
With .AddInput("借方金额","收入金额","number")
.Step = "0.01"
.Attribute = ""
End With
.AddSelect("借方","收入人员","|肖妍|费泓纶|田景兰")
With wb.AddInputGroup("form1","ipg22","文件上传")
With .AddUploader("up1","图片",True)
.AllowDelete = True '允许删除
.Incremental = True '允许 重复选择文件或连续拍照
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定", "button").Attribute= "" '调用js函数上传
End With
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
With wb.AddDialog("","dlg1", "增加成功","好好学习,天天向上")
.AddButton("btnok1","继续增加","xjrjzjf.htm")
End With
With wb.AddDialog("","dlg2", "增加失败","")
.AddButton("btnf1","返回")..Attribute= ""
--------------------这里的代码作为说明不需要添加,上面的Attribute对应的是下面的Attribute 的内容,论坛屏蔽了,看不到,建议以后这种大段代码使用文本文件上传
With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1","返回").Attribute = ""
End With
---------------------
End With
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>",True) '引入脚本文件
wb.AppendHTML("<script src='./lib/yue.js'></script>") '引入脚本文件
e.WriteString(wb.Build)
Else
Dim nms() As String = {"日期","摘要","对方科目"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
e.WriteString(nm & "列不能为空!")
Return ""' '必须返回
End If
Next
nms = New String() {"日期","凭证种类","凭证号数","摘要","对方科目","日页","借方金额","借方","照片名","crc值"} '重新定义了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 = "up1" Then
For Each fln As String In e.Files(key)
e.SaveFile(key, fln, ProjectPath & "Attachments\" & fln)
dr.Lines("照片名") = e.Files(key)
'dr.Lines("照片名") =ProjectPath & "Attachments\" & fln
Next
End If
Next
'保存并生成增加成功提示页面
dr.save()
Dim val As String = CRCCheckFile(dr("照片名"))
dr.SQLSetValue("CRC值",val)
e.AsyncExecute = True '通知系统异步执行,不要关闭信道
Functions.AsyncExecute("jisuan",e) '异步调用函数处理接收到的数据和文件
e.WriteString("OK")
End If
End Select