以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  扫码加查询  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=193500)

--  作者:13559187297
--  发布时间:2024/9/20 11:25:00
--  扫码加查询
怎么实现:扫码后在设备编号上输入扫码内容,根据扫码内容在“设备表”上查询相同的设备编号,将其设备名称输入到其输入框中;

With wb.AddInputGroup("form1", "ipg1", "设备维护")
        With .AddInputCell("ic1")
            .AddLabel("lbh", "设备编号", 0)
            .AddInput("number", "text", 1)
            .AddVcodeButton("scan", "扫码输入", 2) 
        End With
        With .AddInputCell("ic2")
            .AddLabel("lbh2", "设备名称", 0)
            .AddInput("设备名称", "text", 1)
        End With

--  作者:有点蓝
--  发布时间:2024/9/20 11:33:00
--  
http://www.foxtable.com/mobilehelp/topics/0247.htmhttp://www.foxtable.com/mobilehelp/topics/0108.htm

2、在d:\\web\\lib目录下新建一个文本文件jssdk.js,内容为:

wx.ready(function () {
    document.getElementById(\'
scan\').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: [\'qrCode\',\'barCode\'],
            success: function (res) {
                document.getElementById(\'
number
\').value = res.resultStr;
var result = sendAjaxText(res.resultStr,"查询.htm","",false);
document.getElementById("设备名称").value =result;
            }
        });
    };
});
wx.error(function (res) {
    //alert(res.errMsg);
});

后台代码
    Case "查询.htm"
        dim 编号 as string = e.PlainText
dim dr as datarow = datatables("表A").find("编号=\'" & 编号 & "\'")
if dr isnot nothing
         e.WriteString(dr("名称"))
else
         e.WriteString("没有编号对应的名称")
end if
[此贴子已经被作者于2024/9/20 11:33:05编辑过]