define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'recharge_config/index' + location.search, add_url: 'recharge_config/add', edit_url: 'recharge_config/edit', del_url: 'recharge_config/del', multi_url: 'recharge_config/multi', import_url: 'recharge_config/import', table: 'recharge_config', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', search:false, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'company_id', title: __('Company_id')}, {field: 'company.name', title: __('Company.name'), operate: 'LIKE'}, {field: 'price', title: __('Price'), operate:'BETWEEN'}, {field: 'giftprice', title: __('Giftprice'), operate:'BETWEEN'}, {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, buttons:[ { name: 'recharge_gift', text: '赠送列表', title: '赠送列表', classname: 'btn btn-xs btn-primary btn-dialog', url:'recharge_gift/index/config_id/{ids}?dialog=1', icon: 'fa fa-list', target: '_self', extend: 'data-area=["90%","90%"]', }, ] } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { $(document).on("fa.event.appendfieldlist", "#second-table .btn-append", function (e, obj) { Form.events.selectpage(obj);//绑定动态下拉组件 }); Form.api.bindevent($("form[role=form]")); } } }; return Controller; });