From ce438f182a0d49de7f7f927dfd24e7e52a6527ee Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 30 十一月 2020 12:41:39 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue
---
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java | 2
ruoyi-ui/src/store/modules/permission.js | 5 +
ruoyi-ui/src/views/monitor/cache/index.vue | 4
ruoyi-ui/src/layout/components/AppMain.vue | 121 +++++++++++++++++++++++++++++++++++++---
sql/ry_20201128.sql | 2
pom.xml | 2
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 4 +
ruoyi-ui/package.json | 2
ruoyi-ui/src/components/ParentView/index.vue | 0
ruoyi-ui/src/layout/components/global.js | 3 +
ruoyi-ui/src/views/system/user/profile/userAvatar.vue | 3
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java | 3 +
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 15 +++++
ruoyi-ui/src/layout/components/TagsView/index.vue | 5 +
ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java | 4 +
ruoyi-ui/src/router/index.js | 1
16 files changed, 159 insertions(+), 17 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3584ea6..5c0870d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,7 +43,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
- <version>2.1.17.RELEASE</version>
+ <version>2.1.18.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
index 7bcaced..9cb46cc 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
@@ -37,7 +37,7 @@
/** 鏁版嵁搴撴暟瀛楃被鍨� */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
- "bit", "bigint", "float", "float", "double", "decimal" };
+ "bit", "bigint", "float", "double", "decimal" };
/** 椤甸潰涓嶉渶瑕佺紪杈戝瓧娈� */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
index 746f4b6..56b46ba 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
@@ -54,6 +54,9 @@
/** Layout缁勪欢鏍囪瘑 */
public final static String LAYOUT = "Layout";
+ /** ParentView缁勪欢鏍囪瘑 */
+ public final static String PARENT_VIEW = "ParentView";
+
/** 鏍¢獙杩斿洖缁撴灉鐮� */
public final static String UNIQUE = "0";
public final static String NOT_UNIQUE = "1";
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
index 6d57f22..d9f4efd 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -274,6 +274,10 @@
val = DateUtil.getJavaDate((Double) val);
}
}
+ else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
+ {
+ val = Convert.toBool(val, false);
+ }
if (StringUtils.isNotNull(fieldType))
{
Excel attr = field.getAnnotation(Excel.class);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java
index 5241101..9befe41 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java
@@ -204,6 +204,10 @@
args[i] = DateUtil.getJavaDate((Double) args[i]);
}
}
+ else if (cs[i] == boolean.class || cs[i] == Boolean.class)
+ {
+ args[i] = Convert.toBool(args[i]);
+ }
}
}
return (E) method.invoke(obj, args);
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
index 4090209..09748eb 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -364,6 +364,10 @@
{
component = menu.getComponent();
}
+ else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu))
+ {
+ component = UserConstants.PARENT_VIEW;
+ }
return component;
}
@@ -380,6 +384,17 @@
}
/**
+ * 鏄惁涓簆arent_view缁勪欢
+ *
+ * @param menu 鑿滃崟淇℃伅
+ * @return 缁撴灉
+ */
+ public boolean isParentView(SysMenu menu)
+ {
+ return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType());
+ }
+
+ /**
* 鏍规嵁鐖惰妭鐐圭殑ID鑾峰彇鎵�鏈夊瓙鑺傜偣
*
* @param list 鍒嗙被琛�
diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json
index bb15443..4f46a63 100644
--- a/ruoyi-ui/package.json
+++ b/ruoyi-ui/package.json
@@ -45,7 +45,7 @@
"clipboard": "2.0.4",
"core-js": "3.6.5",
"echarts": "4.2.1",
- "element-ui": "2.13.2",
+ "element-ui": "2.14.1",
"file-saver": "2.0.1",
"js-beautify": "1.10.2",
"fuse.js": "3.4.4",
diff --git a/ruoyi-ui/src/views/system/log/index.vue b/ruoyi-ui/src/components/ParentView/index.vue
similarity index 100%
rename from ruoyi-ui/src/views/system/log/index.vue
rename to ruoyi-ui/src/components/ParentView/index.vue
diff --git a/ruoyi-ui/src/layout/components/AppMain.vue b/ruoyi-ui/src/layout/components/AppMain.vue
index a897638..f172fc2 100644
--- a/ruoyi-ui/src/layout/components/AppMain.vue
+++ b/ruoyi-ui/src/layout/components/AppMain.vue
@@ -1,7 +1,8 @@
+<!-- @author ruoyi 20201128 鏀寔涓夌骇浠ヤ笂鑿滃崟缂撳瓨 -->
<template>
<section class="app-main">
<transition name="fade-transform" mode="out-in">
- <keep-alive :include="cachedViews">
+ <keep-alive :max="20" :exclude="notCacheName">
<router-view :key="key" />
</keep-alive>
</transition>
@@ -9,17 +10,119 @@
</template>
<script>
+import Global from "@/layout/components/global.js";
+
export default {
name: 'AppMain',
computed: {
- cachedViews() {
- return this.$store.state.tagsView.cachedViews
+ notCacheName() {
+ var visitedViews = this.$store.state.tagsView.visitedViews;
+ var noCacheViews = [];
+ Object.keys(visitedViews).some((index) => {
+ if (visitedViews[index].meta.noCache) {
+ noCacheViews.push(visitedViews[index].name);
+ }
+ });
+ return noCacheViews;
},
key() {
- return this.$route.path
- }
- }
-}
+ return this.$route.path;
+ },
+ },
+ mounted() {
+ // 鍏抽棴鏍囩瑙﹀彂
+ Global.$on("removeCache", (name, view) => {
+ this.removeCache(name, view);
+ });
+ },
+ methods: {
+ // 鑾峰彇鏈塳eep-alive瀛愯妭鐐圭殑Vnode
+ getVnode() {
+ // 鍒ゆ柇瀛愰泦闈炵┖
+ if (this.$children.length == 0) return false;
+ let vnode;
+ for (let item of this.$children) {
+ // 濡傛灉data涓湁key鍒欎唬琛ㄦ壘鍒颁簡keep-alive涓嬮潰鐨勫瓙闆嗭紝杩欎釜key灏辨槸router-view涓婄殑key
+ if (item.$vnode.data.key) {
+ vnode = item.$vnode;
+ break;
+ }
+ }
+ return vnode ? vnode : false;
+ },
+ // 绉婚櫎keep-alive缂撳瓨
+ removeCache(name, view = {}) {
+ let vnode = this.getVnode();
+ if (!vnode) return false;
+ let componentInstance = vnode.parent.componentInstance;
+ // 杩欎釜key鏄敤鏉ヨ幏鍙栧墠缂�鐢ㄦ潵鍚庨潰姝e垯鍖归厤鐢ㄧ殑
+ let keyStart = vnode.key.split("/")[0];
+ let thisKey = `${keyStart}${view.fullPath}`;
+ let regKey = `${keyStart}${view.path}`;
+
+ this[name]({ componentInstance, thisKey, regKey });
+ },
+ // 绉婚櫎鍏朵粬
+ closeOthersTags({ componentInstance, thisKey }) {
+ Object.keys(componentInstance.cache).forEach((key, index) => {
+ if (key != thisKey) {
+ // 閿�姣佸疄渚�(杩欓噷瀛樺湪澶氫釜key鎸囧悜涓�涓紦瀛樼殑鎯呭喌鍙兘鍓嶉潰涓�涓凡缁忔竻闄ゆ帀浜嗘墍鏈夎鍔犲垽鏂�)
+ if (componentInstance.cache[key]) {
+ componentInstance.cache[key].componentInstance.$destroy();
+ }
+ // 鍒犻櫎缂撳瓨
+ delete componentInstance.cache[key];
+ // 绉婚櫎key涓搴旂殑key
+ componentInstance.keys.splice(index, 1);
+ }
+ });
+ },
+ // 绉婚櫎鎵�鏈夌紦瀛�
+ closeAllTags({ componentInstance }) {
+ // 閿�姣佸疄渚�
+ Object.keys(componentInstance.cache).forEach((key) => {
+ if (componentInstance.cache[key]) {
+ componentInstance.cache[key].componentInstance.$destroy();
+ }
+ });
+ // 鍒犻櫎缂撳瓨
+ componentInstance.cache = {};
+ // 绉婚櫎key涓搴旂殑key
+ componentInstance.keys = [];
+ },
+ // 绉婚櫎鍗曚釜缂撳瓨
+ closeSelectedTag({ componentInstance, regKey }) {
+ let reg = new RegExp(`^${regKey}`);
+ Object.keys(componentInstance.cache).forEach((key, i) => {
+ if (reg.test(key)) {
+ // 閿�姣佸疄渚�
+ if (componentInstance.cache[key]) {
+ componentInstance.cache[key].componentInstance.$destroy();
+ }
+ // 鍒犻櫎缂撳瓨
+ delete componentInstance.cache[key];
+ // 绉婚櫎key涓搴旂殑key
+ componentInstance.keys.splice(i, 1);
+ }
+ });
+ },
+ // 鍒锋柊鍗曚釜缂撳瓨
+ refreshSelectedTag({ componentInstance, thisKey }) {
+ Object.keys(componentInstance.cache).forEach((key, index) => {
+ if (null != thisKey && key.replace("/redirect", "") == thisKey) {
+ // 1 閿�姣佸疄渚�(杩欓噷瀛樺湪澶氫釜key鎸囧悜涓�涓紦瀛樼殑鎯呭喌鍙兘鍓嶉潰涓�涓凡缁忔竻闄ゆ帀浜嗘墍鏈夎鍔犲垽鏂�)
+ if (componentInstance.cache[key]) {
+ componentInstance.cache[key].componentInstance.$destroy();
+ }
+ // 2 鍒犻櫎缂撳瓨
+ delete componentInstance.cache[key];
+ // 3 绉婚櫎key涓搴旂殑key
+ componentInstance.keys.splice(index, 1);
+ }
+ });
+ },
+ },
+};
</script>
<style lang="scss" scoped>
@@ -31,7 +134,7 @@
overflow: hidden;
}
-.fixed-header+.app-main {
+.fixed-header + .app-main {
padding-top: 50px;
}
@@ -41,7 +144,7 @@
min-height: calc(100vh - 84px);
}
- .fixed-header+.app-main {
+ .fixed-header + .app-main {
padding-top: 84px;
}
}
diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue
index bc6ce18..81c2007 100644
--- a/ruoyi-ui/src/layout/components/TagsView/index.vue
+++ b/ruoyi-ui/src/layout/components/TagsView/index.vue
@@ -29,6 +29,7 @@
<script>
import ScrollPane from './ScrollPane'
import path from 'path'
+import Global from "@/layout/components/global.js";
export default {
components: { ScrollPane },
@@ -144,6 +145,7 @@
})
})
})
+ Global.$emit("removeCache", "refreshSelectedTag", this.selectedTag);
},
closeSelectedTag(view) {
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
@@ -151,12 +153,14 @@
this.toLastView(visitedViews, view)
}
})
+ Global.$emit("removeCache", "closeSelectedTag", view);
},
closeOthersTags() {
this.$router.push(this.selectedTag)
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag()
})
+ Global.$emit("removeCache", "closeOthersTags", this.selectedTag);
},
closeAllTags(view) {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
@@ -165,6 +169,7 @@
}
this.toLastView(visitedViews, view)
})
+ Global.$emit("removeCache", "closeAllTags");
},
toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
diff --git a/ruoyi-ui/src/layout/components/global.js b/ruoyi-ui/src/layout/components/global.js
new file mode 100644
index 0000000..5d2b5b3
--- /dev/null
+++ b/ruoyi-ui/src/layout/components/global.js
@@ -0,0 +1,3 @@
+import Vue from 'vue'
+const global = new Vue()
+export default global
diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js
index 2cca17c..ffb12e7 100644
--- a/ruoyi-ui/src/router/index.js
+++ b/ruoyi-ui/src/router/index.js
@@ -5,6 +5,7 @@
/* Layout */
import Layout from '@/layout'
+import ParentView from '@/components/ParentView';
/**
* Note: 璺敱閰嶇疆椤�
diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js
index cf18fcf..5ade2ed 100644
--- a/ruoyi-ui/src/store/modules/permission.js
+++ b/ruoyi-ui/src/store/modules/permission.js
@@ -1,6 +1,7 @@
import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
+import ParentView from '@/components/ParentView';
const permission = {
state: {
@@ -33,9 +34,11 @@
function filterAsyncRouter(asyncRouterMap) {
return asyncRouterMap.filter(route => {
if (route.component) {
- // Layout缁勪欢鐗规畩澶勭悊
+ // Layout ParentView 缁勪欢鐗规畩澶勭悊
if (route.component === 'Layout') {
route.component = Layout
+ } else if (route.component === 'ParentView') {
+ route.component = ParentView
} else {
route.component = loadView(route.component)
}
diff --git a/ruoyi-ui/src/views/monitor/cache/index.vue b/ruoyi-ui/src/views/monitor/cache/index.vue
index c78a220..6b012df 100644
--- a/ruoyi-ui/src/views/monitor/cache/index.vue
+++ b/ruoyi-ui/src/views/monitor/cache/index.vue
@@ -117,14 +117,14 @@
this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons");
this.usedmemory.setOption({
tooltip: {
- formatter: "{b} <br/>{a} : {c}M",
+ formatter: "{b} <br/>{a} : {c}K",
},
series: [
{
name: "宄板��",
type: "gauge",
detail: {
- formatter: "{value}M",
+ formatter: "{value}K",
},
data: [
{
diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue
index deeabe7..b456094 100644
--- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue
+++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue
@@ -144,6 +144,7 @@
.user-info-head {
position: relative;
display: inline-block;
+ height: 120px;
}
.user-info-head:hover:after {
@@ -163,4 +164,4 @@
line-height: 110px;
border-radius: 50%;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/sql/ry_20201123.sql b/sql/ry_20201128.sql
similarity index 99%
rename from sql/ry_20201123.sql
rename to sql/ry_20201128.sql
index 92a5927..a838c55 100644
--- a/sql/ry_20201123.sql
+++ b/sql/ry_20201128.sql
@@ -169,7 +169,7 @@
insert into sys_menu values('105', '瀛楀吀绠$悊', '1', '6', 'dict', 'system/dict/index', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '瀛楀吀绠$悊鑿滃崟');
insert into sys_menu values('106', '鍙傛暟璁剧疆', '1', '7', 'config', 'system/config/index', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '鍙傛暟璁剧疆鑿滃崟');
insert into sys_menu values('107', '閫氱煡鍏憡', '1', '8', 'notice', 'system/notice/index', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '閫氱煡鍏憡鑿滃崟');
-insert into sys_menu values('108', '鏃ュ織绠$悊', '1', '9', 'log', 'system/log/index', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '鏃ュ織绠$悊鑿滃崟');
+insert into sys_menu values('108', '鏃ュ織绠$悊', '1', '9', 'log', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '鏃ュ織绠$悊鑿滃崟');
insert into sys_menu values('109', '鍦ㄧ嚎鐢ㄦ埛', '2', '1', 'online', 'monitor/online/index', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '鍦ㄧ嚎鐢ㄦ埛鑿滃崟');
insert into sys_menu values('110', '瀹氭椂浠诲姟', '2', '2', 'job', 'monitor/job/index', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '瀹氭椂浠诲姟鑿滃崟');
insert into sys_menu values('111', '鏁版嵁鐩戞帶', '2', '3', 'druid', 'monitor/druid/index', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '鏁版嵁鐩戞帶鑿滃崟');
--
Gitblit v1.9.3