From 9c92d8f87d6567c68bf405477791f8ac52366bf1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 14 Dec 2020 15:08:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=89=E9=A1=B9=E5=8D=A1?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=88=B7=E6=96=B0=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ruoyi/index.js | 4 ++++ .../src/main/resources/static/ruoyi/js/common.js | 14 +++++++++++++- .../src/main/resources/static/ruoyi/js/ry-ui.js | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/index.js b/ruoyi-admin/src/main/resources/static/ruoyi/index.js index ab25dc7eb..c53b20a50 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/index.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/index.js @@ -249,6 +249,7 @@ $(function() { var dataUrl = $(this).attr('href'), dataIndex = $(this).data('index'), menuName = $.trim($(this).text()), + isRefresh = $(this).data("refresh"), flag = true; var $dataObj = $('a[href$="' + decodeURI(dataUrl) + '"]'); @@ -278,6 +279,9 @@ $(function() { } }); } + if (isRefresh) { + refreshTab(); + } flag = false; return false; } 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 d07d0aa0e..d6e1a31a2 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -264,7 +264,7 @@ var closeItem = function(dataId){ } /** 创建选项卡 */ -function createMenuItem(dataUrl, menuName) { +function createMenuItem(dataUrl, menuName, isRefresh) { var panelUrl = window.frameElement.getAttribute('data-id'); dataIndex = $.common.random(1, 100), flag = true; @@ -285,6 +285,9 @@ function createMenuItem(dataUrl, menuName) { } }); } + if (isRefresh) { + refreshTab(); + } flag = false; return false; } @@ -310,6 +313,15 @@ function createMenuItem(dataUrl, menuName) { return false; } +// 刷新iframe +function refreshTab() { + var topWindow = $(window.parent.document); + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id'); + var target = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow); + var url = target.attr('src'); + target.attr('src', url).ready(); +} + // 滚动到指定选项卡 function scrollToTab(element) { var topWindow = $(window.parent.document); diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 077e8c6b1..8e6cd2348 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -891,8 +891,8 @@ var table = { layer.full(index); }, // 选卡页方式打开 - openTab: function (title, url) { - createMenuItem(url, title); + openTab: function (title, url, isRefresh) { + createMenuItem(url, title, isRefresh); }, // 选卡页同一页签打开 parentTab: function (title, url) {