define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'massager/closing/index' + location.search, add_url: 'massager/closing/add', edit_url: 'massager/closing/edit', // del_url: 'massager/closing/del', multi_url: 'massager/closing/multi', import_url: 'massager/closing/import', table: 'massager_closing', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'massager.id', title: __('Massager.id')}, {field: 'massager.name', title: __('Massager.name'), operate: 'LIKE'}, {field: 'year', title: __('Year')}, {field: 'month', title: __('Month')}, {field: 'closing_amount', title: "结算金额"}, { field: 'status', title: __('Status'), searchList: {"checking": __('Checking'), "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: 'city_code', title: __('区域'), searchList: Config.allow_areas, visible: false }, { 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: 'massager/closing/check?id={id}&check=pass', visible: function (row) { return "checking" === row["status"]; }, refresh: true }, { name: 'check_reject', text: '拒绝', title: '拒绝审核', classname: 'btn btn-xs btn-warning btn-view btn-ajax', icon: 'fa fa-times', url: 'massager/closing/check?id={id}&check=reject', visible: function (row) { return "checking" === row["status"]; }, refresh: true }, { name: 'wallet', text: '查看明细', title: '查看明细', icon: 'fa fa-money', classname: 'btn btn-xs btn-primary btn-dialog', url: 'massager/closing/details' }, ], 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; });