define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'user_relation/index' + location.search, add_url: 'user_relation/add', edit_url: 'user_relation/edit', del_url: 'user_relation/del', multi_url: 'user_relation/multi', import_url: 'user_relation/import', table: 'user_relation', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'user_id', sortName: 'user_id', columns: [ [ {checkbox: true}, {field: 'user_id', title: __('User_id')}, {field: 'cid', title: __('Cid')}, {field: 'unionid', title: __('Unionid'), operate: 'LIKE'}, {field: 'openid', title: __('Openid'), operate: 'LIKE'}, {field: 'routine_openid', title: __('Routine_openid'), operate: 'LIKE'}, {field: 'nickname', title: __('Nickname'), operate: 'LIKE'}, {field: 'headimgurl', title: __('Headimgurl'), operate: 'LIKE', formatter: Table.api.formatter.url}, {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal}, {field: 'city', title: __('City'), operate: 'LIKE'}, {field: 'language', title: __('Language'), operate: 'LIKE'}, {field: 'province', title: __('Province'), operate: 'LIKE'}, {field: 'country', title: __('Country'), operate: 'LIKE'}, {field: 'remark', title: __('Remark'), operate: 'LIKE'}, {field: 'groupid', title: __('Groupid')}, {field: 'tagid_list', title: __('Tagid_list'), operate: 'LIKE'}, {field: 'subscribe', title: __('Subscribe'), searchList: {"0":__('Subscribe 0'),"1":__('Subscribe 1')}, formatter: Table.api.formatter.normal}, {field: 'subscribe_time', title: __('Subscribe_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'stair', title: __('Stair')}, {field: 'second', title: __('Second')}, {field: 'order_stair', title: __('Order_stair')}, {field: 'order_second', title: __('Order_second')}, {field: 'brokerage_price', title: __('Brokerage_price'), operate:'BETWEEN'}, {field: 'session_key', title: __('Session_key'), operate: 'LIKE'}, {field: 'user_type', title: __('User_type'), searchList: {"0":__('User_type 0'),"1":__('User_type 1'),"2":__('User_type 2'),"3":__('User_type 3')}, formatter: Table.api.formatter.normal}, {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; });