collect.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. pageSize: 50, //调整分页大小为20
  7. pageList:[50],
  8. extend: {
  9. index_url: 'card/collect/index?id='+Config.id,
  10. add_url: 'card/collect/add',
  11. edit_url: 'card/collect/edit',
  12. del_url: 'card/collect/del',
  13. multi_url: 'card/collect/multi',
  14. table: 'card_collect',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. commonSearch:false,
  24. search:false,
  25. columns: [
  26. [
  27. {field: 'createdate', title: __('Date')},
  28. {field: 'c_id', title: __('C_id'),operate:false},
  29. {field: 'uv', title: __('Uv'),operate:false},
  30. {field: 'draws_uv', title: __('抽奖人数'),operate:false},
  31. {field: 'draws_pv', title: __('抽奖次数'),operate:false},
  32. {field: 'kandian', title: __('Kandian'),operate:false},
  33. ]
  34. ]
  35. });
  36. // 为表格绑定事件
  37. Table.api.bindevent(table);
  38. },
  39. add: function () {
  40. Controller.api.bindevent();
  41. },
  42. edit: function () {
  43. Controller.api.bindevent();
  44. },
  45. api: {
  46. bindevent: function () {
  47. Form.api.bindevent($("form[role=form]"));
  48. }
  49. }
  50. };
  51. return Controller;
  52. });