withdrawal.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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: 'greenroom/withdrawal/index' + location.search,
  8. edit_url: 'greenroom/withdrawal/edit',
  9. multi_url: 'greenroom/withdrawal/multi',
  10. import_url: 'greenroom/withdrawal/import',
  11. table: 'withdrawal',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'id', title: __('Id')},
  24. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  25. {field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  26. {field: 'uid', title: __('Uid')},
  27. {field: 'account', title: __('Account'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  28. {field: 'status', title: __('状态'), searchList: {"1":__('申请中'),"2":__('已完成')}, formatter: Table.api.formatter.status},
  29. {field: 'admin.username', title: __('Admin.username'), operate: 'LIKE'},
  30. {field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
  31. {field: 'admin.appname', title: __('Admin.appname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  33. ]
  34. ]
  35. });
  36. // 为表格绑定事件
  37. Table.api.bindevent(table);
  38. },
  39. add: function () {
  40. Controller.api.bindevent();
  41. },
  42. edit: function () {
  43. Controller.api.bindevent();
  44. },
  45. api: {
  46. bindevent: function () {
  47. Form.api.bindevent($("form[role=form]"));
  48. }
  49. }
  50. };
  51. return Controller;
  52. });