以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 移动端开发数据总是不能匹配对应,附上例子麻烦各位老师看看 谢谢 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132232) |
||||
-- 作者:李孝春 -- 发布时间:2019/3/17 19:43:00 -- 移动端开发数据总是不能匹配对应,附上例子麻烦各位老师看看 谢谢 在网页页面上输入数据,结果不能在对应的告知内容表中生成数据,求解? 在狐表中打开信息编辑窗口后,输入信息,保存信息后会自动写入告知内容表数据,能够一一对应。 在网页中打开http://127.0.0.1/addnew.htm,输入信息后,确认后能够在信息列表中生成数据,但是不能同步在告知内容表中写上对应数据,发送平台和姓名内容、信息类别、信息内容老不能一一对应,貌似哪里出错了,附上代码和例子,求解! 此主题相关图片如下:1.png 此主题相关图片如下:3.png
httprequest代码 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") 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 内部函数yidongduanzengjiagaozhi代码 Dim br As Row=Tables("信息列表").Current If br("信息内容") <>"" Then Dim Vals As List(of String) If br("发送人员") IsNot Nothing Then Dim filter As String = "1=2" For Each s As String In br("发送人员").split(",") filter = filter & " or [姓名] like \'%" & s & "%\' " Next Vals = DataTables("干警信息").GetValues("姓名",filter ) \'MessageBox.Show("woshishui") Else If br("发送对象") IsNot Nothing Then Dim filter As String = "1=2" For Each s As String In br("发送对象").split(",") filter = filter & " or [备注] like \'%" & s & "%\' " Next Vals = DataTables("干警信息").GetValues("姓名",filter ) End If For i As Integer = 0 To Vals.Count - 1 Dim dr As DataRow = DataTables("告知内容").AddNew() dr("信息时间") = Date.Now dr("姓名") = Vals(i) dr("信息内容")=br("信息内容") dr("是否告知")= "否" dr("发送对象")= br("发送对象") dr("发送人员")= br("发送人员") dr("发送平台")= br("发送平台") dr("信息类别")= br("信息类别") dr("拟发送时间")= br("拟发送时间") Next End If 已通过取消内部函数,然后直接在信息列表中去写事件代码 Select Case e.DataCol.Name Case "信息内容" If e.DataRow("信息内容") <>"" Then Dim Vals As List(of String) If e.DataRow("发送人员") <>"" Then Dim filter As String = "1=2" For Each s As String In e.DataRow("发送人员").split(",") filter = filter & " or [姓名] like \'%" & s & "%\' " Next Vals = DataTables("干警信息").GetValues("姓名",filter ) \'MessageBox.Show("发送人员 & Vals") Else If e.DataRow("发送对象") <>"" Then Dim filter As String = "1=2" For Each s As String In e.DataRow("发送对象").split(",") filter = filter & " or [备注] like \'%" & s & "%\' " Next Vals = DataTables("干警信息").GetValues("姓名",filter ) \'MessageBox.Show("发送对象 & Vals") End If For i As Integer = 0 To Vals.Count - 1 Dim dr As DataRow = DataTables("告知内容").AddNew() dr("信息时间") = Date.Now dr("姓名") = Vals(i) dr("信息内容")=e.DataRow("信息内容") dr("是否告知")= "否" dr("发送对象")= e.DataRow("发送对象") dr("发送人员")= e.DataRow("发送人员") dr("发送平台")= e.DataRow("发送平台") dr("信息类别")= e.DataRow("信息类别") dr("拟发送时间")= e.DataRow("拟发送时间") Next End If End Select 如下解决了问题! 有没有办法实现移动端开发时候实现 如下多选框效果呢? [此贴子已经被作者于2019/3/17 22:19:38编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2019/3/18 10:28:00 -- http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=132228&skin=0
|