123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user/user/index',
- edit_url: 'user/user/edit',
- multi_url: 'user/user/multi',
- infocheck_url: 'user/user/infocheck',
- table: 'user',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'user.id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'), sortable: true},
- {field: 'u_id', title: __('Uid'), sortable: true},
- {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
- {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
- {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
- // {field: '查看', title: __('下级用户'), formatter: function(value, row, index){
- // return '<a href="usererji/index?parent_id='+row.id+'" ' +
- // 'class="label label-info jump" style="cursor: pointer" ' +
- // 'data-toggle="tooltip" title="查看下级用户">查看</a>';
- // }},
- // {field: 'preuser.u_id', title: __('上级代理ID')},
- // {field: 'preuser.nickname', title: __('上级代理昵称'), formatter: function(value, row, index){
- // if(!value) {
- // return "平台";
- // } else {
- // return value;
- // }
- // }},
- // {field: 'auth.realname', title: __('真实姓名')},
- // {field: 'auth.idcard', title: __('身份证号')},
- // {field: 'chargetime', title: __('最近一次充值时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
- // {field: 'onlinetime', title: __('最近一次上线时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
- // {field: 'chargecount', title: __('总充值金额')},
- // {field: 'rebatecount', title: __('总获得返利金额')},
- //{field: 'gender', title: __('Gender'), searchList: {1: __('Male'), 0: __('Female')}, formatter: Table.api.formatter.normal},
- // {field: 'age', title: __('Age'), operate: 'LIKE'},
- // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
- // {field: 'empirical', title: __('Empirical'), operate: 'LIKE'},
- // {field: 'money', title: __('Money'), operate: 'LIKE'},
- // {field: 'jewel', title: __('Jewel'), operate: 'LIKE'},
- // {field: 'sound_coin', title: __('Sound_coin'), operate: 'LIKE'},
- // {field: 'noble.name', title: __('Noble'), operate: 'LIKE'},
- // {field: 'noble_duetime', title: __('NobleDuetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE'},
- {field: 'age.name', title: __('Age_id'), operate: false},
- {field: 'constellation.name', title: __('Constellation_id'), operate: false},
- {field: 'is_cool', title: __('Is_cool'), searchList:Config.isCoolList, formatter: Table.api.formatter.status},
- {field: 'is_manager', title: __('Is_manager'), searchList:Config.isManagerList, formatter: Table.api.formatter.status},
- {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
- {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
- {field: 'createtime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
- {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
- {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
- {
- field: 'operate', title: __('Operate'), buttons: [
- {
- name: 'detail',
- title: __('查看详情'),
- classname: 'btn btn-xs btn-primary btn-dialog',
- icon: 'fa fa-list',
- url: 'user/user/detail',
- }, {
- name: 'infocheck',
- title: __('信息审核'),
- classname: 'btn btn-xs btn-warning btn-dialog',
- icon: 'fa fa-leaf',
- url: 'user/user/infoCheck',
- visible: function (row) {
- if ((row.pre_nickname != '' && row.pre_nickname != row.nickname) || (row.pre_avatar != '' && row.pre_avatar != row.avatar)) {
- return true;
- } else {
- return false;
- }
- }
- },
- ], table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- table.off('dbl-click-row.bs.table');
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- detail: function () {
- Controller.api.bindevent();
- },
- infocheck: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|