define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'agency/index' + location.search, // add_url: 'agency/add', edit_url: 'agency/edit', del_url: 'agency/del', multi_url: 'agency/multi', import_url: 'agency/import', table: 'agency', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name'), operate: 'LIKE'}, {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, {field: 'id_card', title: __('Id_card'), operate: 'LIKE'}, {field: 'id_card', title: __('Id_card'), operate: 'LIKE'}, {field: 'budget', title: __('投资预算'), operate: 'LIKE'}, { field: 'license_images', title: __('License_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images }, { field: 'status', title: __('Status'), searchList: {"process": __('Process'), "reject": __('Reject'), "allow": __('Allow')}, formatter: Table.api.formatter.status }, { field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime }, { field: 'operate', title: __('Operate'), table: table, buttons: [ { name: 'check_pass', text: '', title: '通过审核', classname: 'btn btn-xs btn-success btn-view btn-ajax', icon: 'fa fa-check', url: 'agency/check?id={id}&check=pass', visible: function (row) { return "default" === row["status"]; }, refresh: true }, { name: 'check_reject', text: '', title: '拒绝审核', classname: 'btn btn-xs btn-warning btn-view btn-ajax', icon: 'fa fa-times', url: 'agency/check?id={id}&check=reject', visible: function (row) { return "default" === row["status"]; }, refresh: true }, ], 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; });