define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'mobile/simulation/index' + location.search, add_url: 'mobile/simulation/add', edit_url: 'mobile/simulation/edit', del_url: 'mobile/simulation/del', multi_url: 'mobile/simulation/multi', table: 'mobile_simulation', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'title', title: __('Title')}, {field: 'year', title: __('Year')}, {field: 'time', title: __('Time')}, {field: 'pass_score', title: __('Pass_score')}, {field: 'do_num_virtual', title: __('Do_num_virtual')}, {field: 'do_num_real', title: __('Do_num_real')}, {field: 'good_degree', title: __('Good_degree')}, {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, //操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮 { field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { text: '题目管理', title: '题目管理', classname: 'btn btn-xs btn-primary btn-dialog', icon: 'fa fa-list', url: 'mobile/simulation_question?target_id={id}&target_type=2', } ], 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; });