recharge_config.js 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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: 'recharge_config/index' + location.search,
  8. add_url: 'recharge_config/add',
  9. edit_url: 'recharge_config/edit',
  10. del_url: 'recharge_config/del',
  11. multi_url: 'recharge_config/multi',
  12. import_url: 'recharge_config/import',
  13. table: 'recharge_config',
  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. search:false,
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'id', title: __('Id')},
  27. {field: 'company_id', title: __('Company_id')},
  28. {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
  29. {field: 'price', title: __('Price'), operate:'BETWEEN'},
  30. {field: 'giftprice', title: __('Giftprice'), operate:'BETWEEN'},
  31. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
  32. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  33. buttons:[
  34. {
  35. name: 'recharge_gift',
  36. text: '赠送列表',
  37. title: '赠送列表',
  38. classname: 'btn btn-xs btn-primary btn-dialog',
  39. icon: 'fa fa-list',
  40. url: function (row, column) {
  41. return "recharge_gift/index?config_id="+row.id;
  42. },
  43. },
  44. {
  45. name:'edit',
  46. text:__('Edit'),
  47. title:__('Edit'),
  48. classname: 'btn btn-xs btn-success btn-editone',
  49. icon: 'fa fa-pencil',
  50. url: function (row, column) {
  51. return "recharge_config/edit?ids="+row.id;
  52. },
  53. refresh:true
  54. },
  55. {
  56. name:'del',
  57. text:__('Del'),
  58. title: __('Del'),
  59. classname: 'btn btn-xs btn-danger btn-delone',
  60. icon: 'fa fa-trash',
  61. url: function (row, column) {
  62. return "recharge_config/del?ids="+row.id;
  63. },
  64. refresh:true
  65. },
  66. ]
  67. }
  68. ]
  69. ]
  70. });
  71. // 为表格绑定事件
  72. Table.api.bindevent(table);
  73. },
  74. add: function () {
  75. Controller.api.bindevent();
  76. },
  77. edit: function () {
  78. Controller.api.bindevent();
  79. },
  80. api: {
  81. bindevent: function () {
  82. $(document).on("fa.event.appendfieldlist", "#second-table .btn-append", function (e, obj) {
  83. Form.events.selectpage(obj);//绑定动态下拉组件
  84. });
  85. Form.api.bindevent($("form[role=form]"));
  86. }
  87. }
  88. };
  89. return Controller;
  90. });