userwallet.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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: 'userwallet/index' + location.search,
  8. add_url: 'userwallet/add',
  9. // edit_url: 'userwallet/edit',
  10. // del_url: 'userwallet/del',
  11. multi_url: 'userwallet/multi',
  12. import_url: 'userwallet/import',
  13. table: 'user_wallet',
  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: 'money', title: __('Money'), operate:'BETWEEN'},
  29. {field: 'jewel', title: __('Jewel')},
  30. {field: 'operate', title: __('Operate'),
  31. buttons:[
  32. {
  33. name:'updatejewel',
  34. text:'充值金币',
  35. title:'充值金币',
  36. icon:'fa fa-exclamation-circle',
  37. classname:'btn btn-xs btn-info btn-dialog',
  38. url:function(row){
  39. return 'userwallet/updatejewel/user_id/' + row.user_id+ '?dialog=1';
  40. },
  41. target:'_self',
  42. },
  43. {
  44. name:'updatemoney',
  45. text:'充值海钻',
  46. title:'充值海钻',
  47. icon:'fa fa-exclamation-circle',
  48. classname:'btn btn-xs btn-info btn-dialog',
  49. url:function(row){
  50. return 'userwallet/updatemoney/user_id/' + row.user_id+ '?dialog=1';
  51. },
  52. target:'_self',
  53. },
  54. ],
  55. table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  56. ]
  57. ]
  58. });
  59. // 为表格绑定事件
  60. Table.api.bindevent(table);
  61. },
  62. add: function () {
  63. Controller.api.bindevent();
  64. },
  65. edit: function () {
  66. Controller.api.bindevent();
  67. },
  68. updatejewel: function () {
  69. Controller.api.bindevent();
  70. },
  71. updatemoney: function () {
  72. Controller.api.bindevent();
  73. },
  74. api: {
  75. bindevent: function () {
  76. Form.api.bindevent($("form[role=form]"));
  77. }
  78. }
  79. };
  80. return Controller;
  81. });