define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'cars/index' + location.search, add_url: 'cars/add', edit_url: 'cars/edit', del_url: 'cars/del', multi_url: 'cars/multi', import_url: 'cars/import', table: 'cars', } }); 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: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'brand_id', title: __('Brand_id')}, {field: 'series_id', title: __('Series_id')}, {field: 'price', title: __('Price'), operate:'BETWEEN'}, {field: 'cover_image', title: __('Cover_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'location', title: __('Location'), operate: 'LIKE'}, {field: 'contact_name', title: __('Contact_name'), operate: 'LIKE'}, {field: 'contact_id', title: __('Contact_id')}, {field: 'contact_phone', title: __('Contact_phone'), operate: 'LIKE'}, {field: 'wechat_qrcode', title: __('Wechat_qrcode'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'updated_at', title: __('Updated_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'is_active', title: __('Is_active')}, {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; });