user_wallet.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: 'user_wallet/index' + location.search,
  8. add_url: 'user_wallet/newone',
  9. edit_url: 'user_wallet/edit',
  10. del_url: 'user_wallet/del',
  11. multi_url: 'user_wallet/multi',
  12. import_url: 'user_wallet/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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. search:false,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field: 'id', title: __('Id')},
  29. {field: 'user_id', title: __('User_id')},
  30. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  31. {field: 'company_id', title: __('Company_id')},
  32. {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
  33. {field: 'staff_id', title: __('Staff_id')},
  34. {field: 'staff.truename', title: __('Staff.truename'), operate: 'LIKE'},
  35. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  36. {field: 'address', title: __('Address'), operate: 'LIKE'},
  37. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'comefrom', title: __('Comefrom'), operate: 'LIKE'},
  40. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  41. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  42. ]
  43. ]
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. },
  48. add: function () {
  49. Controller.api.bindevent();
  50. },
  51. edit: function () {
  52. Controller.api.bindevent();
  53. },
  54. newone: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. }
  61. }
  62. };
  63. return Controller;
  64. });