diff --git a/pom.xml b/pom.xml index 2edd52312..dfb34647f 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 1.5.22 4.1.2 2.2.11 - 1.7 + 2.3 0.9.1 3.4.3.4 3.9.1 @@ -118,7 +118,7 @@ org.apache.velocity - velocity + velocity-engine-core ${velocity.version} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 440eebb7e..4261f17e4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -73,6 +73,7 @@ public class SysProfileController extends BaseController { LoginUser loginUser = getLoginUser(); SysUser sysUser = userService.selectUserById(loginUser.getUserId()); user.setUserId(sysUser.getUserId()); + user.setUserName(null); user.setPassword(null); if (userService.updateUserProfile(user) > 0) { return AjaxResult.success(); diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml index 668489f6e..045ecbaf8 100644 --- a/ruoyi-generator/pom.xml +++ b/ruoyi-generator/pom.xml @@ -20,7 +20,7 @@ org.apache.velocity - velocity + velocity-engine-core diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java index 461bc2cce..a81bd51df 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java @@ -19,10 +19,9 @@ public class VelocityInitializer { Properties p = new Properties(); try { // 加载classpath目录下的vm文件 - p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); // 定义字符集 p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); - p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); // 初始化Velocity引擎,指定配置Properties Velocity.init(p); } catch (Exception e) { diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 0a3ffbc51..d2e0e3a65 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -247,7 +247,8 @@ public class VelocityUtils { List dicts = new ArrayList(); for (GenTableColumn column : columns) { if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( - column.getHtmlType(), new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO})) { + column.getHtmlType(), + new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) { dicts.add("'" + column.getDictType() + "'"); } } diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index 24494adf3..7c530cb13 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -108,7 +108,11 @@ #elseif($column.list && $column.dictType && "" != $column.dictType) #elseif($column.list && "" != $javaField) @@ -296,8 +300,7 @@ export default { queryParams: { #foreach ($column in $columns) #if($column.query) - $column.javaField: null#if($velocityCount != $columns.size()),#end - + $column.javaField: null#if($foreach.count != $columns.size()),#end #end #end }, @@ -315,8 +318,7 @@ export default { #end $column.javaField: [ { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end } - ]#if($velocityCount != $columns.size()),#end - + ]#if($foreach.count != $columns.size()),#end #end #end } @@ -379,14 +381,12 @@ export default { this.form = { #foreach ($column in $columns) #if($column.htmlType == "radio") - $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end + $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end #elseif($column.htmlType == "checkbox") - $column.javaField: []#if($velocityCount != $columns.size()),#end - + $column.javaField: []#if($foreach.count != $columns.size()),#end #else - $column.javaField: null#if($velocityCount != $columns.size()),#end - + $column.javaField: null#if($foreach.count != $columns.size()),#end #end #end }; diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 765017054..c0a5bf716 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -136,7 +136,11 @@ #elseif($column.list && $column.dictType && "" != $column.dictType) #elseif($column.list && "" != $javaField) @@ -360,8 +364,7 @@ export default { pageSize: 10, #foreach ($column in $columns) #if($column.query) - $column.javaField: undefined#if($velocityCount != $columns.size()),#end - + $column.javaField: undefined#if($foreach.count != $columns.size()),#end #end #end }, @@ -379,8 +382,7 @@ export default { #end $column.javaField: [ { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end } - ]#if($velocityCount != $columns.size()),#end - + ]#if($foreach.count != $columns.size()),#end #end #end } @@ -424,14 +426,11 @@ export default { this.form = { #foreach ($column in $columns) #if($column.htmlType == "radio") - $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($velocityCount != $columns.size()),#end - + $column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end #elseif($column.htmlType == "checkbox") - $column.javaField: []#if($velocityCount != $columns.size()),#end - + $column.javaField: []#if($foreach.count != $columns.size()),#end #else - $column.javaField: undefined#if($velocityCount != $columns.size()),#end - + $column.javaField: undefined#if($foreach.count != $columns.size()),#end #end #end }; diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index cb2109c51..bad8e7723 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -46,7 +46,7 @@ "fuse.js": "6.4.3", "highlight.js": "9.18.5", "js-beautify": "1.13.0", - "js-cookie": "2.2.1", + "js-cookie": "3.0.1", "jsencrypt": "3.2.1", "nprogress": "0.2.0", "quill": "1.3.7", @@ -55,7 +55,7 @@ "vue": "2.6.12", "vue-count-to": "1.0.13", "vue-cropper": "0.5.5", - "vue-meta": "^2.4.0", + "vue-meta": "2.4.0", "vue-router": "3.4.9", "vuedraggable": "2.24.3", "vuex": "3.6.0" diff --git a/ruoyi-ui/src/api/monitor/server.js b/ruoyi-ui/src/api/monitor/server.js index feed7836c..12489d873 100644 --- a/ruoyi-ui/src/api/monitor/server.js +++ b/ruoyi-ui/src/api/monitor/server.js @@ -1,9 +1,9 @@ import request from '@/utils/request' -// 查询服务器详细 +// 获取服务信息 export function getServer() { return request({ url: '/monitor/server', method: 'get' }) -} \ No newline at end of file +} diff --git a/ruoyi-ui/src/components/Breadcrumb/index.vue b/ruoyi-ui/src/components/Breadcrumb/index.vue index 1fbae5f3c..1696f5471 100644 --- a/ruoyi-ui/src/components/Breadcrumb/index.vue +++ b/ruoyi-ui/src/components/Breadcrumb/index.vue @@ -2,7 +2,7 @@ - {{ item.meta.title }} + {{ item.meta.title }} {{ item.meta.title }} diff --git a/ruoyi-ui/src/components/RightToolbar/index.vue b/ruoyi-ui/src/components/RightToolbar/index.vue index c7ab139d7..976974e4a 100644 --- a/ruoyi-ui/src/components/RightToolbar/index.vue +++ b/ruoyi-ui/src/components/RightToolbar/index.vue @@ -62,7 +62,7 @@ export default { }, // 右侧列表元素变化 dataChange(data) { - for (var item in this.columns) { + for (let item in this.columns) { const key = this.columns[item].key; this.columns[item].visible = !data.includes(key); } diff --git a/ruoyi-ui/src/components/RuoYi/Doc/index.vue b/ruoyi-ui/src/components/RuoYi/Doc/index.vue index e267f9021..a60fd213a 100644 --- a/ruoyi-ui/src/components/RuoYi/Doc/index.vue +++ b/ruoyi-ui/src/components/RuoYi/Doc/index.vue @@ -1,6 +1,6 @@ diff --git a/ruoyi-ui/src/components/RuoYi/Git/index.vue b/ruoyi-ui/src/components/RuoYi/Git/index.vue index 4d580e418..faecbc178 100644 --- a/ruoyi-ui/src/components/RuoYi/Git/index.vue +++ b/ruoyi-ui/src/components/RuoYi/Git/index.vue @@ -1,6 +1,6 @@ diff --git a/ruoyi-ui/src/components/SizeSelect/index.vue b/ruoyi-ui/src/components/SizeSelect/index.vue index e88065b49..069b5de9b 100644 --- a/ruoyi-ui/src/components/SizeSelect/index.vue +++ b/ruoyi-ui/src/components/SizeSelect/index.vue @@ -5,8 +5,7 @@ - {{ - item.label }} + {{ item.label }} diff --git a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue index 416968737..b8d9d6b7c 100644 --- a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue +++ b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue @@ -29,7 +29,7 @@ export default { variables() { return variables; }, - sideTheme() { + sideTheme() { return this.$store.state.settings.sideTheme } }, diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue index 99bb28969..20c4b55e6 100644 --- a/ruoyi-ui/src/layout/components/TagsView/index.vue +++ b/ruoyi-ui/src/layout/components/TagsView/index.vue @@ -152,31 +152,24 @@ export default { }) }, refreshSelectedTag(view) { - this.$store.dispatch('tagsView/delCachedView', view).then(() => { - const { fullPath } = view - this.$nextTick(() => { - this.$router.replace({ - path: '/redirect' + fullPath - }) - }) - }) + this.$tab.refreshPage(view); }, closeSelectedTag(view) { - this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { + this.$tab.closePage(view).then(({ visitedViews }) => { if (this.isActive(view)) { this.toLastView(visitedViews, view) } }) }, closeRightTags() { - this.$store.dispatch('tagsView/delRightTags', this.selectedTag).then(visitedViews => { + this.$tab.closeRightPage(this.selectedTag).then(visitedViews => { if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) { this.toLastView(visitedViews) } }) }, closeLeftTags() { - this.$store.dispatch('tagsView/delLeftTags', this.selectedTag).then(visitedViews => { + this.$tab.closeLeftPage(this.selectedTag).then(visitedViews => { if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) { this.toLastView(visitedViews) } @@ -184,12 +177,12 @@ export default { }, closeOthersTags() { this.$router.push(this.selectedTag).catch(()=>{}); - this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => { + this.$tab.closeOtherPage(this.selectedTag).then(() => { this.moveToCurrentTag() }) }, closeAllTags(view) { - this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => { + this.$tab.closeAllPage().then(({ visitedViews }) => { if (this.affixTags.some(tag => tag.path === this.$route.path)) { return } diff --git a/ruoyi-ui/src/layout/index.vue b/ruoyi-ui/src/layout/index.vue index 214d86ffe..8be418409 100644 --- a/ruoyi-ui/src/layout/index.vue +++ b/ruoyi-ui/src/layout/index.vue @@ -98,7 +98,7 @@ export default { } .hideSidebar .fixed-header { - width: calc(100% - 54px) + width: calc(100% - 54px); } .mobile .fixed-header { diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index 76e33d59e..29c402265 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -10,7 +10,7 @@ import '@/assets/styles/ruoyi.scss' // ruoyi css import App from './App' import store from './store' import router from './router' -import directive from './directive' //directive +import directive from './directive' // directive import plugins from './plugins' // plugins import { download } from '@/utils/request' diff --git a/ruoyi-ui/src/plugins/index.js b/ruoyi-ui/src/plugins/index.js index 7cc83a4c8..9bc6eacd3 100644 --- a/ruoyi-ui/src/plugins/index.js +++ b/ruoyi-ui/src/plugins/index.js @@ -1,3 +1,4 @@ +import tab from './tab' import auth from './auth' import cache from './cache' import modal from './modal' @@ -5,6 +6,8 @@ import download from './download' export default { install(Vue) { + // 页签操作 + Vue.prototype.$tab = tab // 认证对象 Vue.prototype.$auth = auth // 缓存对象 diff --git a/ruoyi-ui/src/plugins/tab.js b/ruoyi-ui/src/plugins/tab.js new file mode 100644 index 000000000..95a3848b6 --- /dev/null +++ b/ruoyi-ui/src/plugins/tab.js @@ -0,0 +1,66 @@ +import store from '@/store' +import router from '@/router'; + +export default { + // 刷新当前tab页签 + refreshPage(obj) { + const { path, matched } = router.currentRoute; + if (obj === undefined) { + matched.forEach((m) => { + if (m.components && m.components.default && m.components.default.name) { + if (!['Layout', 'ParentView'].includes(m.components.default.name)) { + obj = { name: m.components.default.name, path: path }; + } + } + }); + } + return store.dispatch('tagsView/delCachedView', obj).then(() => { + const { path } = obj + router.replace({ + path: '/redirect' + path + }) + }) + }, + // 关闭当前tab页签,打开新页签 + closeOpenPage(obj) { + store.dispatch("tagsView/delView", router.currentRoute); + if (obj !== undefined) { + return router.push(obj); + } + }, + // 关闭指定tab页签 + closePage(obj) { + if (obj === undefined) { + return store.dispatch('tagsView/delView', router.currentRoute).then(({ lastPath }) => { + return router.push(lastPath || '/'); + }); + } + return store.dispatch('tagsView/delView', obj); + }, + // 关闭所有tab页签 + closeAllPage() { + return store.dispatch('tagsView/delAllViews'); + }, + // 关闭左侧tab页签 + closeLeftPage(obj) { + return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute); + }, + // 关闭右侧tab页签 + closeRightPage(obj) { + return store.dispatch('tagsView/delRightTags', obj || router.currentRoute); + }, + // 关闭其他tab页签 + closeOtherPage(obj) { + return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute); + }, + // 添加tab页签 + openPage(title, url) { + var obj = { path: url, meta: { title: title } } + store.dispatch('tagsView/addView', obj); + return router.push(url); + }, + // 修改tab页签 + updatePage(obj) { + return store.dispatch('tagsView/updateVisitedView', obj); + } +} diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index b6b14fabc..cda6d4c3a 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -95,7 +95,7 @@ export const constantRoutes = [ path: 'role/:userId(\\d+)', component: (resolve) => require(['@/views/system/user/authRole'], resolve), name: 'AuthRole', - meta: { title: '分配角色', activeMenu: '/system/user'} + meta: { title: '分配角色', activeMenu: '/system/user' } } ] }, @@ -108,7 +108,7 @@ export const constantRoutes = [ path: 'user/:roleId(\\d+)', component: (resolve) => require(['@/views/system/role/authUser'], resolve), name: 'AuthUser', - meta: { title: '分配用户', activeMenu: '/system/role'} + meta: { title: '分配用户', activeMenu: '/system/role' } } ] }, @@ -121,7 +121,7 @@ export const constantRoutes = [ path: 'index/:dictId(\\d+)', component: (resolve) => require(['@/views/system/dict/data'], resolve), name: 'Data', - meta: { title: '字典数据', activeMenu: '/system/dict'} + meta: { title: '字典数据', activeMenu: '/system/dict' } } ] }, @@ -147,7 +147,7 @@ export const constantRoutes = [ path: 'index', component: (resolve) => require(['@/views/tool/gen/editTable'], resolve), name: 'GenEdit', - meta: { title: '修改生成配置', activeMenu: '/tool/gen'} + meta: { title: '修改生成配置', activeMenu: '/tool/gen' } } ] } diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js index dba9252f4..8d84fff81 100644 --- a/ruoyi-ui/src/store/modules/permission.js +++ b/ruoyi-ui/src/store/modules/permission.js @@ -1,7 +1,7 @@ import { constantRoutes } from '@/router' import { getRouters } from '@/api/menu' import Layout from '@/layout/index' -import ParentView from '@/components/ParentView'; +import ParentView from '@/components/ParentView' import InnerLink from '@/layout/components/InnerLink' const permission = { @@ -24,7 +24,7 @@ const permission = { // 顶部导航菜单默认添加统计报表栏指向首页 const index = [{ path: 'index', - meta: { title: '统计报表', icon: 'dashboard'} + meta: { title: '统计报表', icon: 'dashboard' } }] state.topbarRouters = routes.concat(index); }, diff --git a/ruoyi-ui/src/store/modules/settings.js b/ruoyi-ui/src/store/modules/settings.js index 5f36d8eee..2455a1e27 100644 --- a/ruoyi-ui/src/store/modules/settings.js +++ b/ruoyi-ui/src/store/modules/settings.js @@ -8,7 +8,7 @@ const state = { theme: storageSetting.theme || '#409EFF', sideTheme: storageSetting.sideTheme || sideTheme, showSettings: showSettings, - topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, + topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView, fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader, sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo, diff --git a/ruoyi-ui/src/store/modules/tagsView.js b/ruoyi-ui/src/store/modules/tagsView.js index ef2fe4caf..002c1d099 100644 --- a/ruoyi-ui/src/store/modules/tagsView.js +++ b/ruoyi-ui/src/store/modules/tagsView.js @@ -14,7 +14,7 @@ const mutations = { }, ADD_CACHED_VIEW: (state, view) => { if (state.cachedViews.includes(view.name)) return - if (!view.meta.noCache) { + if (view.meta && !view.meta.noCache) { state.cachedViews.push(view.name) } }, @@ -63,7 +63,7 @@ const mutations = { } } }, - + DEL_RIGHT_VIEWS: (state, view) => { const index = state.visitedViews.findIndex(v => v.path === view.path) if (index === -1) { diff --git a/ruoyi-ui/src/utils/dict/index.js b/ruoyi-ui/src/utils/dict/index.js index 66ddfef9e..d6fdb802c 100644 --- a/ruoyi-ui/src/utils/dict/index.js +++ b/ruoyi-ui/src/utils/dict/index.js @@ -5,7 +5,7 @@ export default function(Vue, options) { mergeOptions(options) Vue.mixin({ data() { - if (this.$options.dicts === undefined || this.$options.dicts === null) { + if (this.$options === undefined || this.$options.dicts === undefined || this.$options.dicts === null) { return {} } const dict = new Dict() diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 6c35bd8d4..4df893666 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -3,7 +3,12 @@