| | |
| | | @RequestMapping(value = "/macCode/barcode/auth") |
| | | // @ManagerAuth(memo = "物料编码条形码获取") |
| | | public R matCodeBarcode(@RequestParam String param, HttpServletResponse response) throws IOException { |
| | | if (Cools.isEmpty(param)){ |
| | | System.out.println(1); |
| | | return R.parse(BaseRes.EMPTY); |
| | | } |
| | | BufferedImage img = BarcodeUtils.encode(param); |
| | | if (!ImageIO.write(img, "jpg", response.getOutputStream())) { |
| | | throw new IOException("Could not write an image of format jpg"); |
| | |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | layer.closeAll(); |
| | | for (let i=0;i<res.data.length;i++){ |
| | | res.data[i].barcodeUrl=baseUrl+"/macCode/barcode/auth?param="+res.data[i].barcodeUrl; |
| | | } |
| | | console.log(res.data); |
| | | var tpl = $("#templatePreview"+templateNo).html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | $("#box").html(html); |
| | | $("#box").print(); |
| | | // $('#template-preview-'+templateNo).print(); |
| | | let box = $("#box"); |
| | | box.html(html);box.show();box.print();box.hide(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl; |
| | | }else { |
| | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | }) |
| | | |
| | | // 数据保存动作 |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div id="box" style="display: block"> |
| | | <div id="box" style="display: block"></div> |
| | | |
| | | <!-- 模板引擎 --> |
| | | <!-- 模板1 --> |
| | |
| | | <tr> |
| | | <td colspan="1" align="right" scope="col">条码</td> |
| | | <td class="barcode"colspan="3" align="left" scope="col"> |
| | | <img class="qrcode" src="/macCode/barcode/auth?param={{this.barcode}}" width="80%"> |
| | | <img class="qrcode" src="/macCode/barcode/auth?param={{this.barcodeUrl}}" width="80%"> |
| | | </td> |
| | | </tr> |
| | | <tr> |