party.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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: 'is_cool', title: __('Is_cool'), searchList: {"0":__('Is_cool 0'),"1":__('Is_cool 1')}, formatter: Table.api.formatter.normal},
  31. {field: 'party_type.name', title: __('Party_type'), searchList: Config.partyTypeList},
  32. {field: 'party_hot', title: __('Party_hot')},
  33. {field: 'party_name', title: __('Party_name'), operate: 'LIKE'},
  34. {field: 'party_logo', title: __('Party_logo'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  35. // {field: 'party_notice', title: __('Party_notice'), operate: 'LIKE'},
  36. // {field: 'party_notice_detail', title: __('Party_notice_detail'), operate: 'LIKE'},
  37. //{field: 'naming', title: __('Naming')},
  38. // {field: 'is_online', title: __('Is_online'), searchList: {"1":__('Is_online 1'),"0":__('Is_online 0')}, formatter: Table.api.formatter.normal},
  39. {field: 'status', title: __('Status'), searchList: {"-1":__('Status -1'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  40. {field: 'is_close', title: __('Is_close'), searchList: {"1":__('Is_close 1'),"0":__('Is_close 0')}, formatter: Table.api.formatter.normal},
  41. {field: 'is_recommend', title: __('Is_recommend'), searchList: {"1":__('Is_recommend 1'),"0":__('Is_recommend 0')}, formatter: Table.api.formatter.normal},
  42. //{field: 'party_type', title: __('Party_type')},
  43. {field: 'platRate', title: __('平台抽成(%)')},
  44. {field: 'guilderRate', title: __('族长抽成(%)')},
  45. // {field: 'party_pass', title: __('Party_pass'), operate: 'LIKE'},
  46. // {field: 'is_screen', title: __('Is_screen'), searchList: {"1":__('Is_screen 1'),"0":__('Is_screen 0')}, formatter: Table.api.formatter.normal},
  47. {field: 'on_model', title: __('On_model'), searchList: {"1":__('On_model 1'),"2":__('On_model 2')}, formatter: Table.api.formatter.normal},
  48. // {field: 'background', title: __('Background'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  49. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  51. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  52. ]
  53. ]
  54. });
  55. // 为表格绑定事件
  56. Table.api.bindevent(table);
  57. },
  58. add: function () {
  59. Controller.api.bindevent();
  60. },
  61. edit: function () {
  62. Controller.api.bindevent();
  63. },
  64. api: {
  65. bindevent: function () {
  66. /*$("#c-party_type").data("params",function(){
  67. return {custom:{room_type:$("#c-room_type").val()}};
  68. });*/
  69. Form.api.bindevent($("form[role=form]"));
  70. }
  71. }
  72. };
  73. return Controller;
  74. });