recharge_config.js 3.0 KB

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