123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user/user/index' + location.search,
- add_url: 'user/user/add',
- edit_url: 'user/user/edit',
- // del_url: 'user/user/del',
- multi_url: 'user/user/multi',
- import_url: 'user/user/import',
- table: 'user',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'u_id', title: __('U_id')},
- {field: 'username', title: __('Username'), operate: 'LIKE'},
- {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
- // {field: 'password', title: __('Password'), operate: 'LIKE'},
- // {field: 'salt', title: __('Salt'), operate: 'LIKE'},
- {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
- {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
- // {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
- // {field: 'age_id', title: __('Age_id')},
- // {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'onlinetime', title: __('Onlinetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
- // {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
- // {field: 'token', title: __('Token'), operate: 'LIKE'},
- // {field: 'verification', title: __('Verification'), operate: 'LIKE'},
- // {field: 'is_live', title: __('Is_live'), searchList: {"1":__('Is_live 1'),"0":__('Is_live 0')}, formatter: Table.api.formatter.normal},
- {field: 'is_online', title: __('Is_online'), searchList: {"1":__('Is_online 1'),"0":__('Is_online 0')}, formatter: Table.api.formatter.normal},
- // {field: 'has_info', title: __('Has_info'), searchList: {"1":__('Has_info 1'),"0":__('Has_info 0')}, formatter: Table.api.formatter.normal},
- {field: 'is_auth', title: __('Is_auth'), searchList: {"1":__('Is_auth 1'),"0":__('Is_auth 0'),"-1":__('Is_auth -1'),"2":__('Is_auth 2')}, formatter: Table.api.formatter.normal},
- // {field: 'is_guild', title: __('Is_guild'), searchList: {"1":__('Is_guild 1'),"0":__('Is_guild 0'),"-1":__('Is_guild -1'),"2":__('Is_guild 2'),"3":__('Is_guild 3')}, formatter: Table.api.formatter.normal},
- // {field: 'guild_id', title: __('Guild_id')},
- {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
- // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'openid', title: __('Openid'), operate: 'LIKE'},
- {field: 'invite_no', title: __('Invite_no'), operate: 'LIKE'},
- {field: 'pre_userid', title: __('Pre_userid')},
- // {field: 'loginfailure', title: __('Loginfailure')},
- // {field: 'province_id', title: __('Province_id')},
- // {field: 'city_id', title: __('City_id')},
- // {field: 'desc', title: __('Desc'), operate: 'LIKE'},
- {field: 'is_cool', title: __('Is_cool'), searchList: {"0":__('Is_cool 0'),"1":__('Is_cool 1')}, formatter: Table.api.formatter.normal},
- {field: 'wealth_level', title: __('Wealth_level')},
- // {field: 'wealth_empirical', title: __('Wealth_empirical')},
- // {field: 'charm_level', title: __('Charm_level')},
- // {field: 'charm_empirical', title: __('Charm_empirical')},
- // {field: 'job_id', title: __('Job_id')},
- // {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
- // {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
- // {field: 'is_manager', title: __('Is_manager'), searchList: {"0":__('Is_manager 0'),"1":__('Is_manager 1')}, formatter: Table.api.formatter.normal},
- {field: 'userwallet.money', title: __('Userwallet.money'), operate:'BETWEEN'},
- {field: 'userwallet.jewel', title: __('Userwallet.jewel')},
- {field: 'operate', title: __('Operate'),
- buttons:[
- {
- name:'updatejewel',
- text:'充值金币',
- title:'充值金币',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'user/user/updatejewel/user_id/{ids}?dialog=1',
- target:'_self',
- },
- {
- name:'updatemoney',
- text:'充值海钻',
- title:'充值海钻',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'user/user/updatemoney/user_id/{ids}?dialog=1',
- target:'_self',
- },
- ],
- 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();
- },
- updatejewel: function () {
- Controller.api.bindevent();
- },
- updatemoney: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|