| | |
| | | <header> |
| | | <div class="layui-input-inline"> |
| | | <label class="layui-form-label">条码</label> |
| | | <input class="layui-input" type="text" id="code" placeholder="扫码 / 输入" autocomplete="off"> |
| | | <input class="layui-input" type="number" id="code" onkeyup="findCode(this)" placeholder="扫码 / 输入" autocomplete="off"> |
| | | </div> |
| | | <div style="margin: 5px 5px"> |
| | | <button id="mat-btn" type="button" class="layui-btn layui-btn-normal" onclick="getMat()"><i class="layui-icon">+</i>提取</button> |
| | |
| | | |
| | | window.onload = function(){document.getElementById("code").focus();} |
| | | |
| | | function findCode(el) { |
| | | if (el.value.length === 8) { |
| | | $('#mat-btn').focus(); |
| | | getMat(); |
| | | } |
| | | } |
| | | |
| | | var matCodeLayerIdx; |
| | | function getMat() { |
| | | matCodeLayerIdx = layer.open({ |
| | |
| | | $('#code').val(""); |
| | | matData = []; |
| | | tableIns.reload({data: matData}); |
| | | tips(""); |
| | | } |
| | | |
| | | // 组托 |
| | |
| | | * @param warn true:红色字体 |
| | | */ |
| | | function tips(msg, warn) { |
| | | let tips = $('#tips'); |
| | | tips.html(msg); |
| | | tips.css("color", warn?"red":'#666'); |
| | | // var tips = $('#tips'); |
| | | // tips.html(msg); |
| | | // tips.css("color", warn?"red":'#666'); |
| | | layer.msg(msg, {icon: warn?2:1}) |
| | | } |
| | | |
| | | document.onkeyup = function (e) { |
| | |
| | | $("#comb-btn").focus(); |
| | | comb(); |
| | | } else if (key === 113) { |
| | | $("#code").val(""); |
| | | $("#code").focus(); |
| | | } |
| | | } |