bonusconfig.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: 'config/bonusconfig/index' + location.search,
  8. add_url: 'config/bonusconfig/add',
  9. edit_url: 'config/bonusconfig/edit',
  10. del_url: 'config/bonusconfig/del',
  11. multi_url: 'config/bonusconfig/multi',
  12. table: 'bonus_config',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'name', title: __('Name')},
  26. {field: 'bonus_type', title: __('Bonus_type')},
  27. {field: 'config_type', title: __('Config_type')},
  28. {field: 'min_layer', title: __('Min_layer')},
  29. {field: 'max_layer', title: __('Max_layer')},
  30. {field: 'value', title: __('Value')},
  31. {field: 'user_level', title: __('User_level')},
  32. {field: 'cap', title: __('Cap'), operate:'BETWEEN'},
  33. {field: 'ext', title: __('Ext')},
  34. {field: 'exts', title: __('Exts')},
  35. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  36. ]
  37. ]
  38. });
  39. // 为表格绑定事件
  40. Table.api.bindevent(table);
  41. },
  42. add: function () {
  43. Controller.api.bindevent();
  44. },
  45. edit: function () {
  46. Controller.api.bindevent();
  47. },
  48. bonusset:function(){
  49. Controller.api.bindevent();
  50. },
  51. api: {
  52. bindevent: function () {
  53. Form.api.bindevent($("form[role=form]"));
  54. }
  55. }
  56. };
  57. return Controller;
  58. });