You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
3.5 KiB

  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. 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: 'user.id',
  22. search: false,
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'id', title: __('Id'), sortable: true},
  27. // {field: 'group.name', title: __('Group')},
  28. {field: 'username', title: __('Username'), operate: 'LIKE'},
  29. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  30. {field: 'email', title: __('Email'), operate: 'LIKE'},
  31. {field: 'floor', title: __('所在楼层'), operate: 'LIKE'},
  32. // {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  33. // {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  34. // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
  35. // {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
  36. // {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
  37. // {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
  38. // {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
  39. // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  40. // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
  41. // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  42. // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
  43. // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
  44. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  45. ]
  46. ]
  47. });
  48. // 为表格绑定事件
  49. Table.api.bindevent(table);
  50. },
  51. add: function () {
  52. Controller.api.bindevent();
  53. },
  54. edit: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. }
  61. }
  62. };
  63. return Controller;
  64. });