javascript.stub 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. define(['jquery', 'backend', 'table', 'form'], function ($, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.init = {
  6. table_elem: '#currentTable',
  7. table_render_id: 'currentTable',
  8. index_url: '{%controllerUrl%}/index' + location.search,
  9. add_url: '{%controllerUrl%}/add',
  10. edit_url: '{%controllerUrl%}/edit',
  11. delete_url: '{%controllerUrl%}/del',
  12. multi_url: '{%controllerUrl%}/multi',
  13. recyclebin_url: '{%controllerUrl%}/recyclebin',
  14. };
  15. Table.render({
  16. init: Table.init,
  17. elem: Table.init.table_elem,
  18. toolbar: [{%toolbar%}],
  19. url: Table.init.index_url,
  20. cols: [
  21. [
  22. {%javascriptList%}
  23. ]
  24. ],
  25. page: {}
  26. });
  27. // 为表格绑定事件
  28. Table.api.bindevent();
  29. },{%recyclebinJs%}
  30. add: function () {
  31. Controller.api.bindevent();
  32. },
  33. edit: function () {
  34. Controller.api.bindevent();
  35. },
  36. api: {
  37. bindevent: function () {
  38. Form.api.bindevent($("form.layui-form"));
  39. }
  40. }
  41. };
  42. return Controller;
  43. });