define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { let Controller = { index: function () { // 初始化表格参数配置 Table.api.init(); //绑定事件 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { var panel = $($(this).attr("href")); if (panel.size() > 0) { Controller.table[panel.attr("id")].call(this); $(this).on('click', function (e) { $($(this).attr("href")).find(".btn-refresh").trigger("click"); }); } //移除绑定的事件 $(this).unbind('shown.bs.tab'); }); //必须默认触发shown.bs.tab事件 $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab"); }, table:{ first:function () { let table1 = $("#table1"); // 初始化表格 table1.bootstrapTable({ url: 'money/bill/index', pk: 'id', sortName: 'id', showToggle : false, toolbar : '#toolbar1', showExport : false, showColumns : false, columns: [ [ { field : 'order_num', title: __('Order_num'), operate: 'LIKE %...%', formatter: Table.api.formatter.bold, }, { field : 'institution_id', title: __('Institution_id'), searchable: false }, { field : 'institution_name', title: __('Institution_name'), operate: 'LIKE %...%' }, { field : 'createdAt', title : __('Createdat'), operate : 'RANGE', addclass: 'datetimerange' }, { field : 'create_user_name', title: __('Create_user_name') }, { field : 'remark', title: __('Remark'), width:'100px' }, { field : 'id', title: __('operate'), width: '120px', formatter: function (value) { return '' +''+ ''; }, } ] ] }); orderDetail = function(id) { let ids = Table.api.getrowbyid(table1,id).water_ids; Fast.api.ajax({ url: 'money/money/makePaymentOrder/disable/1', data: { ids : ids, _method: 'GET' } }, function (data) { Layer.open({ content: data, area : [ $(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%' ], title: '缴费单', btn: false }); return false; }, function (data, ret) { Toastr.error(ret); }); } // 为表格绑定事件 Table.api.bindevent(table1); }, second:function () { let table2 = $("#table2"); // 初始化表格 table2.bootstrapTable({ url: 'money/bill/completedList', pk: 'id', sortName: 'id', showToggle : false, toolbar : '#toolbar2', showExport : false, showColumns : false, columns: [ [ { field : 'order_num', title: __('Order_num'), operate: 'LIKE %...%', formatter: Table.api.formatter.bold, }, { field : 'institution_id', title: __('Institution_id'), searchable: false }, { field : 'institution_name', title: __('Institution_name'), operate: 'LIKE %...%' }, { field : 'createdAt', title : __('Createdat'), operate : 'RANGE', addclass: 'datetimerange' }, { field : 'create_user_name', title: __('Create_user_name') } ] ] }); // 为表格绑定事件 Table.api.bindevent(table2); } }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });