From 8cd8625f7172ddb1bf889e2e687c647d566a292d Mon Sep 17 00:00:00 2001 From: monozuki62 Date: Mon, 16 Aug 2021 21:42:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=88=E5=AF=B9=E7=82=B9=E5=87=BB=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=EF=BC=8C=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E4=BD=9C=E5=81=9A=E4=BA=86=E4=B8=80=E7=82=B9?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E3=80=82=20=E5=9C=A8=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E3=80=90?= =?UTF-8?q?=E4=BB=85=E5=88=B7=E6=96=B0=E5=88=97=E8=A1=A8=E3=80=91=E7=9A=84?= =?UTF-8?q?=E9=80=89=E9=A1=B9=20=E5=85=81=E8=AE=B8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AA=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84?= =?UTF-8?q?table=E5=92=8CtreeTable=20=E4=B8=BA=E8=8F=9C=E5=8D=95=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E3=80=90=E4=BB=85=E5=88=B7=E6=96=B0=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=91=E5=90=8E=EF=BC=8C=E5=8F=AF=E4=BB=A5=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E7=82=B9=E5=87=BB=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?=E5=A4=B1=E5=8E=BB=E6=A3=80=E7=B4=A2=E6=A0=8F=E7=9A=84=E8=BE=93?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E6=88=96=E8=80=85=E5=B7=B2=E7=BB=8F=E5=A1=AB?= =?UTF-8?q?=E5=85=A5=E7=9A=84form=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ruoyi/index.js | 21 ++++++++++++++++- .../main/resources/static/ruoyi/js/common.js | 23 +++++++++++++++++-- .../resources/templates/index-topnav.html | 6 ++--- .../src/main/resources/templates/index.html | 8 +++---- .../resources/templates/system/menu/add.html | 12 ++++++---- .../resources/templates/system/menu/edit.html | 12 ++++++---- .../common/core/domain/entity/SysMenu.java | 2 +- 7 files changed, 65 insertions(+), 19 deletions(-) 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 @@
diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/edit.html b/ruoyi-admin/src/main/resources/templates/system/menu/edit.html index fd1950cce..b96244df9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/menu/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/menu/edit.html @@ -81,12 +81,16 @@
- - + +
- - + + +
+
+ +
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index da1869a5c..98b2c502d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -43,7 +43,7 @@ public class SysMenu extends BaseEntity /** 菜单状态(0显示 1隐藏) */ private String visible; - /** 是否刷新(0刷新 1不刷新) */ + /** 是否刷新(0不刷新 1全页面刷新 2仅列表刷新) */ private String isRefresh; /** 权限字符串 */