1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'userwallet/index' + location.search,
- add_url: 'userwallet/add',
- // edit_url: 'userwallet/edit',
- // del_url: 'userwallet/del',
- multi_url: 'userwallet/multi',
- import_url: 'userwallet/import',
- table: 'user_wallet',
- }
- });
- 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.username', title: __('User.username'), operate: 'LIKE'},
- {field: 'money', title: __('Money'), operate:'BETWEEN'},
- {field: 'jewel', title: __('Jewel')},
- {field: 'operate', title: __('Operate'),
- buttons:[
- {
- name:'updatejewel',
- text:'充值金币',
- title:'充值金币',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:function(row){
- return 'userwallet/updatejewel/user_id/' + row.user_id+ '?dialog=1';
- },
- target:'_self',
- },
- {
- name:'updatemoney',
- text:'充值海钻',
- title:'充值海钻',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:function(row){
- return 'userwallet/updatemoney/user_id/' + row.user_id+ '?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;
- });
|