userorder.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: 'userorder/index' + location.search,
  8. add_url: 'userorder/add',
  9. // edit_url: 'userorder/edit',
  10. del_url: 'userorder/del',
  11. multi_url: 'userorder/multi',
  12. import_url: 'userorder/import',
  13. table: 'acitivity_order',
  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. showExport:false,
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field:'id', title: __('序号'),formatter: function(value, row, index){
  27. return ++index;
  28. }, operate: false},
  29. {field: 'number', title: __('Number')},
  30. {field: 'address', title: __('Address'), operate: 'LIKE'},
  31. {field: 'title', title: __('Title'), operate: 'LIKE'},
  32. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  33. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  34. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  35. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  36. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  37. // {field: 'avcitity.title', title: __('Avcitity.title')},
  38. // {field: 'avcitity.address', title: __('Avcitity.address')},
  39. {field: 'avcitity.num', title: __('Avcitity.num')},
  40. // {field: 'avcitity.phone', title: __('Avcitity.phone')},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  42. ]
  43. ]
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. },
  48. add: function () {
  49. Controller.api.bindevent();
  50. },
  51. edit: function () {
  52. Controller.api.bindevent();
  53. },
  54. api: {
  55. bindevent: function () {
  56. Form.api.bindevent($("form[role=form]"));
  57. }
  58. }
  59. };
  60. return Controller;
  61. });