article.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. define(["jquery", "easy-admin"], function ($, ea) {
  2. var init = {
  3. table_elem: '#currentTable',
  4. table_render_id: 'currentTableRenderId',
  5. index_url: 'system.article/index',
  6. add_url: 'system.article/add',
  7. edit_url: 'system.article/edit',
  8. delete_url: 'system.article/delete',
  9. export_url: 'system.auth/export',
  10. modify_url: 'system.auth/modify',
  11. authorize_url: 'system.auth/authorize',
  12. };
  13. var Controller = {
  14. index: function () {
  15. ea.table.render({
  16. init: init,
  17. toolbar:['refresh',
  18. [{
  19. text: '添加',
  20. url: init.add_url,
  21. method: 'open',
  22. auth: 'add',
  23. class: 'layui-btn layui-btn-normal layui-btn-sm',
  24. icon: 'fa fa-plus '
  25. }]]
  26. ,
  27. cols: [[
  28. {type: "checkbox"},
  29. {field: 'id', width: 80, title: 'ID'},
  30. // {field: 'img_pic', minWidth: 80, search: false, title: 'banner图', templet: ea.table.image},
  31. {field: 'title', minWidth: 80, title: '标题'},
  32. {field: 'type', minWidth: 80, title: '类型'},
  33. {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
  34. {
  35. width: 250,
  36. title: '操作',
  37. templet: ea.table.tool,
  38. operat: [
  39. 'edit',
  40. 'delete'
  41. ]
  42. }
  43. ]],
  44. });
  45. ea.listen();
  46. },
  47. add: function () {
  48. ea.listen();
  49. },
  50. edit: function () {
  51. ea.listen();
  52. }
  53. };
  54. return Controller;
  55. });