income.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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: 'admin/platform/income/index',
  8. add_url: 'admin/platform/income/add',
  9. edit_url: 'admin/platform/income/edit',
  10. del_url: 'admin/platform/income/del',
  11. multi_url: 'admin/platform/income/multi',
  12. table: 'video_platform',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. // sortName: 'user.id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('ID'), sortable: true},
  25. {field: 'videolist.name', title: __('短剧名称'), operate: false},
  26. {field: 'platform.name', title: __('平台名称'), operate: false},
  27. {field: 'max', title: __('收益上限'), sortable: true},
  28. {field: 'min', title: __('收益下限'), sortable: true},
  29. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime},
  30. {field: 'operate', title: __('操作'), formatter: Table.api.formatter.operate}
  31. ]
  32. ]
  33. });
  34. // 为表格绑定事件
  35. Table.api.bindevent(table);
  36. },
  37. add: function () {
  38. Controller.api.bindevent();
  39. },
  40. edit: function () {
  41. Controller.api.bindevent();
  42. },
  43. api: {
  44. bindevent: function () {
  45. Form.api.bindevent($("form[role=form]"));
  46. },
  47. // formatter: {
  48. // paytype: function (value) {
  49. // return value==2 ? '<span class="label label-danger">' + __("已支付") + '</span>': '<span class="label label-default">'+ __('未支付')+ '</span>';
  50. // },
  51. // type: function (value) {
  52. // return value==2 ? '<span class="label label-danger">' + __("已使用") + '</span>': '<span class="label label-default">'+ __('未使用')+ '</span>';
  53. // }
  54. // }
  55. }
  56. };
  57. return Controller;
  58. });