cash.js 3.4 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: 'cash/index' + location.search,
  8. add_url: 'cash/add',
  9. edit_url: 'cash/edit',
  10. del_url: 'cash/del',
  11. multi_url: 'cash/multi',
  12. import_url: 'cash/import',
  13. table: 'cash',
  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.mobile', title: __('User.mobile')},
  28. {field: 'pay_type', title: __('Pay_type'), searchList: {"1":__('Pay_type 1'),"2":__('Pay_type 2')}, formatter: Table.api.formatter.normal},
  29. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  30. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  31. {field: 'actual_payment', title: __('Actual_payment'), operate:'BETWEEN'},
  32. {field: 'commission', title: __('Commission'), operate:'BETWEEN'},
  33. {field: 'account_number', title: __('Account_number'), operate: 'LIKE'},
  34. {field: 'payee', title: __('Payee'), operate: 'LIKE'},
  35. // {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
  36. {field: 'admin.username', title: __('Admin_id')},
  37. {field: 'failure_cause', title: __('Failure_cause'), operate: 'LIKE'},
  38. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
  41. var that = $.extend({}, this);
  42. var table = $(that.table).clone(true);
  43. $(table).data("operate-del", null);
  44. that.table = table;
  45. return Table.api.formatter.operate.call(that, value, row, index);
  46. }}
  47. ]
  48. ]
  49. });
  50. // 为表格绑定事件
  51. Table.api.bindevent(table);
  52. },
  53. add: function () {
  54. Controller.api.bindevent();
  55. },
  56. edit: function () {
  57. Controller.api.bindevent();
  58. },
  59. api: {
  60. bindevent: function () {
  61. Form.api.bindevent($("form[role=form]"));
  62. }
  63. }
  64. };
  65. return Controller;
  66. });