define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'packagegift/index/package_id/' + Config.package_id + location.search, add_url: 'packagegift/add/package_id/' + Config.package_id, edit_url: 'packagegift/edit', del_url: 'packagegift/del', multi_url: 'packagegift/multi', import_url: 'packagegift/import', table: 'package_gift', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'package_id', title: __('Package_id')}, {field: 'coupon_id', title: __('Coupon_id')}, {field: 'number', title: __('Number')}, {field: 'package.title', title: __('Package.title'), operate: 'LIKE'}, {field: 'coupons.name', title: __('Coupons.name'), operate: 'LIKE'}, {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 () { $("#c-company_id").data("params",function(){ return {custom:{status:1}}; }); $("#c-package_id").data("params",function(){ return {custom:{company_id:$('#c-company_id').val(),status:1}}; }); $("#c-coupon_id").data("params",function(){ return {custom:{company_id:$('#c-company_id').val(),status:1}}; }); Form.api.bindevent($("form[role=form]")); } } }; return Controller; });