define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'usertrain/index' + location.search, add_url: 'usertrain/add', edit_url: 'usertrain/edit', del_url: 'usertrain/del', multi_url: 'usertrain/multi', import_url: 'usertrain/import', table: 'user_train', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'train_id', title: __('Train_id')}, {field: 'active.name', title: __('Active.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'active.number', title: __('Active.number'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'user_id', title: __('User_id')}, // {field: 'user.username', title: __('User.username'), operate: 'LIKE'}, {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, // {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'user.idcard_status', title: __('User.idcard_status'), searchList: {"-1":__('User.idcard_status -1'),"0":__('User.idcard_status 0'),"1":__('User.idcard_status 1'),"2":__('User.idcard_status 2')}, formatter: Table.api.formatter.status}, {field: 'sign_time', title: __('Sign_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, {field: 'sign_image', title: __('Sign_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {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; });