recharge_config.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. url:function(row){
  40. return 'recharge_gift/index/config_id/'+ row.id +'/company_id/'+ row.company_id +'?dialog=1';
  41. },
  42. icon: 'fa fa-list',
  43. target: '_self',
  44. extend: 'data-area=["90%","90%"]',
  45. },
  46. ]
  47. }
  48. ]
  49. ]
  50. });
  51. // 为表格绑定事件
  52. Table.api.bindevent(table);
  53. },
  54. add: function () {
  55. Controller.api.bindevent();
  56. },
  57. edit: function () {
  58. Controller.api.bindevent();
  59. },
  60. api: {
  61. bindevent: function () {
  62. $(document).on("fa.event.appendfieldlist", "#second-table .btn-append", function (e, obj) {
  63. Form.events.selectpage(obj);//绑定动态下拉组件
  64. });
  65. Form.api.bindevent($("form[role=form]"));
  66. }
  67. }
  68. };
  69. return Controller;
  70. });