define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'sos/sos/index' + location.search, add_url: 'sos/sos/add', edit_url: 'sos/sos/edit', del_url: 'sos/sos/del', multi_url: 'sos/sos/multi', import_url: 'sos/sos/import', table: 'sos', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'cid', title: __('Cid')}, {field: 'user_id', title: __('User_id')}, {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, {field: 'latitude', title: __('Latitude'), operate: 'LIKE'}, {field: 'longitude', title: __('Longitude'), operate: 'LIKE'}, {field: 'rescuers_id', title: __('Rescuers_id')}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"-1":__('Status -1')}, formatter: Table.api.formatter.status}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { $("#c-user_id").data("params", function (obj) { return {custom: {cid: $("#c-cid").val()}}; }); $("#c-rescuers_id").data("params", function (obj) { return {custom: {cid: $("#c-cid").val()}}; }); Controller.api.bindevent(); }, edit: function () { $("#c-user_id").data("params", function (obj) { return {custom: {cid: $("#c-cid").val()}}; }); $("#c-rescuers_id").data("params", function (obj) { return {custom: {cid: $("#c-cid").val()}}; }); Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });