coach.js 4.0 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: 'coach/index' + location.search,
  8. add_url: 'coach/add',
  9. edit_url: 'coach/edit',
  10. del_url: 'coach/del',
  11. multi_url: 'coach/multi',
  12. import_url: 'coach/import',
  13. table: 'coach',
  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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. // {field: 'username', title: __('Username'), operate: 'LIKE'},
  29. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  30. // {field: 'desc', title: __('Desc'), operate: 'LIKE'},
  31. // {field: 'password', title: __('Password'), operate: 'LIKE'},
  32. // {field: 'salt', title: __('Salt'), operate: 'LIKE'},
  33. // {field: 'email', title: __('Email'), operate: 'LIKE'},
  34. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  35. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  36. // {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  37. // {field: 'successions', title: __('Successions')},
  38. // {field: 'maxsuccessions', title: __('Maxsuccessions')},
  39. // {field: 'prevtime', title: __('Prevtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. // {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. // {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
  42. // {field: 'loginfailure', title: __('Loginfailure')},
  43. // {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
  44. // {field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. // {field: 'token', title: __('Token'), operate: 'LIKE'},
  48. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, 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. });