define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'topicdongtaianswer/index' + location.search, add_url: 'topicdongtaianswer/add', // edit_url: 'topicdongtaianswer/edit', del_url: 'topicdongtaianswer/del', multi_url: 'topicdongtaianswer/multi', import_url: 'topicdongtaianswer/import', table: 'topic_dongtai_answer', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'dt_id', title: __('Dt_id')}, {field: 'floor', title: __('Floor')}, // {field: 'user_id', title: __('User_id')}, {field: 'content', title: __('Content'), operate: 'LIKE'}, // {field: 'to_user_id', title: __('To_user_id')}, {field: 'level', title: __('Level'), searchList: {"1":__('Level 1'),"2":__('Level 2')}, formatter: Table.api.formatter.normal}, {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: 'user.username', title: __('User.username'), operate: 'LIKE'}, // {field: 'topicdongtai.id', title: __('Topicdongtai.id')}, {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; });