新增选项卡是否刷新属性

pull/225/MERGE
RuoYi 2020-12-14 15:08:10 +08:00
parent f0e4e1a1a6
commit 9c92d8f87d
3 changed files with 19 additions and 3 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {