define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'account/withdraws/index' + location.search, add_url: 'account/withdraws/add', edit_url: 'account/withdraws/edit', del_url: 'account/withdraws/del', multi_url: 'account/withdraws/multi', import_url: 'account/withdraws/import', table: 'account_withdraws', } }); 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: 'apply_sn', title: __('Apply_sn'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'user_id', title: __('User_id')}, {field: 'account_log_id', title: __('Account_log_id')}, {field: 'amount', title: __('Amount'), operate:'BETWEEN'}, {field: 'remark', title: __('Remark'), operate: 'LIKE'}, {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal}, {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status}, {field: 'result_status', title: __('Result_status'), operate: 'LIKE', formatter: Table.api.formatter.status}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { name: 'audit', title: __('提现审核'), classname: 'btn btn-xs btn-success btn-dialog', icon: 'fa fa-check-circle-o', url: 'account/withdraws/audit', hidden: function(row){ //判断按钮是否隐藏 return row.status === 0; } //判断按钮是否隐藏,支持function } ], formatter: Table.api.formatter.operate} ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, audit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });