user.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. // del_url: 'user/user/del',
  11. multi_url: 'user/user/multi',
  12. import_url: 'user/user/import',
  13. table: 'user',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'u_id', title: __('U_id')},
  27. {field: 'username', title: __('Username'), operate: 'LIKE'},
  28. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  29. // {field: 'password', title: __('Password'), operate: 'LIKE'},
  30. // {field: 'salt', title: __('Salt'), operate: 'LIKE'},
  31. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  32. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  33. // {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  34. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  35. // {field: 'age_id', title: __('Age_id')},
  36. {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. {field: 'onlinetime', title: __('Onlinetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
  39. // {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
  40. // {field: 'token', title: __('Token'), operate: 'LIKE'},
  41. // {field: 'verification', title: __('Verification'), operate: 'LIKE'},
  42. // {field: 'is_live', title: __('Is_live'), searchList: {"1":__('Is_live 1'),"0":__('Is_live 0')}, formatter: Table.api.formatter.normal},
  43. {field: 'is_online', title: __('Is_online'), searchList: {"1":__('Is_online 1'),"0":__('Is_online 0')}, formatter: Table.api.formatter.normal},
  44. // {field: 'has_info', title: __('Has_info'), searchList: {"1":__('Has_info 1'),"0":__('Has_info 0')}, formatter: Table.api.formatter.normal},
  45. {field: 'is_auth', title: __('Is_auth'), searchList: {"1":__('Is_auth 1'),"0":__('Is_auth 0'),"-1":__('Is_auth -1'),"2":__('Is_auth 2')}, formatter: Table.api.formatter.normal},
  46. // {field: 'is_guild', title: __('Is_guild'), searchList: {"1":__('Is_guild 1'),"0":__('Is_guild 0'),"-1":__('Is_guild -1'),"2":__('Is_guild 2'),"3":__('Is_guild 3')}, formatter: Table.api.formatter.normal},
  47. // {field: 'guild_id', title: __('Guild_id')},
  48. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
  49. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  51. // {field: 'openid', title: __('Openid'), operate: 'LIKE'},
  52. {field: 'invite_no', title: __('Invite_no'), operate: 'LIKE'},
  53. {field: 'pre_userid', title: __('Pre_userid')},
  54. // {field: 'loginfailure', title: __('Loginfailure')},
  55. // {field: 'province_id', title: __('Province_id')},
  56. // {field: 'city_id', title: __('City_id')},
  57. // {field: 'desc', title: __('Desc'), operate: 'LIKE'},
  58. {field: 'is_cool', title: __('Is_cool'), searchList: {"0":__('Is_cool 0'),"1":__('Is_cool 1')}, formatter: Table.api.formatter.normal},
  59. {field: 'wealth_level', title: __('Wealth_level')},
  60. // {field: 'wealth_empirical', title: __('Wealth_empirical')},
  61. // {field: 'charm_level', title: __('Charm_level')},
  62. // {field: 'charm_empirical', title: __('Charm_empirical')},
  63. // {field: 'job_id', title: __('Job_id')},
  64. // {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
  65. // {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
  66. // {field: 'is_manager', title: __('Is_manager'), searchList: {"0":__('Is_manager 0'),"1":__('Is_manager 1')}, formatter: Table.api.formatter.normal},
  67. {field: 'userwallet.money', title: __('Userwallet.money'), operate:'BETWEEN'},
  68. {field: 'userwallet.jewel', title: __('Userwallet.jewel')},
  69. {field: 'operate', title: __('Operate'),
  70. buttons:[
  71. {
  72. name:'updatejewel',
  73. text:'充值金币',
  74. title:'充值金币',
  75. icon:'fa fa-exclamation-circle',
  76. classname:'btn btn-xs btn-info btn-dialog',
  77. url:'user/user/updatejewel/user_id/{ids}?dialog=1',
  78. target:'_self',
  79. },
  80. {
  81. name:'updatemoney',
  82. text:'充值海钻',
  83. title:'充值海钻',
  84. icon:'fa fa-exclamation-circle',
  85. classname:'btn btn-xs btn-info btn-dialog',
  86. url:'user/user/updatemoney/user_id/{ids}?dialog=1',
  87. target:'_self',
  88. },
  89. ],
  90. table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  91. ]
  92. ]
  93. });
  94. // 为表格绑定事件
  95. Table.api.bindevent(table);
  96. },
  97. add: function () {
  98. Controller.api.bindevent();
  99. },
  100. edit: function () {
  101. Controller.api.bindevent();
  102. },
  103. updatejewel: function () {
  104. Controller.api.bindevent();
  105. },
  106. updatemoney: function () {
  107. Controller.api.bindevent();
  108. },
  109. api: {
  110. bindevent: function () {
  111. Form.api.bindevent($("form[role=form]"));
  112. }
  113. }
  114. };
  115. return Controller;
  116. });