酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
3.3 KiB

  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: 'cf_room_plan/index' + location.search,
  8. add_url: 'cf_room_plan/add',
  9. edit_url: 'cf_room_plan/edit',
  10. del_url: 'cf_room_plan/del',
  11. multi_url: 'cf_room_plan/multi',
  12. import_url: 'cf_room_plan/import',
  13. table: 'cf_room_plan',
  14. }
  15. });
  16. var table = $("#table");
  17. table.on('post-common-search.bs.table', function (event, table) {
  18. var form = $("form", table.$commonsearch);
  19. $("input[name='hbp_admin.nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc");
  20. Form.events.cxselect(form);
  21. Form.events.selectpage(form);
  22. });
  23. // 初始化表格
  24. table.bootstrapTable({
  25. url: $.fn.bootstrapTable.defaults.extend.index_url,
  26. pk: 'id',
  27. sortName: 'id',
  28. columns: [
  29. [
  30. {field: 'id', title: __('Id')},
  31. {field: 'hotel_id', title: __('酒店ID')},
  32. {field: 'hotel_name', title: __('酒店')},
  33. {field: 'room_id', title: __('房型ID')},
  34. {field: 'room_name', title: __('房型')},
  35. {field: 'plan_name', title: __('Plan_name'), operate: 'LIKE'},
  36. {field: 'breakfast_num', title: __('Breakfast_num')},
  37. {field: 'book_end_day', title: __('Book_end_day')},
  38. {field: 'book_end_hour', title: __('Book_end_hour')},
  39. {field: 'continuity_type', title: __('Continuity_type'),
  40. searchList: {"0": __('无限制'), "1": __('连住几晚'),"2": __('连住几晚及以上'),"3": __('连住几晚及其倍数')}},
  41. {field: 'coutinuity_day', title: __('Coutinuity_day')},
  42. {field: 'hbp_admin.nickname', title: __('采购负责人')},
  43. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  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. });