live_room.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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: 'live_room/index' + location.search,
  8. add_url: 'live_room/add',
  9. edit_url: 'live_room/edit',
  10. del_url: 'live_room/del',
  11. multi_url: 'live_room/multi',
  12. import_url: 'live_room/import',
  13. table: 'live_room',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'weigh',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'user_id', title: __('User_id')},
  29. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  30. {field: 'logo', title: __('Logo'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  31. {field: 'room_no', title: __('Room_no'), operate: 'LIKE'},
  32. {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  34. {field: 'session', title: __('Session'), operate: 'LIKE'},
  35. {field: 'follow_num', title: __('Follow_num')},
  36. {field: 'talk_status', title: __('Talk_status'), searchList: {"0":__('Talk_status 0'),"1":__('Talk_status 1'),"3":__('Talk_status 3')}, formatter: Table.api.formatter.status},
  37. {field: 'weigh', title: __('Weigh'), operate: false},
  38. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  39. // {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'log.ccu', title: __('Log.ccu')},
  42. {field: 'log.uv', title: __('Log.uv')},
  43. {field: 'log.pv', title: __('Log.pv')},
  44. {field: 'log.goods_sales', title: __('Log.goods_sales')},
  45. {field: 'log.share_num', title: __('Log.share_num')},
  46. {field: 'log.follow_num', title: __('Log.follow_num')},
  47. {field: 'log.duration', title: __('Log.duration')},
  48. {field: 'log.open_time', title: __('Log.open_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  49. {field: 'log.close_time', title: __('Log.close_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. {
  51. field: 'operate',
  52. title: __('Operate'),
  53. table: table,
  54. events: Table.api.events.operate,
  55. formatter: Table.api.formatter.operate,
  56. buttons: [
  57. {
  58. name: 'admin',
  59. text: '房管',
  60. title: '房管',
  61. originalTitle:'房管',
  62. classname: 'btn btn-xs btn-success btn-dialog btn-selectuser',
  63. // icon: 'fa fa-jpy',
  64. url: 'live_room_admin/index/room_id/{id}?dialog=1',
  65. callback: function (data) {
  66. Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  67. }
  68. },
  69. {
  70. name: 'log',
  71. text: '开播场次',
  72. title: '开播场次',
  73. originalTitle:'开播场次',
  74. classname: 'btn btn-xs btn-success btn-dialog btn-selectuser',
  75. // icon: 'fa fa-jpy',
  76. url: 'live_room_log/index/room_id/{id}?dialog=1',
  77. callback: function (data) {
  78. Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  79. }
  80. }
  81. ]
  82. }
  83. ]
  84. ]
  85. });
  86. // 为表格绑定事件
  87. Table.api.bindevent(table);
  88. },
  89. add: function () {
  90. Controller.api.bindevent();
  91. },
  92. edit: function () {
  93. Controller.api.bindevent();
  94. },
  95. api: {
  96. bindevent: function () {
  97. Form.api.bindevent($("form[role=form]"));
  98. }
  99. }
  100. };
  101. return Controller;
  102. });