video.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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: 'video/index' + location.search,
  8. add_url: 'video/add',
  9. edit_url: 'video/edit',
  10. del_url: 'video/del',
  11. multi_url: 'video/multi',
  12. import_url: 'video/import',
  13. table: 'video',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. // {field: 'video_type_id', title: __('Video_type_id')},
  29. // {field: 'type.type', title: __('Type.type')},
  30. {field: 'type.name', title: __('Type.name'), operate: 'LIKE'},
  31. // {field: 'cate_id', title: __('Cate_id')},
  32. {field: 'cate.name', title: __('Cate.name'),operate:'LIKE'},
  33. // {field: 'childcate_id', title: __('Childcate_id')},
  34. {field: 'childcate.name', title: __('Childcate.name'), operate: 'LIKE'},
  35. {field: 'title', title: __('Title'), operate: 'LIKE'},
  36. {field: 'search_title', title: __('Search_title'), operate: 'LIKE'},
  37. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  38. {field: 'desc', title: __('Desc'), operate: 'LIKE'},
  39. {field: 'videofile', title: __('Videofile'), operate: false, formatter: Table.api.formatter.file},
  40. {field: 'is_pay', title: __('Is_pay'), searchList: {"0":__('Is_pay 0'),"1":__('Is_pay 1')}, formatter: Table.api.formatter.normal},
  41. {field: 'weigh', title: __('Weigh'), operate: false},
  42. {field: 'good_number', title: __('good_number'), operate: false},
  43. {field: 'collect_number', title: __('collect_number'), operate: false},
  44. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  47. // {field: 'transcode_status', title: __('转码状态'), searchList: {"0":__('待转码'),"1":__('转码中'),"2":__('转码完成'),"3":__('转码失败')}, formatter: Table.api.formatter.status},
  48. // {field: 'task_id', title: __('转码任务ID'), operate: false},
  49. // {field: 'file_url', title: __('文件银河转码后地址'), operate: false},
  50. {field: 'inject_status', title: __('注入状态'), searchList: {"0":__('待注入'),"1":__('注入中'),"2":__('注入成功'),"3":__('注入失败')}, formatter: Table.api.formatter.status},
  51. {field: 'operate', title: __('Operate'), table: table,
  52. buttons:[
  53. {
  54. name:'tongbu',
  55. text:'同步到旧版',
  56. title:'同步到旧版',
  57. icon:'fa fa-exclamation-circle',
  58. classname:'btn btn-xs btn-info btn-ajax',
  59. url:'video/tongbu/id/{ids}?dialog=1',
  60. target:'_self',
  61. }
  62. ],
  63. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  64. ]
  65. ]
  66. });
  67. // 为表格绑定事件
  68. Table.api.bindevent(table);
  69. },
  70. tongbu: function () {
  71. Controller.api.bindevent();
  72. },
  73. add: function () {
  74. Controller.api.bindevent();
  75. },
  76. edit: function () {
  77. Controller.api.bindevent();
  78. },
  79. api: {
  80. bindevent: function () {
  81. Form.api.bindevent($("form[role=form]"));
  82. }
  83. }
  84. };
  85. return Controller;
  86. });
  87. $("#c-childcate_id").data("params", function (obj) {
  88. return {
  89. custom: {cate_id: $("#c-cate_id").val()}
  90. };
  91. });
  92. $(document).on("change","#c-cate_id",function(){
  93. $("#c-childcate_id").selectPageClear();
  94. })