diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/index.js b/ruoyi-admin/src/main/resources/static/ruoyi/index.js index eae82b064..6429f28aa 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/index.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/index.js @@ -293,8 +293,11 @@ $(function() { } }); } - if (isRefresh) { + if ($.common.equals(isRefresh, "0")) { + }else if($.common.equals(isRefresh, "1")){ refreshTab(); + }else{ + refreshTable(); } flag = false; return false; @@ -458,6 +461,22 @@ $(function() { target.attr('src', url).ready(); } + // 只刷新当前iframe下面的table和treetable,避免刷新整个tab页签造成检索条件或表单输入丢失 + function refreshTable() { + var currentId = $('.page-tabs-content').find('.active').attr('data-id'); + var topWindow = $(window.document); + //var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel'); + var $contentWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow; + if($contentWindow.table == undefined){ + }else{ + if ($contentWindow.table.options.type == table_type.bootstrapTable) { + $contentWindow.$.table.refresh(); + } else if ($contentWindow.table.options.type == table_type.bootstrapTreeTable) { + $contentWindow.$.treeTable.refresh(); + } + } + } + // 页签全屏 function fullScreenTab() { var currentId = $('.page-tabs-content').find('.active').attr('data-id'); diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index d16d04592..ab1cd1d92 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -270,8 +270,12 @@ function createMenuItem(dataUrl, menuName, isRefresh) { } }); } - if (isRefresh) { - refreshTab(); + + if ($.common.equals(isRefresh, "0")) { + }else if($.common.equals(isRefresh, "1")){ + refreshTab(); + }else{ + refreshTable(); } flag = false; return false; @@ -307,6 +311,21 @@ function refreshTab() { target.attr('src', url).ready(); } +// 只刷新当前iframe下面的table和treetable,避免刷新整个tab页签造成检索条件或表单输入丢失 +function refreshTable() { + var topWindow = $(window.parent.document); + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel'); + var $contentWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow; + if($contentWindow.table == undefined){ + }else{ + if ($contentWindow.table.options.type == table_type.bootstrapTable) { + $contentWindow.$.table.refresh(); + } else if ($contentWindow.table.options.type == table_type.bootstrapTreeTable) { + $contentWindow.$.treeTable.refresh(); + } + } +} + // 滚动到指定选项卡 function scrollToTab(element) { var topWindow = $(window.parent.document); diff --git a/ruoyi-admin/src/main/resources/templates/index-topnav.html b/ruoyi-admin/src/main/resources/templates/index-topnav.html index fe3d38c7e..e2ea250e7 100644 --- a/ruoyi-admin/src/main/resources/templates/index-topnav.html +++ b/ruoyi-admin/src/main/resources/templates/index-topnav.html @@ -49,7 +49,7 @@