12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'operation/rechargetop/index' + location.search,
- table: 'operation_rechargetop',
- }
- });
- var table = $("#table");
- //当表格数据加载完成时
- table.on('load-success.bs.table', function (e, data) {
- //这里可以获取从服务端获取的JSON数据
- //这里我们手动设置底部的值
- $("#total-money").text(data.extend.total_money);
- });
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- searchFormTemplate: 'customformtpl',
- columns: [
- [
- {field: 'user_id', title: __('用户ID')},
- {field: 'user.u_id', title: __('前端用户ID')},
- {field: 'user.nickname', title: __('用户昵称')},
- {field: 'user.mobile', title: __('手机号')},
- {field: 'amount', title: __('总充值金额(元)')},
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|