#
luxiaotao1123
2021-04-07 86fb7988d3597c0e66a5e063f385a213849253bf
#
5个文件已修改
128 ■■■■ 已修改文件
src/main/java/zy/cloud/wms/manager/controller/MatController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/manager/controller/TagController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/mat/mat.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pda/selectMat.html 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/tag/tag.html 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/manager/controller/MatController.java
@@ -33,6 +33,18 @@
    @Autowired
    private MatService matService;
    @RequestMapping(value = "/mat/list/pda/auth")
    @ManagerAuth
    public R pdaList(@RequestParam(defaultValue = "1")Integer curr,
                     @RequestParam(defaultValue = "10")Integer limit,
                     @RequestParam(required = true)Long tagId){
        EntityWrapper<Mat> wrapper = new EntityWrapper<>();
        wrapper.eq("tag_id", tagId);
        wrapper.orderBy("create_time", false);
        List<Mat> mats = matService.selectList(wrapper);
        return R.ok().add(mats);
    }
    @RequestMapping(value = "/mat/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
src/main/java/zy/cloud/wms/manager/controller/TagController.java
@@ -33,8 +33,10 @@
    @ManagerAuth
    public R pdaList(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam Map<String, Object> param){
                  @RequestParam(required = false)Long parentId){
        EntityWrapper<Tag> wrapper = new EntityWrapper<>();
        wrapper.eq("parent_id", parentId==null?getOriginTag().getId():parentId);
        wrapper.orderBy("sort");
        List<Tag> tags = tagService.selectList(wrapper);
        return R.ok().add(tags);
    }
src/main/webapp/static/js/mat/mat.js
@@ -360,7 +360,7 @@
                    var tpl = templateDom.html();
                    var template = Handlebars.compile(tpl);
                    var html = template(res);
                    let box = $("#box");
                    var box = $("#box");
                    box.html(html);box.show();
                    box.print({mediaPrint:true});
                    box.hide();
src/main/webapp/views/pda/selectMat.html
@@ -72,53 +72,107 @@
<header>
    <div class="search-box">
        <input type="text">
        <input type="text" placeholder="请输入商品编码/名称">
        <button>
            <i class="layui-icon">&#xe615;</i>
        </button>
    </div>
</header>
<main>
    <div class="box-item">
        <div class="box-item-label">尼龙头螺丝盒装</div>
    </div>
    <div class="box-item">
        <div class="box-item-label">尼龙头螺丝盒装</div>
    </div>
    <div class="box-item">
        <div class="box-item-label">尼龙头螺丝盒装</div>
    </div>
    <div class="box-item">
        <div class="box-item-label">尼龙头螺丝盒装</div>
    </div>
    <div class="box-item">
        <div class="box-item-label">尼龙头螺丝盒装</div>
    </div>
    <div class="box-item">
        <div class="box-item-label">尼龙头螺丝盒装</div>
    </div>
<main id="main-contain">
</main>
</body>
<script>
    $(function () {
        showTag();
    })
    $(document).on('click','.box-item', function () {
        var tagId = $(this).children('input').get(0).value;
        showTag(tagId);
    })
    // 展示归类
    function showTag(parentId){
        $.ajax({
            url: baseUrl + "/tag/list/pda/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                parentId: parentId
            },
            method: 'POST',
            success: function (res) {
                if (res.code === 200) {
                    if (res.data != null && res.data.length > 0) {
                        console.log(res.data)
                        var tplDom = $("#tagTpl");
                        var tpl = tplDom.html();
                        var template = Handlebars.compile(tpl);
                        var html = template(res);
                        $('#main-contain').html(html);
                    } else {
                        var tagId = parentId;
                        showMat(tagId);
                    }
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/pda";
                } else {
                    parent.layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }
    // 展示商品
    function showMat(tagId) {
        if (isEmpty(tagId)) {
            return;
        }
        $.ajax({
            url: baseUrl + "/mat/list/pda/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                tagId: tagId
            },
            method: 'POST',
            success: function (res) {
                if (res.code === 200) {
                    if (res.data != null && res.data.length > 0) {
                        console.log(res.data)
                        var tplDom = $("#matTpl");
                        var tpl = tplDom.html();
                        var template = Handlebars.compile(tpl);
                        var html = template(res);
                        $('#main-contain').html(html);
                    } else {
                    }
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/pda";
                } else {
                    parent.layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }
</script>
<script type="text/template" id="tagTpl">
    {{#each data}}
    <option value="{{this}}">{{this}}</option>
    <div class="box-item">
        <input name="tagId" type="hidden" value="{{this.id}}">
        <div class="box-item-label">{{this.name}}</div>
    </div>
    {{/each}}
</script>
<script type="text/template" id="matTpl">
    {{#each data}}
    <option value="{{this}}">{{this}}</option>
    <div class="box-item">
        <input name="matId" type="hidden" value="{{this.id}}">
        <div class="box-item-label">{{this.maktx}}</div>
    </div>
    {{/each}}
</script>
</html>
src/main/webapp/views/tag/tag.html
@@ -92,9 +92,9 @@
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">简要描述</label>
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input name="brief" placeholder="请输入简要描述" class="layui-input">
                        <input name="sort" placeholder="请输入排序" class="layui-input">
                    </div>
                </div>
@@ -157,7 +157,7 @@
                ,{field: 'img', align: 'center',title: '图片', hide: true}
                // ,{field: 'brief', align: 'center',title: '简要描述'}
                // ,{field: 'count', align: 'center',title: '数量'}
                ,{field: 'sort', align: 'center',title: '排序', hide: true}
                ,{field: 'sort', align: 'center',title: '排序'}
                ,{field: 'status$', align: 'center',title: '状态'}
                ,{field: 'updateTime$', align: 'center',title: '修改时间'}
                ,{field: 'updateBy$', align: 'center',title: '修改人员', hide: true}