123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'vipuser/index/vip_id/' + Config.vip_id + location.search,
- // add_url: 'vipuser/add',
- // edit_url: 'vipuser/edit',
- // del_url: 'vipuser/del',
- // multi_url: 'vipuser/multi',
- // import_url: 'vipuser/import',
- table: 'user',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- showToggle: false,
- showColumns: false,
- showExport: false,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'username', title: __('Username'), operate: 'LIKE'},
- {field: 'nickname', title: __('Nickname'), 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: 'money', title: __('Money'), operate: 'LIKE'},
- {field: 'realname', title: __('Realname'), operate: 'LIKE'},
- {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"2":__('Gender 2')}, formatter: Table.api.formatter.normal},
- {field: 'birthday', title: __('Birthday')},
- {field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
- {field: 'passport', title: __('Passport'), operate: 'LIKE'},
- {field: 'emergencycontact', title: __('Emergencycontact'), operate: 'LIKE'},
- {field: 'contactmobile', title: __('Contactmobile'), operate: 'LIKE'},
- {field: 'outdoorduration', title: __('Outdoorduration'), operate: 'LIKE'},
- {field: 'invite_no', title: __('Invite_no'), operate: 'LIKE'},
- {field: 'growthvalue', title: __('Growthvalue')},
- {field: 'growthlevel', title: __('Growthlevel')},
- {field: 'experiencelevel', title: __('Experiencelevel')},
- {field: 'experiencetime', title: __('Experiencetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'maxlevel', title: __('Maxlevel')},
- {field: 'freenumber', title: __('Freenumber')},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
- buttons: [
- {
- name: 'giveout',
- text: '发放',
- title: __('发放'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-success btn-ajax',
- icon: 'fa fa-pencil',
- confirm: '确认发放?',
- url: 'vipuser/giveout/vip_id/' + Config.vip_id,
- refresh: true,
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- // visible: function (row) {
- // if (row.status == 0) {
- // return true;
- // } else {
- // return false;
- // }
- // }
- }
- ]
- }
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|