define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'exam/member_code/index' + location.search, add_url: 'exam/member_code/add', // edit_url: 'exam/member_code/edit', del_url: 'exam/member_code/del', multi_url: 'exam/member_code/multi', import_url: 'exam/member_code/import', table: 'exam_member_code', } }); var table = $("#table"); // 在普通搜索渲染后 table.on('post-common-search.bs.table', function (event, table) { let form = $("form", table.$commonsearch); $("input[name='user_id']", form).addClass("selectpage").data("source", "user/user/index").data('field', 'nickname').data("orderBy", "id desc"); $("input[name='member_config_id']", form).addClass("selectpage").data("source", "exam/member_config/index").data("orderBy", "id desc"); Form.events.cxselect(form); Form.events.selectpage(form); }); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'member_config_id', title: __('Member_config_id'), visible: false}, {field: 'config.name', title: __('会员开通类型'), operate: false}, {field: 'code', title: __('Code'), operate: 'LIKE'}, {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status}, {field: 'user_id', title: __('User_id'), visible: false}, {field: 'user.nickname', title: __('激活用户'), operate: false}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'updatetime', title: __('Updatetime'), operate:false, 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; });