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

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

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'app_id', title: '游戏ID'},
                    {field: 'product_name', title: '主游戏'},
                    {field: 'app_name', title: '子游戏名称'},
                    {field: 'appkey', title: 'appkey',search:false},
                    {field: 'paykey', title: 'paykey',search:false},
                    {field: 'status', title: '状态',search:false,selectList:{0:'未上线',1:'上线中'},templet: ea.table.switch,tips:"上线中|未上线",pk:init.table_pk},
                    {field: 'is_test', title: '是否测试',search:false,selectList:{0:'否',1:'是'},templet: ea.table.switch,tips:"是|否",pk:init.table_pk},
                    {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();
        },
        modify: function () {
            ea.listen();
        },
    };
    return Controller;
});
