dashboard.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
  2. var Controller = {
  3. index: function () {
  4. $(document).on("click", ".btn-refresh", function () {
  5. setTimeout(function () {
  6. myChart.resize();
  7. }, 0);
  8. });
  9. $(document).on("click", ".J_nav", function () {
  10. var obj = top.window.$("ul.nav-addtabs li");
  11. obj.find(".fa-remove").trigger("click");
  12. top.window.$('body').removeClass('sidebar-collapse');
  13. showmenu($(this).data('py'),$(this).data('url'));
  14. });
  15. // showmenu('');
  16. function showmenu(str,url){
  17. var obj = top.window.$(".sidebar-menu > li");
  18. $.each(obj,function(){
  19. if($(this).find('a').attr('py') == str || $(this).find('a').attr('py') == 'gzt'){
  20. if($(this).hasClass('treeview')){
  21. $(this).addClass('treeview-open');
  22. $(this).find('.treeview-menu').addClass('menu-open');
  23. $(this).find('.treeview-menu').show();
  24. }
  25. $(this).show();
  26. if($(this).hasClass('treeview')){
  27. var o = $(this).find('.treeview-menu > li:eq(0)');
  28. url = url||o.find('a').attr('href');
  29. var title = o.text();
  30. var icon = o.find('a > i').attr('class');
  31. Backend.api.addtabs(url, title, icon);
  32. }else{
  33. url = $(this).find('a').attr('href');
  34. var title = $(this).text();
  35. var icon = $(this).find('a > i').attr('class');
  36. Backend.api.addtabs(url, title, icon);
  37. }
  38. }else{
  39. $(this).hide();
  40. }
  41. });
  42. }
  43. }
  44. };
  45. return Controller;
  46. });