#
luxiaotao1123
2021-04-07 f0cafdfe0ed4d111d5f71e414e4985e26190d974
src/main/webapp/views/pda/selectMat.html
@@ -19,6 +19,14 @@
            height: 100%;
            background-color: #f1f1f1;
            padding: 5px;
            position: relative;
        }
        /*header {*/
        /*    position: absolute;*/
        /*}*/
        main {
            padding-bottom: 5px;
        }
        /* 头部搜索栏 */
@@ -31,7 +39,7 @@
            border-radius: 20px;
            height: 30px;
            box-shadow: 0 0 3px rgba(0,0,0,.3);
            width: 75%;
            width: 73%;
            padding-left: 15px;
            vertical-align: middle;
        }
@@ -92,8 +100,8 @@
<header>
    <div class="search-box">
        <input type="text" placeholder="请输入商品编码/名称">
        <button>
        <input id="search-msg" type="text" placeholder="请输入商品编码/名称">
        <button onclick="search()">
            <i class="layui-icon">&#xe615;</i>
        </button>
    </div>
@@ -107,6 +115,36 @@
    $(function () {
        showTag();
    })
    // 搜索
    function search(){
        var condition = $('#search-msg').val();
        $.ajax({
            url: baseUrl + "/mat/search/pda/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                condition: condition
            },
            method: 'POST',
            success: function (res) {
                if (res.code === 200) {
                    if (res.data != null && res.data.length > 0) {
                        var tplDom = $("#matTpl");
                        var tpl = tplDom.html();
                        var template = Handlebars.compile(tpl);
                        var html = template(res);
                        $('#main-contain').html(html);
                    } else {
                        $('#main-contain').html('<div style="text-align: center; margin-top: 15px"><span style="font-size: large">暂无商品</span></div>');
                    }
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/pda";
                } else {
                    parent.layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }
    // 归类点击
    $(document).on('click','.box-tag-item', function () {
@@ -136,6 +174,7 @@
                        var template = Handlebars.compile(tpl);
                        var html = template(res);
                        $('#main-contain').html(html);
                        toTop();
                    } else {
                        var tagId = parentId;
                        showMat(tagId);
@@ -169,6 +208,7 @@
                        var template = Handlebars.compile(tpl);
                        var html = template(res);
                        $('#main-contain').html(html);
                        toTop();
                    } else {
                        $('#main-contain').html('<div style="text-align: center; margin-top: 15px"><span style="font-size: large">暂无商品</span></div>');
                    }
@@ -181,6 +221,14 @@
        })
    }
    function toTop() {
        window.scrollTo({
            left: 0,
            top: 0,
            behavior: 'smooth'
        })
    }
</script>
<script type="text/template" id="tagTpl">