order_voucher.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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: 'order_voucher/index' + location.search,
  8. add_url: 'order_voucher/add',
  9. edit_url: 'order_voucher/edit',
  10. del_url: 'order_voucher/del',
  11. multi_url: 'order_voucher/multi',
  12. import_url: 'order_voucher/import',
  13. table: 'order_voucher',
  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. {field: 'id', title: __('Id')},
  25. {field: 'bank_no', title: __('Bank_no')},
  26. {field: 'bank_name', title: __('Bank_name')},
  27. {field: 'bank_username', title: __('Bank_username')},
  28. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  29. {field: 'status', title: __('状态'),searchList:{0:'未审核',1:'通过',2:'驳回'},formatter: Table.api.formatter.label},
  30. {field: 'create_time', title: __('Create_time'),addClass:'datetimerange',formatter: Table.api.formatter.datetime,operate:'range'},
  31. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  32. buttons:[
  33. {
  34. name: 'edit',
  35. text: __('审核'),
  36. title: __('审核'),
  37. classname: 'btn btn-xs btn-info btn-dialog',
  38. icon: 'fa',
  39. url: 'order_voucher/audit',
  40. callback: function (data) {
  41. //Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  42. $('.btn-refresh').trigger('click')
  43. },
  44. visible: function (row) {
  45. return row.status===0 && table.data('operate-audit');
  46. }
  47. },
  48. {
  49. name: 'del',
  50. text: __('删除'),
  51. title: __('删除'),
  52. classname: 'btn btn-xs btn-danger btn-ajax',
  53. icon: 'fa',
  54. url: 'order_voucher/del',
  55. refresh:true,
  56. confirm:'确认删除吗?',
  57. callback: function (data) {
  58. //Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  59. $('.btn-refresh').trigger('click')
  60. },
  61. visible: function (row) {
  62. return table.data('operate-del');
  63. }
  64. },
  65. ]
  66. }
  67. ]
  68. ]
  69. });
  70. // 为表格绑定事件
  71. Table.api.bindevent(table);
  72. },
  73. add: function () {
  74. Controller.api.bindevent();
  75. },
  76. audit: function () {
  77. Controller.api.bindevent();
  78. },
  79. api: {
  80. bindevent: function () {
  81. Form.api.bindevent($("form[role=form]"));
  82. }
  83. }
  84. };
  85. return Controller;
  86. });