| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user/team/index'+ location.search +'&user_id='+Config.user_id,
- table: 'user_team',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'a.id',
- sortName: 'a.id',
- searchFormVisible: true,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'), operate: false},
- {field: 'mobile', title: __('Mobile'), operate: 'Like'},
- {field: 'balance', title: __('Balance'), operate: false},
- {field: 'bonus_sum', title: __('Bonus sum'), operate: false},
- {field: 'parent_name', title: __('Parent id'),operate: false},
- {field: 'recharge', title: __('Recharge'), operate: false},
- {field: 'withdraw', title: __('Withdraw'), operate: false},
- {field: 'distance', title: __('Level'), formatter: function(value, row, index) {
- return value + __('Grade');
- }, operate: false,cellStyle: function () {
- return {css: {"color":"#18bc9c", 'font-weight':'550'}}}
- },
- {field: 'create_time', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'operate', title: __('Operate'), table: table,
- buttons: [
- {
- name: "account",
- text: __('Account'),
- classname: 'btn btn-xs btn-info btn-magic btn-dialog',
- url: function(row){ return 'trade/moneylog/index/ids/'+row.id},
- refresh: true
- },{
- name: "ban",
- text: __('Ban'),
- classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
- url: function(row){ return 'user/team/lock/ids/'+row.id},
- visible: function (row) {
- if(row.is_lock == 0) return true;
- return false;
- },
- refresh: true
- },{
- name: "banteam",
- text: __('Ban team'),
- classname: 'btn btn-xs btn-warning btn-magic btn-ajax',
- url: function(row){ return 'user/team/lockAll/ids/'+row.id},
- refresh: true
- }],
- events: Table.api.events.operate, formatter: Table.api.formatter.operate
- }]
- ],
-
-
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
- var typeStr = $(this).attr("href").replace('#', '');
- var options = table.bootstrapTable('getOptions');
- options.pageNumber = 1;
- options.queryParams = function (params) {
- params.distance = typeStr;
- return params;
- };
- table.bootstrapTable('refresh', {});
- return false;
- });
-
- },
- account: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
-
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|