梦卐魇

梦卐魇

15飞吻 2019-5-29 加入 来自贵阳

(白茶清欢无别事,我在等风也等你!)

梦卐魇 最近的提问

梦卐魇 最近的回答

  • 6天前谷歌浏览器监听table行的时候获取数据为空中回答:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Layui</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" type="text/css" href="__CSS__/layui/css/layui.css" media="all"/>
    <link rel='stylesheet' type='text/css' href='__CSS__/admin/css/admin.css'/>
    <!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 -->
    </head>
    <body>
    <div class='page-content-wrap'>
    <div class="demoTable">
    <div class="layui-form-item">
    <div class="layui-form-item">
    <div class="layui-inline">
    <label class="layui-form-label">开始日期:</label>
    <div class="layui-input-block">
    <input type="text" class="layui-input" id="laydateDemo" placeholder="yyyy-MM-dd">
    </div>
    </div>
    <div class="layui-inline">
    <label class="layui-form-label">结束日期:</label>
    <div class="layui-input-block">
    <input type="text" class="layui-input" id="laydateDemo1" placeholder="yyyy-MM-dd">
    </div>
    </div>
    <div class="layui-inline">
    <div class="layui-input-block">
    <button id="selectBtn" class="layui-btn layui-btn-normal" data-type="reload">确定查询</button>
    </div>
    </div>
    </div>
    </div>
    </div>
    <table class="layui-hide" id="test" lay-filter="test1"></table>
    </div>
    <script src="__JS__/layui/layui.js" charset="utf-8"></script>
    <!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
    <script>
    layui.use(['laydate', 'layer', 'table', 'element', 'jquery'], function () {
    var laydate = layui.laydate //日期
    , layer = layui.layer //弹层
    , table = layui.table //表格
    , element = layui.element //元素操作
    , $ = layui.jquery;

    //数据表格
    table.render({
    elem: '#test'
    //跳转页面 必须先在路由定义
    // 'publicdate'=>'admin/Datetable/HZWL'//欠款这块获取数据table
    , url: 'publicdate'
    , cols: [[
    {field: '渠道编号', width: 80, title: '编号',unresize: true,sort: true}
    , {field: '渠道简称', width: 140, title: '渠道'}
    , {field: '上期结存', width: 140, title: '上期结存', sort: true}
    , {field: '出货', width: 120, title: '采购', sort: true}
    , {field: '退货', width: 120, title: '退货', sort: true}
    , {field: '费用', width: 120, title: '费用', sort: true}
    , {field: '回款', width: 120, title: '回款', sort: true}
    , {field: '订金', width: 120, title: '订金', sort: true}
    , {field: '本期结存', width: 140, title: '本期结存', sort: true}
    ]]
    , id: 'testReload'
    , page: true
    , totalRow:true
    });


    //重载
    var $ = layui.$, active = {
    reload: function () {
    var startDate = $('#laydateDemo').val();
    var endDate = $('#laydateDemo1').val();
    var name = "{:session('admin.username')}";
    //执行重载
    table.reload('testReload', {
    page: {
    curr: 1 //重新从第 1 页开始
    }
    , where: {
    startDate: startDate
    , endDate: endDate
    , name: name
    }
    }, 'data');
    }
    }

    //点击执行重载
    $('#selectBtn').on('click', function () {
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
    });

    //日期
    layui.use('laydate', function () {
    var laydate = layui.laydate;

    //常规用法
    laydate.render({
    elem: '#laydateDemo'
    });
    laydate.render({
    elem: '#laydateDemo1'
    });
    });

    //获取
    table.on('rowDouble(test1)', function (obj) {
    obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
    var data = obj.data;//获取点击行数据.
    console.log(data);
    layer.alert(JSON.stringify(data), {
    title: '当前行数据:'
    });
    //标注选中样式

    });

    });
    </script>
    </body>
    </html>