orderroad.js 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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: 'orderroad/index' + location.search,
  8. add_url: 'orderroad/add',
  9. edit_url: 'orderroad/edit',
  10. del_url: 'orderroad/del',
  11. multi_url: 'orderroad/multi',
  12. import_url: 'orderroad/import',
  13. table: 'order_road',
  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')}, formatter: Table.api.formatter.normal},
  37. {field: 'chufabanci_id', title: __('Chufabanci_id')},
  38. {field: 'chufatime', title: __('Chufatime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'ticket_number', title: __('Ticket_number')},
  40. // {field: 'chufadi_id', title: __('Chufadi_id')},
  41. {field: 'chufaname', title: __('Chufaname'), operate: 'LIKE'},
  42. // {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
  43. // {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
  44. {field: 'hexiao_no', title: __('Hexiao_no'), operate: 'LIKE'},
  45. {field: 'hexiao_status', title: __('Hexiao_status'), searchList: {"0":__('Hexiao_status 0'),"1":__('Hexiao_status 1')}, formatter: Table.api.formatter.status},
  46. {field: 'hexiao_uid', title: __('Hexiao_uid')},
  47. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  48. {field: 'hexiao_coachid', title: __('Hexiao_coachid')},
  49. {field: 'hexiao_time', title: __('Hexiao_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. {field: 'coach.nickname', title: __('Coach.nickname'), operate: 'LIKE'},
  51. {field: 'coach.mobile', title: __('Coach.mobile'), operate: 'LIKE'},
  52. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  53. ]
  54. ]
  55. });
  56. // 为表格绑定事件
  57. Table.api.bindevent(table);
  58. },
  59. add: function () {
  60. Controller.api.bindevent();
  61. },
  62. edit: function () {
  63. Controller.api.bindevent();
  64. },
  65. api: {
  66. bindevent: function () {
  67. Form.api.bindevent($("form[role=form]"));
  68. }
  69. }
  70. };
  71. return Controller;
  72. });