以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 移动端显示图片 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=160370) |
||||
-- 作者:ouyangfenghuan -- 发布时间:2021/1/30 22:58:00 -- 移动端显示图片 在移动端录入报表时,想输入"订单编号"后回调输入产品名称的同时显示产品的图片.原来代码如下,请指导改动: Dim e As RequestEventArgs = args(0) Dim wb As New weui If e.PostValues.Count = 0 Then \'生成增加订单网页 wb.AddTopTips("","toptip1","") \'用于显示动态错误提示 wb.AddForm("","form1","addnew.htm") .Attribute="" \'验证表单receive.htm With wb.AddInputGroup("form1","ipg1","增加报表") Dim xm As String = e.Cookies("username") xm= DecryptText(xm,"123","123") With .AddInput("姓名","姓名","text") .Value= xm \'.AddHiddenValue后面做隐藏的 .Readonly=True End With Dim gjs As List(of String) = DataTables("员工资料表").sqlGetValues("设备","排计划= 1","序号") With .AddSelect("机台","机台","|" & String.Join("|",gjs.ToArray)) \'.Attribute = "" \'调用js函数. .Required =True .Attribute = "" End With With .AddInput("订单编号","订单编号R","number") \'写在一起,如 " .Attribute = """ End With .AddInput("产品","产品","").Readonly=True .AddInput("订单数量","订单数量","number").Readonly=True \'自动输入订单数量 \'如果录入订单编号就 插入图片 不知道怎么写 Dim tpstring As String = "默认图片" wb.InsertHTML("<img src=\'./images/" & tpstring & "\' width=\'200px\'/>") \'有问题 With .AddSelect("工序","工序","") .Attribute = "" End With .AddInput("详细工作内容","详情","text").Placeholder= "可输入详细内容:如机台维护,换刀..." Dim time As Date = #00:01:00# \'With .AddInputCell("ic3",2) \'通过InputCell增加输入框, 2表示突出显示(含图标) \'.AddLabel("lmm","机器时间",0) \'增加标签,0显示在左边 \'.AddInput("机器时间","机器时间",1).value = Format(time,"HH:mm:ss") \'.PlaceHolder= "请输入密码" \'增加输入框,1表示显示在中间 \'End With With .AddInput("机器时间","机器时间","text") .value = Format(time,"HH:mm:ss") End With .AddInput("单次数量生产","单次数量","number").Value =1 Dim Date1 As Date = Date.Now .AddInput("起始时间","起始日期","datetime-local").value = Format(Date1,"yyyy-MM-ddT08:00") .AddInput("结束时间","结束日期","datetime-local").value = format(Date1,"yyyy-MM-ddT08:00") .AddInput("实际产量","实际产量","number") With .AddUploader("质检报告图片","检验报表/交货照片",False) .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 \' .Rotate = 1 \'顺时钟旋转90° .ScaleWidth = 1500 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With With wb.AddButtonGroup("form1","btg1",True) With .Add("btn1", "确定提交", "button") .Kind = 0 \' .Attribute= "" \'调用js函数上传 .Attribute=""" End With .add("btn2","返回主页","","default.htm").Kind = 1 End With wb.AddToast("","tst1", "正在上传",1) wb.AddToast("","tst2", "上传成功",0) wb.AddToast("","tst3", "上传失败",0).Icon= "warn" End With Else \'保存新增的订单 Dim dr As DataRow = DataTables("生产日报表").AddNew() Dim nms() As String = {"姓名","机台","订单编号","工序","机器时间","单次数量生产","起始时间","结束时间","实际产量","质检报告图片","详细工作内容"} For Each nm As String In nms dr(nm) = e.PostValues(nm) Next dr.Save() \'先保存一遍,防止后面出错没保存 Dim flm As String \'记录多个文件名 For Each key As String In e.Files.Keys For Each fln As String In e.Files(key) If fln IsNot Nothing Then e.SaveFile(key,fln,"d:\\myftp\\sctp\\" & fln) \'保存接收到的文件 flm = flm & vbcrlf & "/sctp/" & fln \' End If Next Next flm = flm.TrimStart() dr("质检报告图片")= flm Dim p As String = IIF(dr.RowState = DataRowState.Added, "A#", "U#") dr.Save() Dim msg As String = p & dr.DataTable.Name & "#" & dr("_Identify") e.WriteString("OK") End If wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 getCodes.html 代码 Dim e As RequestEventArgs = args(0) Dim dr As DataRow = DataTables("订单表").SQLFind("订单表序号=\'R" & e.Values("订单编号") & "\'") If dr IsNot Nothing Then Dim dr1 As DataRow = DataTables("产品资料表").SQLFind("产品名称= \'" & dr("产品名称") & "\'") If dr1 IsNot Nothing Then e.WriteString(dr("产品名称") & "|" & dr("订单数量") & "|" & dr1("图片")) Else e.WriteString(dr("产品名称") & "|" & dr("订单数量")) End If End If [此贴子已经被作者于2021/1/30 23:08:23编辑过]
|
||||
-- 作者:ouyangfenghuan -- 发布时间:2021/1/30 23:12:00 --
|
||||
-- 作者:有点蓝 -- 发布时间:2021/1/31 20:27:00 -- wb.InsertHTML("<img id=\'xxxx1\' src=\'./images/" & tpstring & "\' width=\'200px\'/>") function setCodes(){ var result= submitAjaxFileds(\'getCodes.htm\',\'\',\'订单编号\',false); if(result){ var vals=result.split("|"); if(vals.length==2){ document.getElementById("产品").value=vals[0]; document.getElementById("订单数量").value=vals[1];
document.getElementById("xxxx1").src=vals[2];
\'这里不知道怎么改
} } } |
||||
-- 作者:ouyangfenghuan -- 发布时间:2021/1/31 20:58:00 -- 谢谢,可以调用了. 但有个问题,我要调用的图片放在服务器的D:\\myftp\\yltp,如何引用到这个文件夹呢? 比如值是: 160101-尾盖.JPG 实际图片存放地址是D:\\myftp\\yltp\\160101-尾盖.JPG |
||||
-- 作者:有点蓝 -- 发布时间:2021/1/31 21:02:00 -- 必须放到web路径里:http://www.foxtable.com/mobilehelp/topics/0044.htm |
||||
-- 作者:ouyangfenghuan -- 发布时间:2021/1/31 21:16:00 -- 能否引用FTP地址图片呢? |
||||
-- 作者:有点蓝 -- 发布时间:2021/1/31 22:13:00 -- 不能 |
||||
-- 作者:ouyangfenghuan -- 发布时间:2021/1/31 23:18:00 -- 现在图片显示跑到最后了,如何显示在页面的中间 |
||||
-- 作者:有点蓝 -- 发布时间:2021/1/31 23:36:00 -- http://www.foxtable.com/mobilehelp/topics/0097.htm InsertHTML(Content) Content: 要插入的内容。 wb.InsertHTML("form1","<img id=\'xxxx1\' src=\'./images/" & tpstring & "\' width=\'200px\'/>") |