user_exp_audit.js 6.6 KB
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'user_exp_audit/index' + location.search,
                    add_url: 'user_exp_audit/add',
                    edit_url: 'user_exp_audit/edit',
                    del_url: 'user_exp_audit/del',
                    multi_url: 'user_exp_audit/multi',
                    table: 'user_exp_log',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'user_id', title: __('User_id')},
                        {field: 'before_exp', title: __('Before_exp'), operate:'BETWEEN'},
                        {field: 'exp', title: __('Exp'), operate:'BETWEEN'},
                        {field: 'after_exp', title: __('After_exp'), operate:'BETWEEN'},
                        {field: 'type', title: __('Type'), searchList: {"5":__('Type 5'),"4":__('Type 4'),"3":__('Type 3'),"2":__('Type 2'),"1":__('Type 1')}, formatter: Table.api.formatter.normal},
                        {field: 'goods_id', title: __('Goods_id')},
                        {field: 'to_user_id', title: __('To_user_id')},
                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'user.id', title: __('User.id')},
                        {field: 'user.group_id', title: __('User.group_id')},
                        {field: 'user.username', title: __('User.username')},
                        {field: 'user.nickname', title: __('User.nickname')},
                        {field: 'user.password', title: __('User.password')},
                        {field: 'user.salt', title: __('User.salt')},
                        {field: 'user.email', title: __('User.email')},
                        {field: 'user.mobile', title: __('User.mobile')},
                        {field: 'user.avatar', title: __('User.avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image},
                        {field: 'user.level', title: __('User.level')},
                        {field: 'user.gender', title: __('User.gender')},
                        {field: 'user.birthday', title: __('User.birthday'), operate:'RANGE', addclass:'datetimerange'},
                        {field: 'user.bio', title: __('User.bio')},
                        {field: 'user.money', title: __('User.money'), operate:'BETWEEN'},
                        {field: 'user.exp', title: __('User.exp')},
                        {field: 'user.score', title: __('User.score')},
                        {field: 'user.successions', title: __('User.successions')},
                        {field: 'user.maxsuccessions', title: __('User.maxsuccessions')},
                        {field: 'user.prevtime', title: __('User.prevtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'user.logintime', title: __('User.logintime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'user.loginip', title: __('User.loginip')},
                        {field: 'user.loginfailure', title: __('User.loginfailure')},
                        {field: 'user.joinip', title: __('User.joinip')},
                        {field: 'user.jointime', title: __('User.jointime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'user.createtime', title: __('User.createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'user.updatetime', title: __('User.updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'user.token', title: __('User.token')},
                        {field: 'user.status', title: __('User.status'), formatter: Table.api.formatter.status},
                        {field: 'user.verification', title: __('User.verification')},
                        {field: 'user.type', title: __('User.type')},
                        {field: 'user.province', title: __('User.province')},
                        {field: 'user.city', title: __('User.city')},
                        {field: 'user.county', title: __('User.county')},
                        {field: 'user.longitude', title: __('User.longitude')},
                        {field: 'user.latitude', title: __('User.latitude')},
                        {field: 'user.name', title: __('User.name')},
                        {field: 'user.card', title: __('User.card')},
                        {field: 'user.parent_id', title: __('User.parent_id')},
                        {field: 'user.merchant_title', title: __('User.merchant_title')},
                        {field: 'user.merchant_name', title: __('User.merchant_name')},
                        {field: 'user.merchant_mobile', title: __('User.merchant_mobile')},
                        {field: 'user.area', title: __('User.area')},
                        {field: 'user.brief', title: __('User.brief')},
                        {field: 'user.business_images', title: __('User.business_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
                        {field: 'user.other_images', title: __('User.other_images'), events: Table.api.events.image, formatter: Table.api.formatter.images},
                        {field: 'user.admin_id', title: __('User.admin_id')},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});