gamepeople.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'gamepeople/index' + location.search,
  8. // add_url: 'gamepeople/add',
  9. edit_url: 'gamepeople/edit',
  10. // del_url: 'gamepeople/del',
  11. // multi_url: 'gamepeople/multi',
  12. // import_url: 'gamepeople/import',
  13. table: 'game_people',
  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: 2,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'user_id', title: __('User_id')},
  29. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  30. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  31. {field: 'game_id', title: __('Game_id')},
  32. {field: 'game.name', title: __('Game.name'), operate: 'LIKE'},
  33. {field: 'game_place_id', title: __('Game_place_id')},
  34. {field: 'place.name', title: __('Place.name'), operate: 'LIKE'},
  35. {field: 'price', title: __('Price'), operate: 'LIKE'},
  36. {field: 'group', title: __('Group')},
  37. {field: 'is_leader', title: __('Is_leader'), searchList: {"0":__('Is_leader 0'),"1":__('Is_leader 1')}, formatter: Table.api.formatter.normal},
  38. {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'num', title: __('Num')},
  41. {field: 'now_num', title: __('Now_num')},
  42. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  45. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  46. ]
  47. ]
  48. });
  49. // 为表格绑定事件
  50. Table.api.bindevent(table);
  51. },
  52. add: function () {
  53. Controller.api.bindevent();
  54. },
  55. edit: function () {
  56. Controller.api.bindevent();
  57. },
  58. api: {
  59. bindevent: function () {
  60. Form.api.bindevent($("form[role=form]"));
  61. }
  62. }
  63. };
  64. return Controller;
  65. });