|
- 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.on('post-common-search.bs.table', function (event, table) {
- var form = $("form", table.$commonsearch);
- $("input[name='hbp_admin.nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc");
- Form.events.cxselect(form);
- Form.events.selectpage(form);
- });
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'id', title: __('Id')},
- {field: 'hotel_id', title: __('酒店ID')},
- {field: 'hotel_name', title: __('酒店')},
- {field: 'room_id', title: __('房型ID')},
- {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'),
- searchList: {"0": __('无限制'), "1": __('连住几晚'),"2": __('连住几晚及以上'),"3": __('连住几晚及其倍数')}},
- {field: 'coutinuity_day', title: __('Coutinuity_day')},
- {field: 'hbp_admin.nickname', title: __('采购负责人')},
- {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;
- });
|