|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'cf_room_info/index' + location.search,
- add_url: 'cf_room_info/add',
- edit_url: 'cf_room_info/edit',
- del_url: 'cf_room_info/del',
- multi_url: 'cf_room_info/multi',
- import_url: 'cf_room_info/import',
- table: 'cf_room_info',
- }
- });
-
- var table = $("#table");
-
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'hotel_id', title: __('酒店ID')},
- {field: 'hotel_name', title: __('酒店名称'),operate: 'LIKE'},
- {field: 'nickname', title: __('创建人')},
- {field: 'id', title: __('房型ID')},
- {field: 'room_name', title: __('Room_name'), operate: 'LIKE'},
- {field: 'room_memo', title: __('Room_memo'), 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;
- });
|