以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- web中自动填入信息功能实现 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=190912) |
||||
-- 作者:ycs5801 -- 发布时间:2024/3/13 21:41:00 -- web中自动填入信息功能实现 weui中,想实现类似快递那种自动提取关键字信息的功能,应该怎么设计?比如复制如下信息:姓名:张三 电话:155990 身份证号:999 ,然后粘贴到一处空白处,点击解析按钮后可以自动填入对应的字段空白处。 |
||||
-- 作者:ycs5801 -- 发布时间:2024/3/13 21:44:00 -- 补充一下 补充说明一下:复制粘贴后的格式是这样:姓名:张三 电话:155990 身份证号:999 也就是说每个字段后边是以回车换行结束,这样怎样判断截取比较好? [此贴子已经被作者于2024/3/13 21:45:28编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/14 8:42:00 -- dim s as string = "粘贴的内容........" dim s1() as string = s.replace(vbcr,"").split(vblf) for each a as string in s1 msgbox(a) dim s2() as string = a.split(":") msgbox(s1(0)) msgbox(s1(1)) next
|
||||
-- 作者:ycs5801 -- 发布时间:2024/3/14 9:48:00 -- Dim e As RequestEventArgs = args(0) Dim wb As New weui wb.AppendHTML("<style>.mark{font:bolder; font-size:20px;color:black}</style>", True) \'添加样式 wb.AddPageTitle("", "ph1", "新增船舶", "") \'If e.PostValues.Count = 0 Then \'生成增加订单网页 wb.AddForm("", "form2", "receive.htm") With wb.AddInputGroup("form2", "ipg1", "信息录入") If e.GetValues.ContainsKey("chujian") Then \'如果容纳chujian If e.GetValues.ContainsKey("name") Then Dim dr As DataRow = DataTables("检疫资料").SQLFind("用户姓名 = \'" & e.Cookies("用户姓名") & "\' And _Identify = \'" & e.getvalues("name") & "\'") If dr IsNot Nothing Then With .AddInput("中文船名", "中文船名", "Text") .Value = dr("中文船名") .Readonly = True End With With .AddInput("IMO号", "IMO号", "text") .Value = dr("IMO号") .Readonly = True End With With .AddInput("入境时间", "入境时间", "date") .Value = dr("入境时间") .Readonly = True End With With .AddInput("检查类别", "检查类别", "text") .Value = "出检" .Readonly = True End With .AddInput("航次号", "航次号", "text") End If End If Else With .AddTextArea("一键解析", 10) .Placeholder = "请输入船舶信息进行解析" .class = "mark" End With With wb.AddButtonGroup("form2", "btg77", False) .Add("btn77", "一键解析", "button").Attribute = "" \'调用js函数上传 End With .AddInput("入境时间", "入境时间", "date") .AddInput("中文船名", "中文船名", "Text") .AddInput("英文船名", "英文船名", "text") .AddInput("船籍", "船    籍", "Text") .AddInput("总吨", "总    吨", "number") .AddInput("IMO号", "IMO号", "text") .AddInput("航次号", "航次号", "text") .AddInput("进检船员数量", "进境船员数量", "number") .AddInput("来自国家", "来自国家", "text") .Addselect("检查类别", "检查类别", "[进检]|出检") End If \' .Addselect("船员体温", "船员体温", "正常|不正常") .AddInput("出境时间", "出境时间", "date") .AddInput("出检船员数量", "出检船员数量", "number") .AddInput("去往国家", "去往国家", "Text") .AddInput("本港休假船员数量", "本港休假船员数量", "number") End With wb.AppendHTML("<link rel=\'stylesheet\' href=\'./weui/exweui.css\'/>", True) wb.AppendHTML("<script src=\'./weui/exweui.js\' ></script>", True) wb.AppendHTML("<script src=\'./lib/test.js\'></script>") \'引入脚本文件 With wb.AddInputGroup("form2", "船舶资料", "船舶资料") With .AddTextArea("船舶资料", 15) .Placeholder = "请输入船舶信息概况" .class = "mark" End With End With With wb.AddInputGroup("form2", "随附图片", "随附图片") With .AddUploader("up128", "随附图片", True) .Incremental = True \'允许重复选择文件或连续拍照 .AllowAdd = True .Accept = "image/*" .ScaleWidth = 1200 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With End With With wb.AddButtonGroup("form2", "btg1", False) .Add("btn1", "首页", "button", "default.htm") .Add("btn3", "清除", "reset") .Add("btn2", "保存", "button").Attribute = "" \'调用js函数上传 End With wb.AddToast("", "tst1", "正在上传", 1) wb.AddToast("", "tst2", "上传成功", 0) wb.AddToast("", "tst3", "上传失败", 0).Icon = "warn" With wb.AddDialog("", "dlg1", "提示", "存在相同船名航次,增加失败!") .AddButton("btnOK", "确定") End With With wb.AddDialog("", "dlg2", "提示", "资料已被删除!") .AddButton("btnOK", "确定") End With With wb.AddDialog("", "dlg3", "提示", "船名、航次、IMO号、检查类别不能为空") .AddButton("btnOK", "确定") End With wb.InsertHTML("<style>#ipg1 .weui_label{color:black;width:100px}</style>") \'\'设置输入框长度 wb.AppendHTML("<script>initExWeUI();</script>") \'需要注意的是,这里不需要使用true参数 e.WriteString(wb.Build) \'生成网页 在这个网页中黄色部分想录入一段文字,比如中文船名:海航 英文船名:sea IMO号:99886 然后点击一键解析则对应的内容自动录入到网页中的空格内,需要用到js吧?这个应该怎么写?另外我现在“一键解析”这个按钮总跑到下边,怎样能直接挨着录入内容显示?
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/14 10:16:00 -- js也有split的用法,差不多的,用法百度一下 “一键解析”这个按钮就稍微有点麻烦,要分开多个AddInputGroup With wb.AddInputGroup("form2", "ipg1", "信息录入") If e.GetValues.ContainsKey("chujian") Then \'如果容纳chujian If e.GetValues.ContainsKey("name") Then Dim dr As DataRow = DataTables("检疫资料").SQLFind("用户姓名 = \'" & e.Cookies("用户姓名") & "\' And _Identify = \'" & e.getvalues("name") & "\'") If dr IsNot Nothing Then With .AddInput("中文船名", "中文船名", "Text") .Value = dr("中文船名") .Readonly = True End With With .AddInput("IMO号", "IMO号", "text") .Value = dr("IMO号") .Readonly = True End With With .AddInput("入境时间", "入境时间", "date") .Value = dr("入境时间") .Readonly = True End With With .AddInput("检查类别", "检查类别", "text") .Value = "出检" .Readonly = True End With .AddInput("航次号", "航次号", "text") End If End If Else With .AddTextArea("一键解析", 10) .Placeholder = "请输入船舶信息进行解析" .class = "mark" End With End If End With With wb.AddButtonGroup("form2", "btg77", False) .Add("btn77", "一键解析", "button").Attribute = "" \'调用js函数上传 End With If e.GetValues.ContainsKey("chujian") = False Then With wb.AddInputGroup("form2", "ipg2", "信息录入") .AddInput("入境时间", "入境时间", "date") .AddInput("中文船名", "中文船名", "Text") .AddInput("英文船名", "英文船名", "text") .AddInput("船籍", "船    籍", "Text") .AddInput("总吨", "总    吨", "number") .AddInput("IMO号", "IMO号", "text") .AddInput("航次号", "航次号", "text") .AddInput("进检船员数量", "进境船员数量", "number") .AddInput("来自国家", "来自国家", "text") .Addselect("检查类别", "检查类别", "[进检]|出检") End With End If \' .Addselect("船员体温", "船员体温", "正常|不正常") With wb.AddInputGroup("form2", "ipg3", "信息录入") .AddInput("出境时间", "出境时间", "date") .AddInput("出检船员数量", "出检船员数量", "number") .AddInput("去往国家", "去往国家", "Text") .AddInput("本港休假船员数量", "本港休假船员数量", "number") End With |
||||
-- 作者:ycs5801 -- 发布时间:2024/3/16 23:38:00 -- Addnew函数: …… With wb.AddInputGroup("form2", "ipg223", "自动解析船舶信息录入") With .AddTextArea("jxnr", 10) .Placeholder = "请粘贴船舶信息进行解析" .class = "mark" End With End With With wb.AddButtonGroup("form2", "btg77", False) .Add("btn77", "一键解析", "button").Attribute = "" End With .AddInput("英文船名", "英文船名", "text") .AddInput("航次号", "航次号", "text") .AddInput("IMO号", "IMO号", "text") …… Jiexi函数: Dim e As RequestEventArgs = args(0) Dim s As String = e.Values("jxnr") Dim s1() As String = s.replace(vbcr, "").split(vblf) For Each a As String In s1 Dim s2() As String = a.split(":") Next Js中jiexi函数: function jiexi() { var result= submitAjaxFileds(\'jiexi.htm\',\'\',\'jxnr\',false); if(result){ var vals=result.split("|"); document.getElementById("中文船名").innerHTML=result; } } 问题:现在假如粘贴的数据有英文船名、航次、IMO号,点击“一键解析”按钮后,标记中的黄色部分应该怎样写才能自动解析分解录入内容,而且要一一对应的填入到当前页面对应的元素空格内? |
||||
-- 作者:有点蓝 -- 发布时间:2024/3/17 20:40:00 -- var vals=result.split("|"); document.getElementById("中文船名").innerHTML=vals[0]; ……
|
||||
-- 作者:ycs5801 -- 发布时间:2024/3/17 23:11:00 --
那个按钮和解析想放在最上边,还是不对,看看哪个地方弄错了?现在提示end with不对。
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/18 8:47:00 -- 编辑器里有明显的波浪线提示的 |
||||
-- 作者:ycs5801 -- 发布时间:2024/3/18 9:13:00 -- 此主题相关图片如下:qq截图20240318091247.png 改完了,现在这样 |