define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'user/report/index' + location.search, // add_url: 'user/report/add', edit_url: 'user/report/edit', del_url: 'user/report/del', // multi_url: 'user/report/multi', // import_url: 'user/report/import', table: 'user_report', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'user.u_id', title: __('举报用户ID')}, {field: 'user.nickname', title: __('举报用户昵称'), operate: 'LIKE'}, {field: 'type', title: __('举报类型'), operate: 'LIKE'}, {field: 'ruser.u_id', title: __('被举报用户ID')}, {field: 'ruser.nickname', title: __('被举报用户昵称'), operate: 'LIKE'}, { field: 'content', title: __('Content'), operate: 'LIKE', formatter: function (value, row, index, field) { return "" + value + ""; }, cellStyle: function (value, row, index, field) { return { css: { "white-space": "nowrap", "text-overflow": "ellipsis", "overflow": "hidden", "max-width": "250px" } }; } }, {field: 'images', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, {field: 'status', title: __('Status'), searchList: Config.statusList, formatter: Table.api.formatter.status}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {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; });