orderticket.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: 'orderticket/index' + location.search,
  8. add_url: 'orderticket/add',
  9. edit_url: 'orderticket/edit',
  10. del_url: 'orderticket/del',
  11. multi_url: 'orderticket/multi',
  12. import_url: 'orderticket/import',
  13. table: 'order_ticket',
  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: 'order_id', title: __('Order_id')},
  29. {field: 'order.order_no', title: __('Order.order_no'), operate: 'LIKE'},
  30. {field: 'product_id', title: __('Product_id')},
  31. {field: 'order.product_name', title: __('Order.product_name'), operate: 'LIKE'},
  32. {field: 'user_id', title: __('User_id')},
  33. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. // {field: 'road_id', title: __('Road_id')},
  35. {field: 'roadname', title: __('Roadname'), operate: 'LIKE'},
  36. {field: 'roadtype', title: __('Roadtype'), searchList: {"1":__('Roadtype 1'),"2":__('Roadtype 2'),"3":__('Roadtype 3')}, formatter: Table.api.formatter.normal},
  37. // {field: 'ticket_id', title: __('Ticket_id')},
  38. {field: 'ticket_name', title: __('Ticket_name'), operate: 'LIKE'},
  39. {field: 'ticket_price', title: __('Ticket_price'), operate:'BETWEEN'},
  40. {field: 'ticket_number', title: __('Ticket_number')},
  41. {field: 'pay_fee', title: __('Pay_fee'), operate:'BETWEEN'},
  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. });