match_like.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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: 'match/match_like/index' + location.search,
  8. multi_url: 'match/match_like/multi',
  9. import_url: 'match/match_like/import',
  10. table: 'match_like',
  11. }
  12. });
  13. var table = $("#table");
  14. // 初始化表格
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'id',
  19. columns: [
  20. [
  21. {checkbox: true},
  22. {field: 'id', title: __('Id')},
  23. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  24. {field: 'fans.nickname', title: __('Fans.nickname'), operate: 'LIKE'},
  25. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  26. ]
  27. ]
  28. });
  29. // 为表格绑定事件
  30. Table.api.bindevent(table);
  31. },
  32. add: function () {
  33. Controller.api.bindevent();
  34. },
  35. edit: function () {
  36. Controller.api.bindevent();
  37. },
  38. api: {
  39. bindevent: function () {
  40. Form.api.bindevent($("form[role=form]"));
  41. }
  42. }
  43. };
  44. return Controller;
  45. });