market.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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: 'market/index' + location.search,
  8. add_url: 'market/add',
  9. edit_url: 'market/edit',
  10. del_url: 'market/del',
  11. multi_url: 'market/multi',
  12. table: 'market',
  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: 'spot_limit_buy', title: __('Spot_limit_buy'), searchList: {"1":__('Spot_limit_buy 1'),"2":__('Spot_limit_buy 2')}, formatter: Table.api.formatter.normal},
  26. {field: 'spot_limit_sell', title: __('Spot_limit_sell'), searchList: {"1":__('Spot_limit_sell 1'),"2":__('Spot_limit_sell 2')}, formatter: Table.api.formatter.normal},
  27. {field: 'spot_market_buy', title: __('Spot_market_buy'), searchList: {"1":__('Spot_market_buy 1'),"2":__('Spot_market_buy 2')}, formatter: Table.api.formatter.normal},
  28. {field: 'spot_market_sell', title: __('Spot_market_sell'), searchList: {"1":__('Spot_market_sell 1'),"2":__('Spot_market_sell 2')}, formatter: Table.api.formatter.normal},
  29. {field: 'swap_limit_buy', title: __('Swap_limit_buy'), searchList: {"1":__('Swap_limit_buy 1'),"2":__('Swap_limit_buy 2')}, formatter: Table.api.formatter.normal},
  30. {field: 'swap_limit_sell', title: __('Swap_limit_sell'), searchList: {"1":__('Swap_limit_sell 1'),"2":__('Swap_limit_sell 2')}, formatter: Table.api.formatter.normal},
  31. {field: 'swap_market_buy', title: __('Swap_market_buy'), searchList: {"1":__('Swap_market_buy 1'),"2":__('Swap_market_buy 2')}, formatter: Table.api.formatter.normal},
  32. {field: 'swap_market_sell', title: __('Swap_market_sell'), searchList: {"1":__('Swap_market_sell 1'),"2":__('Swap_market_sell 2')}, formatter: Table.api.formatter.normal},
  33. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  34. ]
  35. ]
  36. });
  37. // 为表格绑定事件
  38. Table.api.bindevent(table);
  39. },
  40. add: function () {
  41. Controller.api.bindevent();
  42. },
  43. edit: function () {
  44. Controller.api.bindevent();
  45. },
  46. //手续费设置
  47. handlingset: function () {
  48. // 不可见元素不验证
  49. Controller.api.bindevent();
  50. },
  51. api: {
  52. bindevent: function () {
  53. Form.api.bindevent($("form[role=form]"));
  54. }
  55. }
  56. };
  57. return Controller;
  58. });