1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'gameplace/index/game_id/'+ Config.game_id + location.search,
- add_url: 'gameplace/add/game_id/'+ Config.game_id,
- edit_url: 'gameplace/edit/game_id/'+ Config.game_id,
- del_url: 'gameplace/del',
- multi_url: 'gameplace/multi',
- import_url: 'gameplace/import',
- table: 'game_place',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'game_id', title: __('Game_id')},
- {field: 'game.name', title: __('Game.name'), operate: 'LIKE'},
- {field: 'provincearea.name', title: __('省')},
- {field: 'cityarea.name', title: __('市')},
- {field: 'area.name', title: __('区')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'updatetime', title: __('Updatetime'), 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;
- });
|