moneylog.js 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'agent/moneylog/index' + location.search,
  8. add_url: 'agent/moneylog/add',
  9. edit_url: 'agent/moneylog/edit',
  10. del_url: 'agent/moneylog/del',
  11. multi_url: 'agent/moneylog/multi',
  12. import_url: 'agent/moneylog/import',
  13. table: 'user_money_log',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'user_id', title: __('User_id')},
  27. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  28. {field: 'user.nickname', title: __('昵称'), operate: 'LIKE'},
  29. {field: 'other_user_id', title: __('相关方用户ID')},
  30. {field: 'otheruser.username', title: __('相关方用户名'), operate: 'LIKE'},
  31. {field: 'otheruser.nickname', title: __('相关方昵称'), operate: 'LIKE'},
  32. {field: 'log_type', title: __('Log_type'),operate:'IN'},
  33. {field: 'log_type_text', title: __('Log_type'),operate:false},
  34. // {field: 'money_type', title: __('Money_type'), operate: 'LIKE'},
  35. {field: 'change_value', title: __('Change_value'), operate:'BETWEEN'},
  36. {field: 'remain', title: __('Remain'), operate:'BETWEEN'},
  37. // {field: 'table', title: __('Table'), operate: 'LIKE'},
  38. // {field: 'table_id', title: __('Table_id')},
  39. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  40. {field: 'call_minutes', title: __('通话时长'), operate: false},
  41. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  44. ]
  45. ]
  46. });
  47. //这里我们手动设置底部的值
  48. table.on('load-success.bs.table', function (e, data) {
  49. $("#sum_money").text(data.extend.sum_money);
  50. $("#today_sum_money").text(data.extend.today_sum_money);
  51. $("#week_sum_money").text(data.extend.week_sum_money);
  52. });
  53. // 为表格绑定事件
  54. Table.api.bindevent(table);
  55. },
  56. add: function () {
  57. Controller.api.bindevent();
  58. },
  59. edit: function () {
  60. Controller.api.bindevent();
  61. },
  62. api: {
  63. bindevent: function () {
  64. Form.api.bindevent($("form[role=form]"));
  65. }
  66. }
  67. };
  68. return Controller;
  69. });