define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'carfines/index' + location.search, add_url: 'carfines/add', edit_url: 'carfines/edit', del_url: 'carfines/del', multi_url: 'carfines/multi', import_url: 'carfines/import', table: 'car_fines', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'car_id', title: __('Car_id')}, {field: 'car.chepaihao', title: __('Car.chepaihao'), operate: 'LIKE'}, {field: 'car.brand', title: __('Car.brand'), operate: 'LIKE'}, {field: 'car.xinghao', title: __('Car.xinghao'), operate: 'LIKE'}, {field: 'car.department', title: __('Car.department'), operate: 'LIKE'}, {field: 'fines_price', title: __('Fines_price'), operate:'BETWEEN'}, {field: 'fines_time', title: __('Fines_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'coach_id', title: __('Coach_id')}, {field: 'coach.nickname', title: __('Coach.nickname'), operate: 'LIKE'}, {field: 'coach.mobile', title: __('Coach.mobile'), 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; });