define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'firmstoreprojectsone/index' + location.search, add_url: 'firmstoreprojectsone/add', edit_url: 'firmstoreprojectsone/edit', del_url: 'firmstoreprojectsone/del', multi_url: 'firmstoreprojectsone/multi', import_url: 'firmstoreprojectsone/import', table: 'firmstoreprojectsone', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, // {field: 'firm.full_name', title: '企业名称', operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, buttons: [ { name: 'addSunProject', text: __('新增二级项目'), title: __('新增二级项目'), classname: 'btn btn-xs btn-primary btn-dialog', icon: 'fa fa-magic', url: 'firmstoreprojectstwo/add', callback: function (data) { Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); }, visible: function (row) { //返回true时按钮显示,返回false隐藏 return true; } }, { name: 'getSunProject', text: __('查看二级项目列表'), title: __('查看二级项目列表'), classname: 'btn btn-xs btn-success btn-dialog', icon: 'fa fa-list', url: 'firmstoreprojectstwo/index?ids={ids}', callback: function (data) { Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); }, visible: function (row) { //返回true时按钮显示,返回false隐藏 return true; } }, // { // name: 'selectSendTime', // text: __('查看发送时间'), // title: __('查看发送时间'), // classname: 'btn btn-xs btn-danger btn-dialog', // icon: 'fa fa-list', // url: 'firmfollowuptemplatetimelist/index/firmfollowuptemplate_id/{id}', // callback: function (data) { // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); // }, // visible: function (row) { // //返回true时按钮显示,返回false隐藏 // return true; // } // }, ] } ] ] }); // 为表格绑定事件 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; });