voteplayer.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: 'voteplayer/index' + location.search,
  8. add_url: 'voteplayer/add',
  9. edit_url: 'voteplayer/edit',
  10. del_url: 'voteplayer/del',
  11. multi_url: 'voteplayer/multi',
  12. import_url: 'voteplayer/import',
  13. table: 'vote_player',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'weigh,id',
  22. sortOrder: 'asc,asc',
  23. fixedColumns: true,
  24. fixedRightNumber: 1,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field: 'id', title: __('Id')},
  29. // {field: 'subject_id', title: __('Subject_id')},
  30. {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  31. {field: 'suozaidanwei', title: __('Suozaidanwei'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'tuijiangonghui', title: __('Tuijiangonghui'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'info', title: __('Info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. // {field: 'video_file', title: __('Video_file'), operate: false, formatter: Table.api.formatter.file},
  35. {field: 'votes', title: __('Votes')},
  36. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  37. // {field: 'score', title: __('Score')},
  38. {field: 'thumb_image', title: __('Thumb_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  39. {field: 'vodid', title: __('Vodid'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  40. {field: 'weigh', title: __('Weigh'), operate: false},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  42. ]
  43. ]
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. },
  48. add: function () {
  49. Controller.api.bindevent();
  50. },
  51. edit: function () {
  52. Controller.api.bindevent();
  53. },
  54. api: {
  55. bindevent: function () {
  56. Form.api.bindevent($("form[role=form]"));
  57. }
  58. }
  59. };
  60. return Controller;
  61. });