define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_pk:'ver_id',
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'app.ver/index',
        add_url: 'app.ver/add',
        edit_url: 'app.ver/edit',
        delete_url: 'app.ver/delete',
        export_url: 'app.ver/export',
        modify_url: 'app.ver/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'ver_id', title: '渠道ID',search:false},
                    {field: 'ver_class', title: '渠道标识'},
                    {field: 'ver_name', title: '渠道名称'},
                    {
                        field: 'ver_status',
                        title: '状态',
                        search:false,
                        templet: function (d) {
                            console.log(d);
                            if (d.ver_status === 1) {
                                return '<span class="layui-badge layui-bg-green">已上线</span>';
                            }else {
                                return '<span class="layui-badge layui-bg-red">未上线</span>';
                            }
                        }
                    },
                    // {field: 'ver_type', title: '渠道类型',search:false},
                    {field: 'add_user', title: '创建人',search:false},
                    {field: 'add_time', title: '添加时间',search:false},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});
