user.js 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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')}, 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: 'constellation', title: __('Constellation'), operate: 'LIKE'},
  36. {field: 'profession', title: __('Profession'), operate: 'LIKE'},
  37. {field: 'wechat', title: __('Wechat'), operate: 'LIKE'},
  38. {field: 'is_auth', title: __('Is_auth'), searchList: {"1":__('Is_auth 1'),"0":__('Is_auth 0')}, formatter: Table.api.formatter.normal},
  39. {field: 'is_goddess', title: __('Is_goddess'), searchList: {"1":__('Is_goddess 1'),"0":__('Is_goddess 0')}, formatter: Table.api.formatter.normal},
  40. {field: 'vip_duetime', title: __('Vip_duetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'income', title: __('Income'), operate: 'LIKE'},
  42. {field: 'recharge_auth', title: __('Recharge_auth'), searchList: {"1":__('Recharge_auth 1'),"0":__('Recharge_auth 0')}, formatter: Table.api.formatter.normal},
  43. {field: 'invite_no', title: __('Invite_no'), operate: 'LIKE'},
  44. {field: 'pre_user_id', title: __('Pre_user_id')},
  45. {field: 'declaration', title: __('Declaration'), operate: 'LIKE'},
  46. {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  48. {field: 'status', title: __('Status'), operate: 'LIKE', formatter: Table.api.formatter.status},
  49. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  50. ]
  51. ]
  52. });
  53. // 为表格绑定事件
  54. Table.api.bindevent(table);
  55. },
  56. add: function () {
  57. Controller.api.bindevent();
  58. },
  59. edit: function () {
  60. Controller.api.bindevent();
  61. },
  62. api: {
  63. bindevent: function () {
  64. Form.api.bindevent($("form[role=form]"));
  65. }
  66. }
  67. };
  68. return Controller;
  69. });