institution.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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: 'bi/institution/index' + location.search,
  8. add_url: 'bi/institution/add',
  9. edit_url: 'bi/institution/edit',
  10. del_url: 'bi/institution/del',
  11. multi_url: 'bi/institution/multi',
  12. table: 'bi_institution',
  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. {field: 'id', title: __('Id')},
  24. {field: 'name', title: __('Name')},
  25. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  26. ]
  27. ]
  28. });
  29. // 为表格绑定事件
  30. Table.api.bindevent(table);
  31. },
  32. add: function () {
  33. Controller.api.bindevent();
  34. },
  35. edit: function () {
  36. Controller.api.bindevent();
  37. },
  38. api: {
  39. bindevent: function () {
  40. Form.api.bindevent($("form[role=form]"));
  41. }
  42. }
  43. };
  44. return Controller;
  45. });