|
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'cf_room_plan/index' + location.search,
- add_url: 'cf_room_plan/add',
- edit_url: 'cf_room_plan/edit',
- del_url: 'cf_room_plan/del',
- multi_url: 'cf_room_plan/multi',
- import_url: 'cf_room_plan/import',
- table: 'cf_room_plan',
- }
- });
-
- var table = $("#table");
-
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'id', title: __('Id')},
- {field: 'hotel_name', title: __('酒店')},
- {field: 'room_name', title: __('房型')},
- {field: 'plan_name', title: __('Plan_name'), operate: 'LIKE'},
- {field: 'breakfast_num', title: __('Breakfast_num')},
- {field: 'book_end_day', title: __('Book_end_day')},
- {field: 'book_end_hour', title: __('Book_end_hour')},
- {field: 'continuity_type', title: __('Continuity_type')},
- {field: 'coutinuity_day', title: __('Coutinuity_day')},
- {field: 'purchase_user_name', title: __('Charge_person'), operate: 'LIKE'},
- {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
-
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|