123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user_power/index' + location.search,
- //add_url: 'user_power/add',
- edit_url: 'user_power/edit',
- /*del_url: 'user_power/del',
- multi_url: 'user_power/multi',
- import_url: 'user_power/import',*/
- table: 'user_power',
- }
- });
- 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: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
- {field: 'private_messages', title: __('Private_messages'), searchList: {"0":__('Private_messages 0'),"1":__('Private_messages 1')}, formatter: Table.api.formatter.normal},
- {field: 'barrage', title: __('Barrage'), searchList: {"0":__('Barrage 0'),"1":__('Barrage 1')}, formatter: Table.api.formatter.normal},
- {field: 'speak', title: __('Speak'), searchList: {"0":__('Speak 0')}, formatter: Table.api.formatter.normal},
- {field: 'speak_time', title: __('Speak_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'recharge', title: __('Recharge'), searchList: {"0":__('Recharge 0'),"1":__('Recharge 1')}, formatter: Table.api.formatter.normal},
- {field: 'raffle', title: __('Raffle'), searchList: {"0":__('Raffle 0'),"1":__('Raffle 1')}, formatter: Table.api.formatter.normal},
- {field: 'give_gift', title: __('Give_gift'), searchList: {"0":__('Give_gift 0'),"1":__('Give_gift 1')}, formatter: Table.api.formatter.normal},
- {field: 'transfer', title: __('Transfer'), searchList: {"0":__('Transfer 0'),"1":__('Transfer 1')}, formatter: Table.api.formatter.normal},
- {field: 'payorder', title: __('Payorder'), searchList: {"0":__('Payorder 0'),"1":__('Payorder 1')}, formatter: Table.api.formatter.normal},
- {field: 'attire', title: __('Attire'), searchList: {"0":__('Attire 0'),"1":__('Attire 1')}, formatter: Table.api.formatter.normal},
- {field: 'noble', title: __('Noble'), searchList: {"0":__('Noble 0'),"1":__('Noble 1')}, formatter: Table.api.formatter.normal},
- {field: 'withdraw', title: __('Withdraw'), searchList: {"0":__('Withdraw 0'),"1":__('Withdraw 1')}, formatter: Table.api.formatter.normal},
- {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;
- });
|