user.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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',
  8. edit_url: 'user/user/edit',
  9. multi_url: 'user/user/multi',
  10. infocheck_url: 'user/user/infocheck',
  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: 'user.id',
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'id', title: __('Id'), sortable: true},
  24. {field: 'u_id', title: __('Uid'), sortable: true},
  25. {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  26. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  27. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  28. // {field: '查看', title: __('下级用户'), formatter: function(value, row, index){
  29. // return '<a href="usererji/index?parent_id='+row.id+'" ' +
  30. // 'class="label label-info jump" style="cursor: pointer" ' +
  31. // 'data-toggle="tooltip" title="查看下级用户">查看</a>';
  32. // }},
  33. // {field: 'preuser.u_id', title: __('上级代理ID')},
  34. // {field: 'preuser.nickname', title: __('上级代理昵称'), formatter: function(value, row, index){
  35. // if(!value) {
  36. // return "平台";
  37. // } else {
  38. // return value;
  39. // }
  40. // }},
  41. // {field: 'auth.realname', title: __('真实姓名')},
  42. // {field: 'auth.idcard', title: __('身份证号')},
  43. // {field: 'chargetime', title: __('最近一次充值时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  44. // {field: 'onlinetime', title: __('最近一次上线时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  45. // {field: 'chargecount', title: __('总充值金额')},
  46. // {field: 'rebatecount', title: __('总获得返利金额')},
  47. //{field: 'gender', title: __('Gender'), searchList: {1: __('Male'), 0: __('Female')}, formatter: Table.api.formatter.normal},
  48. // {field: 'age', title: __('Age'), operate: 'LIKE'},
  49. // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
  50. // {field: 'empirical', title: __('Empirical'), operate: 'LIKE'},
  51. // {field: 'money', title: __('Money'), operate: 'LIKE'},
  52. // {field: 'jewel', title: __('Jewel'), operate: 'LIKE'},
  53. // {field: 'sound_coin', title: __('Sound_coin'), operate: 'LIKE'},
  54. // {field: 'noble.name', title: __('Noble'), operate: 'LIKE'},
  55. // {field: 'noble_duetime', title: __('NobleDuetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE'},
  56. {field: 'age.name', title: __('Age_id'), operate: false},
  57. {field: 'constellation.name', title: __('Constellation_id'), operate: false},
  58. {field: 'is_cool', title: __('Is_cool'), searchList:Config.isCoolList, formatter: Table.api.formatter.status},
  59. {field: 'is_manager', title: __('Is_manager'), searchList:Config.isManagerList, formatter: Table.api.formatter.status},
  60. {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  61. {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
  62. {field: 'createtime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  63. {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
  64. {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
  65. {
  66. field: 'operate', title: __('Operate'), buttons: [
  67. {
  68. name: 'detail',
  69. title: __('查看详情'),
  70. classname: 'btn btn-xs btn-primary btn-dialog',
  71. icon: 'fa fa-list',
  72. url: 'user/user/detail',
  73. }, {
  74. name: 'infocheck',
  75. title: __('信息审核'),
  76. classname: 'btn btn-xs btn-warning btn-dialog',
  77. icon: 'fa fa-leaf',
  78. url: 'user/user/infoCheck',
  79. visible: function (row) {
  80. if ((row.pre_nickname != '' && row.pre_nickname != row.nickname) || (row.pre_avatar != '' && row.pre_avatar != row.avatar)) {
  81. return true;
  82. } else {
  83. return false;
  84. }
  85. }
  86. },
  87. ], table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate
  88. }
  89. ]
  90. ]
  91. });
  92. // 为表格绑定事件
  93. Table.api.bindevent(table);
  94. table.off('dbl-click-row.bs.table');
  95. },
  96. add: function () {
  97. Controller.api.bindevent();
  98. },
  99. edit: function () {
  100. Controller.api.bindevent();
  101. },
  102. detail: function () {
  103. Controller.api.bindevent();
  104. },
  105. infocheck: function () {
  106. Controller.api.bindevent();
  107. },
  108. api: {
  109. bindevent: function () {
  110. Form.api.bindevent($("form[role=form]"));
  111. }
  112. }
  113. };
  114. return Controller;
  115. });