teacs.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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: 'user/teacs/index' + location.search+'&ids='+Config.ids,
  8. table: 'user_teac',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. fixedColumns: true,
  18. fixedRightNumber: 1,
  19. columns: [
  20. [
  21. {checkbox: true},
  22. {field: 'id', title: __('Id')},
  23. {field: 'users.address', title: __('User_id')},
  24. {field: 'type_id', title: __('Type_id'), searchList: { "1": __('出售'), "2": __('求购') }, formatter: Table.api.formatter.status },
  25. {field: 'price', title: __('Price'), operate:'BETWEEN'},
  26. {field: 'num', title: __('Num')},
  27. {field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
  28. {field: 'fee', title: __('Fee'), operate:'BETWEEN'},
  29. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  30. ]
  31. ]
  32. });
  33. // 为表格绑定事件
  34. Table.api.bindevent(table);
  35. },
  36. add: function () {
  37. Controller.api.bindevent();
  38. },
  39. edit: function () {
  40. Controller.api.bindevent();
  41. },
  42. api: {
  43. bindevent: function () {
  44. Form.api.bindevent($("form[role=form]"));
  45. }
  46. }
  47. };
  48. return Controller;
  49. });