recharge_config.js 4.2 KB

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