#
Junjie
2024-01-03 f1c71ac24732d123329f681e9cba796f7e923e16
#
8个文件已添加
766 ■■■■■ 已修改文件
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/entity/BasBarcode.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/mapper/BasBarcodeMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/BasBarcodeService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/BasBarcodeServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-common/src/main/resources/mapper/wms/BasBarcodeMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/BasBarcodeController.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/webapp/static/js/basBarcode/basBarcode.js 347 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/webapp/views/basBarcode/basBarcode.html 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/entity/BasBarcode.java
New file
@@ -0,0 +1,89 @@
package com.zy.asrs.common.wms.entity;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.common.sys.entity.User;
import com.zy.asrs.common.sys.entity.Host;
import com.zy.asrs.common.sys.service.UserService;
import com.zy.asrs.common.sys.service.HostService;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("wms_bas_barcode")
public class BasBarcode implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 条码值
     */
    @ApiModelProperty(value= "条码值")
    private String barcode;
    /**
     * 创建时间
     */
    @ApiModelProperty(value= "创建时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 仓库ID
     */
    @ApiModelProperty(value= "仓库ID")
    private Long hostId;
    public BasBarcode() {}
    public BasBarcode(Long id,String barcode,Date createTime,Long hostId) {
        this.id = id;
        this.barcode = barcode;
        this.createTime = createTime;
        this.hostId = hostId;
    }
//    BasBarcode basBarcode = new BasBarcode(
//            null,    // ID[非空]
//            null,    // 条码值
//            null,    // 创建时间
//            null    // 授权商户
//    );
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public String getHostId$(){
        HostService service = SpringUtils.getBean(HostService.class);
        Host host = service.getById(this.hostId);
        if (!Cools.isEmpty(host)){
            return String.valueOf(host.getName());
        }
        return null;
    }
}
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/mapper/BasBarcodeMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.common.wms.mapper;
import com.zy.asrs.common.wms.entity.BasBarcode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface BasBarcodeMapper extends BaseMapper<BasBarcode> {
}
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/BasBarcodeService.java
New file
@@ -0,0 +1,8 @@
package com.zy.asrs.common.wms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.asrs.common.wms.entity.BasBarcode;
public interface BasBarcodeService extends IService<BasBarcode> {
}
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/BasBarcodeServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.common.wms.service.impl;
import com.zy.asrs.common.wms.mapper.BasBarcodeMapper;
import com.zy.asrs.common.wms.entity.BasBarcode;
import com.zy.asrs.common.wms.service.BasBarcodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service("basBarcodeService")
public class BasBarcodeServiceImpl extends ServiceImpl<BasBarcodeMapper, BasBarcode> implements BasBarcodeService {
}
zy-asrs-common/src/main/resources/mapper/wms/BasBarcodeMapper.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.asrs.common.wms.mapper.BasBarcodeMapper">
</mapper>
zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/BasBarcodeController.java
New file
@@ -0,0 +1,123 @@
package com.zy.asrs.wms.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.asrs.common.wms.entity.BasBarcode;
import com.zy.asrs.common.wms.service.BasBarcodeService;
import com.zy.asrs.framework.annotations.ManagerAuth;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.framework.domain.KeyValueVo;
import com.zy.asrs.framework.common.DateUtils;
import com.zy.asrs.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
public class BasBarcodeController extends BaseController {
    @Autowired
    private BasBarcodeService basBarcodeService;
    @RequestMapping(value = "/basBarcode/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(basBarcodeService.getById(String.valueOf(id)));
    }
    @RequestMapping(value = "/basBarcode/page/auth")
    @ManagerAuth
    public R page(@RequestParam(defaultValue = "1") Integer curr,
                  @RequestParam(defaultValue = "10") Integer limit,
                  @RequestParam(required = false) String condition,
                  @RequestParam(required = false) String timeRange,
                  @RequestParam Map<String, Object> param) {
        LambdaQueryWrapper<BasBarcode> wrapper = new LambdaQueryWrapper<>();
        if (!Cools.isEmpty(condition)) {
            wrapper.like(BasBarcode::getId, condition);
        }
        if (!Cools.isEmpty(timeRange)) {
            String[] range = timeRange.split(RANGE_TIME_LINK);
            wrapper.ge(BasBarcode::getCreateTime, DateUtils.convert(range[0]));
            wrapper.le(BasBarcode::getCreateTime, DateUtils.convert(range[1]));
        }
        return R.ok(basBarcodeService.page(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/basBarcode/add/auth")
    @ManagerAuth
    public R add(BasBarcode basBarcode) {
        basBarcodeService.save(basBarcode);
        return R.ok();
    }
    @RequestMapping(value = "/basBarcode/update/auth")
    @ManagerAuth
    public R update(BasBarcode basBarcode){
        if (Cools.isEmpty(basBarcode) || null==basBarcode.getId()){
            return R.error();
        }
        basBarcodeService.updateById(basBarcode);
        return R.ok();
    }
    @RequestMapping(value = "/basBarcode/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Long[] ids){
         for (Long id : ids){
            basBarcodeService.removeById(id);
        }
        return R.ok();
    }
    @RequestMapping(value = "/basBarcodeQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        LambdaQueryWrapper<BasBarcode> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(BasBarcode::getId, condition);
        Page<BasBarcode> page = basBarcodeService.page(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (BasBarcode basBarcode : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", basBarcode.getId());
            map.put("value", basBarcode.getId());
            result.add(map);
        }
        return R.ok(result);
    }
    @RequestMapping("/basBarcode/all/get/kv")
    @ManagerAuth
    public R getDataKV(@RequestParam(required = false) String condition) {
        List<KeyValueVo> vos = new ArrayList<>();
        LambdaQueryWrapper<BasBarcode> wrapper = new LambdaQueryWrapper<>();
        if (!Cools.isEmpty(condition)) {
            wrapper.like(BasBarcode::getId, condition);
        }
        basBarcodeService.page(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getId()), item.getId())));
        return R.ok().add(vos);
    }
    @RequestMapping(value = "/basBarcode/generateBarcode/auth")
    @ManagerAuth
    public R generateBarcode(@RequestParam("barcode") String barcode, @RequestParam("num") Integer num) {
        Long hostId = getHostId();
        Date now = new Date();
        int barcodeInt = Integer.parseInt(barcode);
        for (int i = 0; i < num; i++) {
            barcodeInt += 1;
            BasBarcode basBarcode = new BasBarcode();
            basBarcode.setBarcode(String.valueOf(barcodeInt));
            basBarcode.setHostId(hostId);
            basBarcode.setCreateTime(now);
            basBarcodeService.save(basBarcode);
        }
        return R.ok();
    }
}
zy-asrs-wms/src/main/webapp/static/js/basBarcode/basBarcode.js
New file
@@ -0,0 +1,347 @@
var pageCurr;
var pageCount = 0;
var printBarcodes = [];
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin', 'xmSelect'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    var admin = layui.admin;
    var xmSelect = layui.xmSelect;
    // 数据渲染
    tableIns = table.render({
        elem: '#basBarcode',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/basBarcode/page/auth',
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#toolbar',
        cellMinWidth: 50,
        height: 'full-120',
        cols: [[
            {type: 'checkbox'}
            ,{field: 'id', align: 'center',title: 'ID'}
            ,{field: 'barcode', align: 'center',title: '条码值'}
            ,{field: 'createTime$', align: 'center',title: '创建时间'}
            ,{field: 'hostId$', align: 'center',title: '仓库ID'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
        ]],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;pageCount=count;
            limit();
        }
    });
    // 监听排序事件
    table.on('sort(basBarcode)', function (obj) {
        var searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        searchData['orderByField'] = obj.field;
        searchData['orderByType'] = obj.type;
        tableIns.reload({
            where: searchData,
            page: {curr: 1}
        });
    });
    // 监听头工具栏事件
    table.on('toolbar(basBarcode)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id).data;
        switch(obj.event) {
            case 'addData':
                showEditModel();
                break;
            case 'deleteData':
               if (checkStatus.length === 0) {
                   layer.msg('请选择要删除的数据', {icon: 2});
                   return;
               }
               del(checkStatus.map(function (d) {
                   return d.id;
               }));
               break;
            case 'exportData':
                admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
                        if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
                            titles.push(col.title);
                            fields.push(col.field);
                        }
                    });
                    var exportData = {};
                    $.each($('#search-box [name]').serializeArray(), function() {
                        exportData[this.name] = this.value;
                    });
                    var param = {
                        'basBarcode': exportData,
                        'fields': fields
                    };
                    $.ajax({
                        url: baseUrl+"/basBarcode/export/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: JSON.stringify(param),
                        dataType:'json',
                        contentType:'application/json;charset=UTF-8',
                        method: 'POST',
                        success: function (res) {
                            layer.closeAll();
                            if (res.code === 200) {
                                table.exportFile(titles,res.data,'xls');
                            } else if (res.code === 403) {
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg, {icon: 2})
                            }
                        }
                    });
                });
                break;
            // 批量打印
            case 'btnPrintBatch':
                printBarcodes = [];
                var data = checkStatus;
                if (data.length === 0){
                    layer.msg('请选择打印数据');
                } else {
                    layer.open({
                        type: 1,
                        title: '批量打印 [数量'+ data.length +']',
                        area: ['500px', '500px'],
                        shadeClose: true,
                        content: $('#printDataDiv'),
                        success: function(layero, index){
                            for (var i = 0; i<data.length;i++) {
                                printBarcodes.push({
                                    barcode: data[i].barcode
                                });
                            }
                        },
                        end: function () {
                        }
                    });
                }
                break;
        }
    });
    // 监听行工具事件
    table.on('tool(basBarcode)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            case 'edit':
                showEditModel(data);
                break;
            case "del":
                del([data.id]);
                break;
        }
    });
    // 模板选择
    form.on('radio(selectTemplateRadio)', function (data) {
        $('.template-preview').hide();
        $('#template-preview-'+data.value).show();
    });
    // 开始打印
    form.on('submit(doPrint)', function (data) {
        var templateNo = data.field.selectTemplate;
        layer.closeAll();
        for (let i = 0; i < printBarcodes.length; i++) {
            var templateDom = $("#templatePreview" + templateNo);
            var className = templateDom.attr("class");
            if (className === 'template-barcode') {
                printBarcodes[i]["barcodeUrl"] = baseUrl + "/mac/code/auth?type=1&param=" + printBarcodes[i].barcode;
            } else {
                printBarcodes[i]["barcodeUrl"] = baseUrl + "/mac/code/auth?type=2&param=" + printBarcodes[i].barcode;
            }
        }
        console.log(printBarcodes)
        var tpl = templateDom.html();
        console.log(tpl)
        var template = Handlebars.compile(tpl);
        console.log(template)
        var html = template({code:200, data: printBarcodes});
        console.log(html)
        var box = $("#box");
        box.html(html);box.show();
        box.print({mediaPrint:true});
        box.hide();
    });
    /* 弹窗 - 新增、修改 */
    function showEditModel(mData) {
        admin.open({
            type: 1,
            area: '600px',
            title: (mData ? '修改' : '添加') + '',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                form.val('detail', mData);
                layDateRender(mData);
                form.on('submit(editSubmit)', function (data) {
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl+"/basBarcode/"+(mData?'update':'generateBarcode')+"/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: data.field,
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            if (res.code === 200){
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                tableReload();
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            }else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }
                    })
                    return false;
                });
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                layui.form.render('select');
            }
        });
    }
    /* 删除 */
    function del(ids) {
        layer.confirm('确定要删除选中数据吗?', {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
            layer.close(i);
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl+"/basBarcode/delete/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {ids: ids},
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200){
                        layer.msg(res.msg, {icon: 1});
                        tableReload();
                    } else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            })
        });
    }
    // 搜索
    form.on('submit(search)', function (data) {
        pageCurr = 1;
        tableReload(true);
    });
    // 重置
    form.on('submit(reset)', function (data) {
        pageCurr = 1;
        clearFormVal($('#search-box'));
        tableReload(true);
    });
    // 时间选择器
    function layDateRender(data) {
        setTimeout(function () {
            layDate.render({
                elem: '.layui-laydate-range'
                ,type: 'datetime'
                ,range: true
            });
            layDate.render({
                elem: '#createTime\\$',
                type: 'datetime',
                value: data!==undefined?data['createTime$']:null
            });
        }, 100);
    }
    layDateRender();
    window.loadHostSel = function () {
        return xmSelect.render({
            el: '#hostXmlSel',
            autoRow: true,
            filterable: true,
            remoteSearch: true,
            radio: true,
            remoteMethod: function (val, cb, show) {
                $.ajax({
                    url: baseUrl + "/host/all/get/kv",
                    headers: {'token': localStorage.getItem('token')},
                    data: {
                        condition: val
                    },
                    method: 'POST',
                    success: function (res) {
                        if (res.code === 200) {
                            cb(res.data)
                        } else {
                            cb([]);
                            layer.msg(res.msg, {icon: 2});
                        }
                    }
                });
            }
        });
    }
});
// 关闭动作
$(document).on('click','#data-detail-close', function () {
    parent.layer.closeAll();
});
function tableReload(search) {
    if (pageCount === 0 || search) {
        let searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        tableIns.reload({
            where: searchData,
            page: {curr: pageCurr}
        });
    } else {
        $(".layui-laypage-btn")[0].click();
    }
}
zy-asrs-wms/src/main/webapp/views/basBarcode/basBarcode.html
New file
@@ -0,0 +1,170 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form toolbar" id="search-box">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline" style="width: 300px">
                        <div class="layui-input-inline">
                            <input class="layui-input layui-laydate-range" name="timeRange" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="search" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <button class="layui-btn icon-btn" lay-filter="reset" lay-submit>
                            <i class="layui-icon">&#xe666;</i>重置
                        </button>
                    </div>
                </div>
            </div>
            <table class="layui-hide" id="basBarcode" lay-filter="basBarcode"></table>
        </div>
    </div>
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-btnPrintBatch" lay-event="btnPrintBatch">批量打印</button>
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">生成条码</button>
        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a>
</script>
<!-- 打印操作弹窗 -->
<div id="printDataDiv" style="display: none;padding: 20px">
    <div class="layui-form" style="text-align: center">
        <hr>
        <!--单选框-->
        <div class="layui-form-item" style="display: inline-block; margin-bottom: 10px">
            <input type="radio" name="selectTemplate" value="1" title="模板一" lay-filter="selectTemplateRadio" checked="">
            <input type="radio" name="selectTemplate" value="2" title="模板二" lay-filter="selectTemplateRadio">
        </div>
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;text-align: left;">
            <legend>打印预览</legend>
            <div id="template-container" style="margin: 20px;text-align: center">
                <!-- 预览图 1 -->
                <div id="template-preview-1" class="template-preview" style="display: inline-block">
                    <div class="barcode">
                        <img class="template-code template-barcode" src="">
                        <div style="letter-spacing: 2px;margin-top: 1px; text-align: center;">
                            <span>xxxxxx</span>
                        </div>
                    </div>
                </div>
                <!-- 预览图 2 -->
                <div id="template-preview-2" class="template-preview" style="display: none">
                    <div>
                        <img class="template-code template-qrcode" src="">
                        <div style="letter-spacing: 1px;margin-top: 1px; text-align: center">
                            <span>xxxxxx</span>
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
        <button class="layui-btn" id="doPrint" lay-submit lay-filter="doPrint" style="margin-top: 20px">确定</button>
    </div>
</div>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/jquery/jQuery.print.js"></script>
<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/basBarcode/basBarcode.js" charset="utf-8"></script>
</body>
<div id="box" style="display: block"></div>
<!-- 初始化打印模板的条形码 -->
<script type="text/javascript">
    $('.template-barcode').attr("src", baseUrl + "/mac/code/auth?type=1&param=123123123");
    $('.template-qrcode').attr("src", baseUrl + "/mac/code/auth?type=2&param=123123123");
</script>
<!-- 模板引擎 -->
<!-- 模板1 -->
<script type="text/template" id="templatePreview1" class="template-barcode">
    {{#each data}}
    <div class="barcode" style="margin-top: 20px;width: 200px;text-align: center;">
        <div>
            <img class="template-code template-barcode" src="{{this.barcodeUrl}}" width="100%">
        </div>
        <div style="letter-spacing: 2px;margin-top: 1px;">
            <span>{{this.barcode}}</span>
        </div>
    </div>
    {{/each}}
</script>
<!-- 模板2 -->
<script type="text/template" id="templatePreview2" class="template-qrcode">
    {{#each data}}
    <div style="margin-top: 20px;width: 200px;text-align: center;">
        <img class="template-code template-qrcode" src="{{this.barcodeUrl}}">
        <div style="letter-spacing: 1px;margin-top: 1px; text-align: center">
            <span>{{this.barcode}}</span>
        </div>
    </div>
    {{/each}}
</script>
<!-- 表单弹窗 -->
<script type="text/html" id="editDialog">
    <div id="detail" lay-filter="detail" class="layui-form admin-form model-form">
        <input name="id" type="hidden">
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">条码起始值: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="barcode" placeholder="请输入条码起始值">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">生成数量: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="num" placeholder="请输入生成数量">
                    </div>
                </div>
             </div>
        </div>
        <hr class="layui-bg-gray">
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="editSubmit" lay-submit="">生成</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </div>
</script>
</html>