layui在table表格中添加时间控件

 timeB为name

   layui.table.render({
                elem: '#lay-purchasing-change',
                     id: "layTableId1"   ,
                url: baseURL + 'purchase/erpPruchasingOver/info/' + data.purchasingOverId,
                method: 'POST'
                , where: {}
                , contentType: "application/json;charset=utf-8"
                //数据接口 //数据接口/info/{purchasingOrderId}
                , cols: [[ //表头
                    // {type:'checkbox'}
                    {field: 'timeA', title: '付款时间', align: 'center', width: 260},
                    {field: 'moneyA', title: '付款金额(元)', align: 'center', width: 260},
                    {field: 'timeB', title: '待修改时间', align: 'center', width: 260, edit: 'select',
                        templet: function (d) {
                            return '';
                        }},
                    {field: 'moneyB', title: '待修改金额(元)', align: 'center', width: 260 ,edit: 'text'},
                ]],
                done: function (res, curr, count) {
                    //日期控件
                    $(".layui-input-date").each(function (i) {
                        layui.laydate.render({
                            elem: this,
                            format: "yyyy-MM-dd",
                            done: function (value, date) {
                                if (res && res.data[i]) {
                                    $.extend(res.data[i], {'timeB': value})
                                }
                            }
                        });
                    });
                    console.log(res);
                },
                page: false,
                loading: true
            });

 

你可能感兴趣的:(Layui)