user.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'user/user/index' + location.search,
  8. add_url: 'user/user/add',
  9. edit_url: 'user/user/edit',
  10. multi_url: 'user/user/multi',
  11. table: 'user',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'id', title: __('Id')},
  24. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  25. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  26. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  27. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"-1":__('Gender -1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  28. {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  29. {field: 'age', title: __('Age'), operate: 'LIKE'},
  30. {field: 'province_name', title: __('Province_name'), operate: 'LIKE'},
  31. {field: 'city_name', title: __('City_name'), operate: 'LIKE'},
  32. {field: 'district_name', title: __('District_name'), operate: 'LIKE'},
  33. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  34. {field: 'frozen', title: __('Frozen'), operate:'BETWEEN'},
  35. {field: 'diamond', title: __('钻石余额'), operate:'BETWEEN'},
  36. {field: 'constellation', title: __('Constellation'), operate: 'LIKE'},
  37. {field: 'profession', title: __('Profession'), operate: 'LIKE'},
  38. {field: 'wechat', title: __('Wechat'), operate: 'LIKE'},
  39. {field: 'is_auth', title: __('Is_auth'), searchList: {"0":__('未申请'), "1":__('待审核'), "2": "通过","-1": "未通过"}, formatter: Table.api.formatter.normal,
  40. custom: {"2": 'success', '1': 'info', '-1': 'danger'}
  41. },
  42. {field: 'is_auth_person', title: __('是否真人认证'), searchList: {"2": "通过", "1":__('待审核'),"0":__('未申请'), "-1": "未通过"}, formatter: Table.api.formatter.normal,
  43. custom: {"2": 'success', '1': 'info', '-1': 'danger'}
  44. },
  45. {field: 'is_goddess', title: __('Is_goddess'), searchList: {"1":__('Is_goddess 1'),"0":__('Is_goddess 0')}, formatter: Table.api.formatter.normal},
  46. {field: 'vip_duetime', title: __('Vip_duetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'income', title: __('Income'), operate: 'LIKE'},
  48. {field: 'recharge_auth', title: __('Recharge_auth'), searchList: {"1":__('Recharge_auth 1'),"0":__('Recharge_auth 0')}, formatter: Table.api.formatter.normal},
  49. {field: 'invite_no', title: __('Invite_no'), operate: 'LIKE'},
  50. {field: 'pre_user_id', title: __('Pre_user_id')},
  51. {field: 'copy_mobile', title: __('是否允许复制手机号'), searchList: {"1":__('允许'),"2":__('不允许')}, formatter: Table.api.formatter.normal,
  52. custom: {"1": 'success', "2": 'gray'}
  53. },
  54. {field: 'declaration', title: __('Declaration'), operate: 'LIKE'},
  55. {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  56. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  57. {field: 'status', title: __('Status'), operate: 'LIKE', searchList: {"normal":__('正常'),"hidden":__('隐藏'), "logout":"注销"}, formatter: Table.api.formatter.normal},
  58. {field: 'online', title: __('是否在线'), operate: false, searchList: {"1":__('在线'),"0":__('离线')}, formatter: Table.api.formatter.normal},
  59. {field: 'active', title: __('是否活跃'), operate: false, searchList: {"1":__('活跃'),"0":__('不活跃')}, formatter: Table.api.formatter.normal},
  60. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  61. ]
  62. ]
  63. });
  64. // 为表格绑定事件
  65. Table.api.bindevent(table);
  66. },
  67. add: function () {
  68. Controller.api.bindevent();
  69. },
  70. edit: function () {
  71. Controller.api.bindevent();
  72. },
  73. api: {
  74. bindevent: function () {
  75. Form.api.bindevent($("form[role=form]"));
  76. }
  77. }
  78. };
  79. return Controller;
  80. });