live_room_log.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_log/index' + location.search,
  8. add_url: 'live_room_log/add',
  9. edit_url: 'live_room_log/edit',
  10. del_url: 'live_room_log/del',
  11. multi_url: 'live_room_log/multi',
  12. import_url: 'live_room_log/import',
  13. table: 'live_room_log',
  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: 'open_time', title: __('Open_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  29. {field: 'close_time', title: __('Close_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  30. {field: 'session', title: __('Session'), operate: 'LIKE'},
  31. {field: 'like', title: __('Like')},
  32. {field: 'ccu', title: __('Ccu')},
  33. {field: 'uv', title: __('Uv')},
  34. {field: 'pv', title: __('Pv')},
  35. {field: 'goods_sales', title: __('Goods_sales')},
  36. {field: 'share_num', title: __('Share_num')},
  37. {field: 'follow_num', title: __('Follow_num')},
  38. {field: 'duration', title: __('Duration')},
  39. {field: 'user_id', title: __('User_id')},
  40. {field: 'room_id', title: __('Room_id')},
  41. {field: 'room_no', title: __('Room_no'), operate: 'LIKE'},
  42. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  43. ]
  44. ]
  45. });
  46. // 为表格绑定事件
  47. Table.api.bindevent(table);
  48. },
  49. add: function () {
  50. Controller.api.bindevent();
  51. },
  52. edit: function () {
  53. Controller.api.bindevent();
  54. },
  55. api: {
  56. bindevent: function () {
  57. Form.api.bindevent($("form[role=form]"));
  58. }
  59. }
  60. };
  61. return Controller;
  62. });