12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'hotel_room/index' + location.search,
- add_url: 'hotel_room/add',
- edit_url: 'hotel_room/edit',
- del_url: 'hotel_room/del',
- multi_url: 'hotel_room/multi',
- import_url: 'hotel_room/import',
- table: 'hotel_room',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'weigh',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'hotel_id', title: __('Hotel_id')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'price', title: __('Price'), operate:'BETWEEN'},
- {field: 'original_price', title: __('Original_price'), operate:'BETWEEN'},
- {field: 'space', title: __('Space')},
- {field: 'floor', title: __('Floor')},
- {field: 'is_wifi', title: __('Is_wifi'), searchList: {"1":__('Is_wifi 1'),"0":__('Is_wifi 0')}, formatter: Table.api.formatter.normal},
- {field: 'window', title: __('Window'), searchList: {"1":__('Window 1'),"0":__('Window 0')}, formatter: Table.api.formatter.normal},
- {field: 'breakfast', title: __('Breakfast'), searchList: {"1":__('Breakfast 1'),"0":__('Breakfast 0')}, formatter: Table.api.formatter.normal},
- {field: 'people_num', title: __('People_num')},
- {field: 'bad', title: __('Bad'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'wifi_phone', title: __('Wifi_phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'room_layout', title: __('Room_layout'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'wash_use', title: __('Wash_use'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'facility', title: __('Facility'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'bathroom', title: __('Bathroom'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'tips', title: __('Tips'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'cancel_explain', title: __('Cancel_explain'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'weigh', title: __('Weigh'), operate: false},
- {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
- {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: 'hotel.name', title: __('Hotel.name'), operate: 'LIKE'},
- {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;
- });
|