templatelist.js 1.5 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: 'templatelist/index',
  8. multi_url: 'templatelist/multi',
  9. table: 'templatelist',
  10. }
  11. });
  12. var table = $("#table");
  13. // 初始化表格
  14. table.bootstrapTable({
  15. url: $.fn.bootstrapTable.defaults.extend.index_url,
  16. sortName: 'id',
  17. search: false,
  18. commonSearch: false,
  19. columns: [
  20. [
  21. {field: 'template_id', title: '模版ID'},
  22. {field: 'primary_industry', title: '一级行业'},
  23. {field: 'deputy_industry', title: '二级行业'},
  24. {field: 'content', title: '详细内容'},
  25. {field: 'example', title: '内容示例'},
  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. });