| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item cool-button-contain"> |
| | | <button class="layui-btn layui-btn-normal" lay-filter="print" lay-submit="">打印</button> |
| | | <button class="layui-btn layui-btn-normal" id="print" lay-filter="print" lay-submit="">打印</button> |
| | | <button class="layui-btn layui-btn-primary" id="cancel">取消</button> |
| | | </div> |
| | | </form> |
| | |
| | | let form = layui.form; |
| | | |
| | | form.on('submit(print)', function (data) { |
| | | http.post(baseUrl + '/trayCode/print/preview', data.field, function (res) { |
| | | |
| | | console.log(res.data) |
| | | $.ajax({ |
| | | url: baseUrl+"/trayCode/print/preview", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | for (let i=0;i<res.data.length;i++){ |
| | | res.data[i]["barcodeUrl"]=baseUrl+"/macCode/code/auth?type=1¶m="+res.data[i].item; |
| | | } |
| | | parent.printPreview(res); |
| | | // parent.layer.close(parent.layer.getFrameIndex(window.name)); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | $('#cancel').click(function () { |
| | | var index = parent.layer.getFrameIndex(window.name); |
| | | parent.layer.close(index); |
| | | parent.layer.close(parent.layer.getFrameIndex(window.name)); |
| | | }) |
| | | |
| | | }); |