vplatform.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: 'platform/vplatform/index',
  8. add_url: 'platform/vplatform/add',
  9. edit_url: 'platform/vplatform/edit',
  10. del_url: 'platform/vplatform/del',
  11. multi_url: 'platform/vplatform/multi',
  12. table: '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: 'vid', title: __('短剧名称'), sortable: true},
  28. {field: 'platform_id', title: __('平台名称'), sortable: true},
  29. {field: 'max', title: __('收益上限'), sortable: true},
  30. {field: 'min', title: __('收益下限'), sortable: true},
  31. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime},
  32. {field: 'operate', title: __('操作'), formatter: Table.api.formatter.operate}
  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. // formatter: {
  50. // paytype: function (value) {
  51. // return value==2 ? '<span class="label label-danger">' + __("已支付") + '</span>': '<span class="label label-default">'+ __('未支付')+ '</span>';
  52. // },
  53. // type: function (value) {
  54. // return value==2 ? '<span class="label label-danger">' + __("已使用") + '</span>': '<span class="label label-default">'+ __('未使用')+ '</span>';
  55. // }
  56. // }
  57. }
  58. };
  59. return Controller;
  60. });