酒店预订平台
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.
 
 
 
 
 
 

67 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_item/index' + location.search,
  8. add_url: 'cf_item/add',
  9. edit_url: 'cf_item/edit',
  10. del_url: 'cf_item/del',
  11. multi_url: 'cf_item/multi',
  12. import_url: 'cf_item/import',
  13. table: 'cf_item',
  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='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: 'item_type', title: __('Item_type'),
  32. searchList: {"1":"一日游","2":"交通接驳","3":"租车","4":"门票"}},
  33. {field: 'item_name', title: __('Item_name'), operate: 'LIKE'},
  34. {field: 'item_unit', title: __('计价单位'),
  35. searchList: {"1":"件","2":"份","3":"匝","4":"张"}},
  36. {field: 'item_memo', title: __('Item_memo'), operate: 'LIKE',visible: false},
  37. {field: 'province_name', title: __('Province_name'), operate: 'LIKE'},
  38. {field: 'city_name', title: __('City_name'), operate: 'LIKE'},
  39. {field: 'area_name', title: __('地区名'), operate: 'LIKE'},
  40. {field: 'detail_address', title: __('Detail_address'), operate: 'LIKE'},
  41. {field: 'nickname', title: __('采购负责人')},
  42. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  45. ]
  46. ]
  47. });
  48. // 为表格绑定事件
  49. Table.api.bindevent(table);
  50. },
  51. add: function () {
  52. Controller.api.bindevent();
  53. },
  54. edit: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. }
  61. }
  62. };
  63. return Controller;
  64. });