collect.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: 'booklistch/collect/index',
  8. add_url: 'booklistch/collect/add',
  9. edit_url: 'booklistch/collect/edit',
  10. del_url: 'booklistch/collect/del',
  11. multi_url: 'booklistch/collect/multi',
  12. analysis: 'booklistch/collect/analysis',
  13. table: 'booklist_collect',
  14. },
  15. showToggle: false,
  16. showColumns: false,
  17. showExport: false,
  18. operate: false,
  19. search:false,
  20. searchFormVisible: true
  21. });
  22. var table = $("#table");
  23. // 初始化表格
  24. table.bootstrapTable({
  25. url: $.fn.bootstrapTable.defaults.extend.index_url,
  26. pk: 'booklist_collect.id',
  27. sortName: 'booklist_collect.id',
  28. columns: [
  29. [
  30. {field: 'id', title: __('Id'), operate: false},
  31. {field: 'admin_id', title: __('渠道ID'), operate: false},
  32. {field: 'booklist_id', title: __('书单ID')},
  33. {field: 'book_list_ch.title', title: __('书单名称'), operate: 'LIKE %...%'},
  34. {field: 'booklist_collect.idx', title: __('书籍ID')},
  35. {field: 'book.name', title: __('书籍名称'), operate: 'LIKE %...%'},
  36. {field: 'uv', title: __('UV'),operate:false},
  37. {field: 'orders_num', title: __('充值订单数'), operate: false},
  38. {field: 'recharge_money', title: __('充值金额'),operate:false},
  39. {field: 'createtime', title: __('创建时间'), operate:false, formatter: Table.api.formatter.datetime},
  40. ]
  41. ]
  42. });
  43. // 为表格绑定事件
  44. Table.api.bindevent(table);
  45. $(document).on('click', '.flush', function () {
  46. window.location.reload();
  47. });
  48. },
  49. add: function () {
  50. Controller.api.bindevent();
  51. },
  52. edit: function () {
  53. Controller.api.bindevent();
  54. },
  55. analysis: function () {
  56. // 初始化表格参数配置
  57. Table.api.init({
  58. extend: {
  59. analysis: 'booklistch/collect/analysis?ids='+Config.ids,
  60. table: 'booklist_collect',
  61. },
  62. showToggle: false,
  63. showColumns: false,
  64. showExport: false,
  65. operate: false,
  66. search:false,
  67. searchFormVisible: false,
  68. commonSearch: false,
  69. pagination: false,
  70. });
  71. var table = $("#table");
  72. // 初始化表格
  73. table.bootstrapTable({
  74. url: $.fn.bootstrapTable.defaults.extend.analysis,
  75. pk: 'book_list_ch.id',
  76. sortName: 'book_list_ch.id',
  77. columns: [
  78. [
  79. {field: 'admin_id', title: __('渠道ID'), operate: false},
  80. {field: 'id', title: __('书单ID'), operate: false},
  81. {field: 'title', title: __('书单名称'), operate: false},
  82. {field: 'book_id', title: __('书籍ID'), operate: false},
  83. {field: 'book_name', title: __('书籍名称'), operate: false},
  84. {field: 'uv', title: __('UV'),operate:false},
  85. {field: 'orders_num', title: __('充值订单数'), operate: false},
  86. {field: 'recharge_money', title: __('充值金额'),operate:false},
  87. {field: 'createtime', title: __('创建时间'), operate:false, formatter: Table.api.formatter.datetime},
  88. ]
  89. ]
  90. });
  91. // 为表格绑定事件
  92. Table.api.bindevent(table);
  93. Controller.api.bindevent();
  94. },
  95. api: {
  96. bindevent: function () {
  97. Form.api.bindevent($("form[role=form]"));
  98. }
  99. }
  100. };
  101. return Controller;
  102. });