123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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: 'gold', title: __('Gold'), operate:'BETWEEN'},
- {field: 'jewel', title: __('Jewel'), operate:'BETWEEN'},
- {field: 'agentjewel', title: __('Agentjewel'), operate:'BETWEEN'},
- {field: 'vip_endtime', title: __('Vip_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
- {field: 'audio_sec', title: __('Audio_sec')},
- {field: 'video_sec', title: __('Video_sec')},
- {field: 'typing_times', title: __('Typing_times')},
- {field: 'operate', title: __('Operate'), table: table,
- buttons:[
- {
- name:'updatemoney',
- text:'充值金币',
- title:'充值金币',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'userwallet/updatemoney/id/{ids}?dialog=1',
- target:'_self',
- },
- /* {
- name:'updatevip',
- text:'充值vip会员',
- title:'充值vip会员',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'userwallet/updatevip/id/{ids}?dialog=1',
- target:'_self',
- }*/
- ],
- events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- updatemoney: function () {
- Controller.api.bindevent();
- },
- updatevip: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|