laravel框架 layui搜索数据

<li>
  <div class="layui-input-block" style="float: left; position: relative;">
      <label class="layui-form-label">订单搜索</label>
    <input style="width: auto;" type="text" id="select_orderId" name="select_orderId" lay-verify="required" placeholder="请输入订单编号" autocomplete="off" class="layui-input">
  </div>
    <button class="layui-btn" lay-submit="" id="searchBtn" data-type="getInfo" style="float: left;">搜索</button>
</li>
//订单搜索

    $('#searchBtn').on('click',function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
    // 点击获取数据
    var  active = {
        getInfo: function () {
            var orderId=$('#select_orderId').val();
            if (orderId) {
                var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
                setTimeout(function(){
                    table.reload('LAY-app-message-all', { //表格的id
                        url:'/Order/selectByOrderId',
                        where: {
                            'orderId':$.trim(orderId)
                        }
                    });
                    layer.close(index);
                },800);
            } else {
                layer.msg("请输入编号");
            }
        },
    };
  //监听回车事件,扫描枪一扫描或者按下回车键就直接执行查询
    $("#select_orderId").bind("keyup", function (e) {
        if (e.keyCode == 13) {
            var type = "getInfo";
            active[type] ? active[type].call(this) : '';
        }
    });


 

猜你喜欢

转载自blog.csdn.net/weixin_45849851/article/details/105483291