quick.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea) {
  2. var iconPickerFa = layui.iconPickerFa,
  3. autocomplete = layui.autocomplete;
  4. var init = {
  5. table_elem: '#currentTable',
  6. table_render_id: 'currentTableRenderId',
  7. index_url: 'system.quick/index',
  8. add_url: 'system.quick/add',
  9. edit_url: 'system.quick/edit',
  10. delete_url: 'system.quick/delete',
  11. export_url: 'system.quick/export',
  12. modify_url: 'system.quick/modify',
  13. };
  14. return {
  15. index: function () {
  16. ea.table.render({
  17. init: init,
  18. cols: [[
  19. {type: "checkbox"},
  20. {field: 'id', width: 80, title: 'ID', searchOp: '='},
  21. {field: 'sort', width: 80, title: '排序', edit: 'text'},
  22. {field: 'title', minWidth: 80, title: '权限名称'},
  23. {field: 'icon', width: 80, title: '图标', templet: ea.table.icon},
  24. {field: 'href', minWidth: 120, title: '快捷链接'},
  25. {field: 'remark', minWidth: 80, title: '备注信息'},
  26. {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
  27. {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
  28. {width: 250, title: '操作', templet: ea.table.tool, operat: ['edit', 'delete']}
  29. ]],
  30. });
  31. ea.listen();
  32. },
  33. add: function () {
  34. $(function () {
  35. iconPickerFa.render({
  36. elem: '#icon',
  37. url: PATH_CONFIG.iconLess,
  38. limit: 12,
  39. click: function (data) {
  40. $('#icon').val('fa ' + data.icon);
  41. },
  42. success: function (d) {
  43. console.log(d);
  44. }
  45. });
  46. })
  47. autocomplete.render({
  48. elem: $('#href')[0],
  49. url: ea.url('system.menu/getMenuTips'),
  50. template_val: '{{d.node}}',
  51. template_txt: '{{d.node}} <span class="layui-badge">{{d.title}}</span>',
  52. onselect: function (resp) {
  53. }
  54. });
  55. ea.listen();
  56. },
  57. edit: function () {
  58. $(function () {
  59. iconPickerFa.render({
  60. elem: '#icon',
  61. url: PATH_CONFIG.iconLess,
  62. limit: 12,
  63. click: function (data) {
  64. $('#icon').val('fa ' + data.icon);
  65. },
  66. success: function (d) {
  67. console.log(d);
  68. }
  69. });
  70. })
  71. autocomplete.render({
  72. elem: $('#href')[0],
  73. url: ea.url('system.menu/getMenuTips'),
  74. template_val: '{{d.node}}',
  75. template_txt: '{{d.node}} <span class="layui-badge">{{d.title}}</span>',
  76. onselect: function (resp) {
  77. }
  78. });
  79. ea.listen();
  80. },
  81. };
  82. });