|  |  |  | 
|---|
|  |  |  | text-overflow:ellipsis; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #confirm { | 
|---|
|  |  |  | margin-top: 10px; | 
|---|
|  |  |  | padding: 5px 20px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <div class="form-box"> | 
|---|
|  |  |  | <div class="form-item"> | 
|---|
|  |  |  | <span>物料编码</span> | 
|---|
|  |  |  | <input id="matNo" type="text" placeholder="扫码/输入"> | 
|---|
|  |  |  | <input id="matNo" type="text" placeholder="扫码 / 输入" onkeyup="find(this)" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="form-item"> | 
|---|
|  |  |  | <span>物料名称</span> | 
|---|
|  |  |  | <input type="text" disabled="disabled" value="111111111111111111111111111111111111111111"> | 
|---|
|  |  |  | <input id="matName" type="text" disabled="disabled"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="form-item"> | 
|---|
|  |  |  | <span>物料描述</span> | 
|---|
|  |  |  | <input type="text" disabled="disabled"> | 
|---|
|  |  |  | <span>物料规格</span> | 
|---|
|  |  |  | <input id="str2" type="text" disabled="disabled"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="form-item"> | 
|---|
|  |  |  | <span>单位</span> | 
|---|
|  |  |  | <input type="text" disabled="disabled"> | 
|---|
|  |  |  | <input id="str1" type="text" disabled="disabled"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="form-item"> | 
|---|
|  |  |  | <span style="vertical-align: middle">数量</span> | 
|---|
|  |  |  | <div class="number-tool" style="vertical-align: middle"> | 
|---|
|  |  |  | <button>+</button><input type="number" value="1"><button>-</button> | 
|---|
|  |  |  | <button onclick="reduce()">-</button><input id="count" type="number"><button onclick="add()">+</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <button id="confirm">提取</button> | 
|---|
|  |  |  | <button id="confirm" onclick="confirm()">提取</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | var countDom = $('#count'); | 
|---|
|  |  |  | var initMatCount = 1; | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | layui.use(['table','laydate', 'form'], function() { | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据物料编码查询物料详情 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | function find(el){ | 
|---|
|  |  |  | if (isEmpty(el.value)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl + "/matCode/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | id: el.value | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | if (res.data != null) { | 
|---|
|  |  |  | $('#matName').val(res.data.matName); | 
|---|
|  |  |  | $('#str1').val(res.data.str1); | 
|---|
|  |  |  | $('#str2').val(res.data.str2); | 
|---|
|  |  |  | countDom.focus().val(initMatCount) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl + "/pda"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | alert(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 提取 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | function confirm(){ | 
|---|
|  |  |  | var data = { | 
|---|
|  |  |  | matNo: $('#matNo').val(), | 
|---|
|  |  |  | matName: $('#matName').val(), | 
|---|
|  |  |  | count: countDom.val() | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | parent.addTableData(data); | 
|---|
|  |  |  | parent.layer.close(parent.matCodeLayerIdx); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | window.onload = function(){document.getElementById("matNo").focus();} | 
|---|
|  |  |  | $(document).on('click','#confirm', function () { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function add() { | 
|---|
|  |  |  | countDom.val(Number(countDom.val()) + 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function reduce() { | 
|---|
|  |  |  | if (countDom.val() <= initMatCount) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | countDom.val(countDom.val() - 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | </html> | 
|---|