hotel_canteen_order.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'hotel_canteen_order/index' + location.search,
  8. add_url: 'hotel_canteen_order/add',
  9. edit_url: 'hotel_canteen_order/edit',
  10. del_url: 'hotel_canteen_order/del',
  11. multi_url: 'hotel_canteen_order/multi',
  12. import_url: 'hotel_canteen_order/import',
  13. table: 'hotel_canteen_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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'canteen_id', title: __('Canteen_id')},
  29. {field: 'room_id', title: __('Room_id')},
  30. {field: 'user_id', title: __('User_id')},
  31. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  32. {field: 'name', title: __('Name'), operate: 'LIKE'},
  33. {field: 'phone', title: __('Phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2')}, formatter: Table.api.formatter.normal},
  35. {field: 'get_to_time', title: __('Get_to_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  37. {field: 'pay_amount', title: __('Pay_amount'), operate:'BETWEEN'},
  38. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
  39. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  42. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  43. {field: 'canteen.name', title: __('Canteen.name'), operate: 'LIKE'},
  44. {field: 'room.name', title: __('Room.name'), operate: 'LIKE'},
  45. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  46. ]
  47. ]
  48. });
  49. // 为表格绑定事件
  50. Table.api.bindevent(table);
  51. },
  52. add: function () {
  53. Controller.api.bindevent();
  54. },
  55. edit: function () {
  56. Controller.api.bindevent();
  57. },
  58. api: {
  59. bindevent: function () {
  60. Form.api.bindevent($("form[role=form]"));
  61. }
  62. }
  63. };
  64. return Controller;
  65. });