party.js 4.4 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: 'party/party/index' + location.search,
  8. add_url: 'party/party/add',
  9. edit_url: 'party/party/edit',
  10. // del_url: 'party/party/del',
  11. multi_url: 'party/party/multi',
  12. import_url: 'party/party/import',
  13. table: 'party',
  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: 'user.u_id', title: __('User_id')},
  27. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  28. {field: 'room_type', title: __('Room_type'), searchList: {"1":__('Room_type 1'),"2":__('Room_type 2')}, formatter: Table.api.formatter.normal},
  29. {field: 'party_id', title: __('Party_id')},
  30. {field: 'party_hot', title: __('Party_hot')},
  31. {field: 'party_name', title: __('Party_name'), operate: 'LIKE'},
  32. {field: 'party_logo', title: __('Party_logo'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  33. // {field: 'party_notice', title: __('Party_notice'), operate: 'LIKE'},
  34. // {field: 'party_notice_detail', title: __('Party_notice_detail'), operate: 'LIKE'},
  35. {field: 'naming', title: __('Naming')},
  36. // {field: 'is_online', title: __('Is_online'), searchList: {"1":__('Is_online 1'),"0":__('Is_online 0')}, formatter: Table.api.formatter.normal},
  37. {field: 'status', title: __('Status'), searchList: {"-1":__('Status -1'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  38. {field: 'is_close', title: __('Is_close'), searchList: {"1":__('Is_close 1'),"0":__('Is_close 0')}, formatter: Table.api.formatter.normal},
  39. {field: 'is_recommend', title: __('Is_recommend'), searchList: {"1":__('Is_recommend 1'),"0":__('Is_recommend 0')}, formatter: Table.api.formatter.normal},
  40. {field: 'party_type', title: __('Party_type')},
  41. {field: 'platRate', title: __('平台抽成(%)')},
  42. {field: 'guilderRate', title: __('工会长抽成(%)')},
  43. // {field: 'party_pass', title: __('Party_pass'), operate: 'LIKE'},
  44. // {field: 'is_screen', title: __('Is_screen'), searchList: {"1":__('Is_screen 1'),"0":__('Is_screen 0')}, formatter: Table.api.formatter.normal},
  45. {field: 'on_model', title: __('On_model'), searchList: {"1":__('On_model 1'),"2":__('On_model 2')}, formatter: Table.api.formatter.normal},
  46. // {field: 'background', title: __('Background'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  47. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  48. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  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. });