Merge remote-tracking branch 'origin/master'

pull/31/head
hetianchen 5 years ago
commit 5082b67722

@ -1,5 +1,7 @@
## 平台简介 ## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 采用前后端分离的模式,微服务版本前端(基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue))。 * 采用前后端分离的模式,微服务版本前端(基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue))。
* 后端采用Spring Boot、Spring Cloud & Alibaba。 * 后端采用Spring Boot、Spring Cloud & Alibaba。
* 注册中心、配置中心选型Nacos权限认证使用Redis。 * 注册中心、配置中心选型Nacos权限认证使用Redis。

@ -812,7 +812,7 @@ public class ExcelUtil<T>
*/ */
private Object getValue(Object o, String name) throws Exception private Object getValue(Object o, String name) throws Exception
{ {
if (StringUtils.isNotEmpty(name)) if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name))
{ {
Class<?> clazz = o.getClass(); Class<?> clazz = o.getClass();
Field field = clazz.getDeclaredField(name); Field field = clazz.getDeclaredField(name);

@ -1,6 +1,9 @@
package com.ruoyi.common.log.aspect; package com.ruoyi.common.log.aspect;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
@ -209,8 +212,31 @@ public class LogAspect
* @param o * @param o
* @return truefalse * @return truefalse
*/ */
@SuppressWarnings("rawtypes")
public boolean isFilterObject(final Object o) public boolean isFilterObject(final Object o)
{ {
Class<?> clazz = o.getClass();
if (clazz.isArray())
{
return clazz.getComponentType().isAssignableFrom(MultipartFile.class);
}
else if (Collection.class.isAssignableFrom(clazz))
{
Collection collection = (Collection) o;
for (Iterator iter = collection.iterator(); iter.hasNext();)
{
return iter.next() instanceof MultipartFile;
}
}
else if (Map.class.isAssignableFrom(clazz))
{
Map map = (Map) o;
for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
{
Map.Entry entry = (Map.Entry) iter.next();
return entry.getValue() instanceof MultipartFile;
}
}
return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse; return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse;
} }
} }

@ -1,11 +1,13 @@
package com.ruoyi.common.redis.service; package com.ruoyi.common.redis.service;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
@ -136,10 +138,15 @@ public class RedisService
* @param dataSet * @param dataSet
* @return * @return
*/ */
public <T> long setCacheSet(final String key, final Set<T> dataSet) public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
{ {
Long count = redisTemplate.opsForSet().add(key, dataSet); BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
return count == null ? 0 : count; Iterator<T> it = dataSet.iterator();
while (it.hasNext())
{
setOperation.add(it.next());
}
return setOperation;
} }
/** /**

@ -171,11 +171,13 @@ public class SysUserController extends BaseController
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
@ -193,11 +195,13 @@ public class SysUserController extends BaseController
public AjaxResult edit(@Validated @RequestBody SysUser user) public AjaxResult edit(@Validated @RequestBody SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} }
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }

@ -9,11 +9,7 @@
"build:prod": "vue-cli-service build", "build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src"
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"test:ci": "npm run lint && npm run test:unit",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
"new": "plop"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
@ -41,59 +37,45 @@
}, },
"dependencies": { "dependencies": {
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"axios": "0.18.1", "axios": "0.21.0",
"clipboard": "2.0.4", "clipboard": "2.0.6",
"core-js": "3.6.5", "core-js": "3.8.1",
"echarts": "4.2.1", "echarts": "4.9.0",
"element-ui": "2.14.1", "element-ui": "2.14.1",
"file-saver": "2.0.1", "file-saver": "2.0.4",
"js-beautify": "1.10.2", "fuse.js": "6.4.3",
"fuse.js": "3.4.4", "highlight.js": "10.4.1",
"js-cookie": "2.2.0", "js-beautify": "1.13.0",
"js-cookie": "2.2.1",
"jsencrypt": "3.0.0-rc.1", "jsencrypt": "3.0.0-rc.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"path-to-regexp": "2.4.0", "path-to-regexp": "6.2.0",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"quill": "1.3.7", "quill": "1.3.7",
"vue-cropper": "0.4.9", "screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vue-splitpane": "1.0.4", "vuedraggable": "2.24.3",
"vuedraggable": "2.20.0", "vuex": "3.6.0"
"vuex": "3.1.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "4.4.4", "@vue/cli-plugin-babel": "4.4.6",
"@vue/cli-plugin-eslint": "4.4.4", "@vue/cli-plugin-eslint": "4.4.6",
"@vue/cli-plugin-unit-jest": "4.4.4", "@vue/cli-service": "4.4.6",
"@vue/cli-service": "4.4.4",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "9.5.1",
"babel-eslint": "10.1.0", "babel-eslint": "10.1.0",
"babel-jest": "23.6.0", "chalk": "4.1.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6", "connect": "3.6.6",
"eslint": "6.7.2", "eslint": "7.15.0",
"eslint-plugin-vue": "6.2.2", "eslint-plugin-vue": "7.2.0",
"html-webpack-plugin": "3.2.0", "lint-staged": "10.5.3",
"husky": "1.3.1", "sass": "1.30.0",
"lint-staged": "8.1.5", "runjs": "4.4.2",
"mockjs": "1.0.1-beta3", "sass-loader": "10.1.0",
"plop": "2.3.0", "script-ext-html-webpack-plugin": "2.1.5",
"runjs": "4.3.2", "svg-sprite-loader": "5.1.1",
"node-sass": "4.14.1", "vue-template-compiler": "2.6.12"
"sass-loader": "8.0.2",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"vue-template-compiler": "2.6.10"
}, },
"engines": { "engines": {
"node": ">=8.9", "node": ">=8.9",

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

@ -92,6 +92,15 @@
background-color: rgba(0, 0, 0, 0.06) !important; background-color: rgba(0, 0, 0, 0.06) !important;
} }
} }
& .theme-dark .nest-menu .el-submenu>.el-submenu__title,
& .theme-dark .el-submenu .el-menu-item {
background-color: $subMenuBg !important;
&:hover {
background-color: $subMenuHover !important;
}
}
} }
.hideSidebar { .hideSidebar {

@ -12,7 +12,7 @@
class="header-search-select" class="header-search-select"
@change="change" @change="change"
> >
<el-option v-for="item in options" :key="item.path" :value="item" :label="item.title.join(' > ')" /> <el-option v-for="option in options" :key="option.item.path" :value="option.item" :label="option.item.title.join(' > ')" />
</el-select> </el-select>
</div> </div>
</template> </template>
@ -167,7 +167,7 @@ export default {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
/deep/ .el-input__inner { ::v-deep .el-input__inner {
border-radius: 0; border-radius: 0;
border: 0; border: 0;
padding-left: 0; padding-left: 0;

@ -22,11 +22,8 @@ export default {
}, },
methods: { methods: {
click() { click() {
if (!screenfull.enabled) { if (!screenfull.isEnabled) {
this.$message({ this.$message({ message: '你的浏览器不支持全屏', type: 'warning' })
message: 'you browser can not work',
type: 'warning'
})
return false return false
} }
screenfull.toggle() screenfull.toggle()
@ -35,12 +32,12 @@ export default {
this.isFullscreen = screenfull.isFullscreen this.isFullscreen = screenfull.isFullscreen
}, },
init() { init() {
if (screenfull.enabled) { if (screenfull.isEnabled) {
screenfull.on('change', this.change) screenfull.on('change', this.change)
} }
}, },
destroy() { destroy() {
if (screenfull.enabled) { if (screenfull.isEnabled) {
screenfull.off('change', this.change) screenfull.off('change', this.change)
} }
} }

@ -1,8 +1,7 @@
<!-- @author ruoyi 20201128 支持三级以上菜单缓存 -->
<template> <template>
<section class="app-main"> <section class="app-main">
<transition name="fade-transform" mode="out-in"> <transition name="fade-transform" mode="out-in">
<keep-alive :max="20" :exclude="notCacheName"> <keep-alive :include="cachedViews">
<router-view :key="key" /> <router-view :key="key" />
</keep-alive> </keep-alive>
</transition> </transition>
@ -10,119 +9,17 @@
</template> </template>
<script> <script>
import Global from "@/layout/components/global.js";
export default { export default {
name: 'AppMain', name: 'AppMain',
computed: { computed: {
notCacheName() { cachedViews() {
var visitedViews = this.$store.state.tagsView.visitedViews; return this.$store.state.tagsView.cachedViews
var noCacheViews = [];
Object.keys(visitedViews).some((index) => {
if (visitedViews[index].meta.noCache) {
noCacheViews.push(visitedViews[index].name);
}
});
return noCacheViews;
}, },
key() { key() {
return this.$route.path; return this.$route.path
},
},
mounted() {
//
Global.$on("removeCache", (name, view) => {
this.removeCache(name, view);
});
},
methods: {
// keep-aliveVnode
getVnode() {
//
if (this.$children.length == 0) return false;
let vnode;
for (let item of this.$children) {
// datakeykeep-alivekeyrouter-viewkey
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
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];
// keykey
componentInstance.keys.splice(index, 1);
}
});
},
//
closeAllTags({ componentInstance }) {
//
Object.keys(componentInstance.cache).forEach((key) => {
if (componentInstance.cache[key]) {
componentInstance.cache[key].componentInstance.$destroy();
}
});
//
componentInstance.cache = {};
// keykey
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];
// keykey
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 keykey
componentInstance.keys.splice(index, 1);
}
});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -13,7 +13,7 @@
mode="vertical" mode="vertical"
> >
<sidebar-item <sidebar-item
v-for="(route, index) in permission_routes" v-for="(route, index) in sidebarRouters"
:key="route.path + index" :key="route.path + index"
:item="route" :item="route"
:base-path="route.path" :base-path="route.path"
@ -33,7 +33,7 @@ export default {
components: { SidebarItem, Logo }, components: { SidebarItem, Logo },
computed: { computed: {
...mapState(["settings"]), ...mapState(["settings"]),
...mapGetters(["permission_routes", "sidebar"]), ...mapGetters(["sidebarRouters", "sidebar"]),
activeMenu() { activeMenu() {
const route = this.$route; const route = this.$route;
const { meta, path } = route; const { meta, path } = route;

@ -82,7 +82,7 @@ export default {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
/deep/ { ::v-deep {
.el-scrollbar__bar { .el-scrollbar__bar {
bottom: 0px; bottom: 0px;
} }

@ -29,7 +29,6 @@
<script> <script>
import ScrollPane from './ScrollPane' import ScrollPane from './ScrollPane'
import path from 'path' import path from 'path'
import Global from "@/layout/components/global.js";
export default { export default {
components: { ScrollPane }, components: { ScrollPane },
@ -145,7 +144,6 @@ export default {
}) })
}) })
}) })
Global.$emit("removeCache", "refreshSelectedTag", this.selectedTag);
}, },
closeSelectedTag(view) { closeSelectedTag(view) {
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
@ -153,14 +151,12 @@ export default {
this.toLastView(visitedViews, view) this.toLastView(visitedViews, view)
} }
}) })
Global.$emit("removeCache", "closeSelectedTag", view);
}, },
closeOthersTags() { closeOthersTags() {
this.$router.push(this.selectedTag) this.$router.push(this.selectedTag)
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => { this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag() this.moveToCurrentTag()
}) })
Global.$emit("removeCache", "closeOthersTags", this.selectedTag);
}, },
closeAllTags(view) { closeAllTags(view) {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => { this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
@ -169,7 +165,6 @@ export default {
} }
this.toLastView(visitedViews, view) this.toLastView(visitedViews, view)
}) })
Global.$emit("removeCache", "closeAllTags");
}, },
toLastView(visitedViews, view) { toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0] const latestView = visitedViews.slice(-1)[0]

@ -2,8 +2,6 @@ import Vue from 'vue'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import Element from 'element-ui' import Element from 'element-ui'
import './assets/styles/element-variables.scss' import './assets/styles/element-variables.scss'
@ -23,6 +21,9 @@ import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels,
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
// 自定义表格工具扩展 // 自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar" import RightToolbar from "@/components/RightToolbar"
// 代码高亮插件
import hljs from 'highlight.js'
import 'highlight.js/styles/github-gist.css'
// 全局方法挂载 // 全局方法挂载
Vue.prototype.getDicts = getDicts Vue.prototype.getDicts = getDicts
@ -52,6 +53,7 @@ Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar) Vue.component('RightToolbar', RightToolbar)
Vue.use(permission) Vue.use(permission)
Vue.use(hljs.vuePlugin);
/** /**
* If you don't want to use mock-server * If you don't want to use mock-server

@ -23,28 +23,18 @@ router.beforeEach((to, from, next) => {
// 拉取user_info // 拉取user_info
const roles = res.roles const roles = res.roles
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
// 测试 默认静态页面
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
}) })
}) }).catch(err => {
.catch(err => { store.dispatch('LogOut').then(() => {
store.dispatch('FedLogOut').then(() => {
Message.error(err) Message.error(err)
next({ path: '/' }) next({ path: '/' })
}) })
}) })
} else { } else {
next() next()
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
// if (hasPermission(store.getters.roles, to.meta.roles)) {
// next()
// } else {
// next({ path: '/401', replace: true, query: { noGoBack: true }})
// }
// 可删 ↑
} }
} }
} else { } else {

@ -10,6 +10,7 @@ const getters = {
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes permission_routes: state => state.permission.routes,
sidebarRouters:state => state.permission.sidebarRouters,
} }
export default getters export default getters

@ -6,13 +6,17 @@ import ParentView from '@/components/ParentView';
const permission = { const permission = {
state: { state: {
routes: [], routes: [],
addRoutes: [] addRoutes: [],
sidebarRouters: []
}, },
mutations: { mutations: {
SET_ROUTES: (state, routes) => { SET_ROUTES: (state, routes) => {
state.addRoutes = routes state.addRoutes = routes
state.routes = constantRoutes.concat(routes) state.routes = constantRoutes.concat(routes)
} },
SET_SIDEBAR_ROUTERS: (state, routers) => {
state.sidebarRouters = routers
},
}, },
actions: { actions: {
// 生成路由 // 生成路由
@ -20,10 +24,14 @@ const permission = {
return new Promise(resolve => { return new Promise(resolve => {
// 向后端请求路由数据 // 向后端请求路由数据
getRouters().then(res => { getRouters().then(res => {
const accessedRoutes = filterAsyncRouter(res.data) const sdata = JSON.parse(JSON.stringify(res.data))
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true }) const rdata = JSON.parse(JSON.stringify(res.data))
commit('SET_ROUTES', accessedRoutes) const sidebarRoutes = filterAsyncRouter(sdata)
resolve(accessedRoutes) const rewriteRoutes = filterAsyncRouter(rdata, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', sidebarRoutes)
resolve(rewriteRoutes)
}) })
}) })
} }
@ -31,8 +39,11 @@ const permission = {
} }
// 遍历后台传来的路由字符串,转换为组件对象 // 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap) { function filterAsyncRouter(asyncRouterMap, isRewrite = false) {
return asyncRouterMap.filter(route => { return asyncRouterMap.filter(route => {
if (isRewrite && route.children) {
route.children = filterChildren(route.children)
}
if (route.component) { if (route.component) {
// Layout ParentView 组件特殊处理 // Layout ParentView 组件特殊处理
if (route.component === 'Layout') { if (route.component === 'Layout') {
@ -44,12 +55,34 @@ function filterAsyncRouter(asyncRouterMap) {
} }
} }
if (route.children != null && route.children && route.children.length) { if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children) route.children = filterAsyncRouter(route.children, route, isRewrite)
} }
return true return true
}) })
} }
function filterChildren(childrenMap) {
var children = []
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
if (el.component === 'ParentView') {
el.children.forEach(c => {
c.path = el.path + '/' + c.path
if (c.children && c.children.length) {
children = children.concat(filterChildren(c.children, c))
return
}
children.push(c)
})
childrenMap.splice(index, 1)
return
}
}
children = children.concat(el)
})
return children
}
export const loadView = (view) => { // 路由懒加载 export const loadView = (view) => { // 路由懒加载
return (resolve) => require([`@/views/${view}`], resolve) return (resolve) => require([`@/views/${view}`], resolve)
} }

@ -158,7 +158,7 @@ export function handleTree(data, id, parentId, children, rootId) {
export function tansParams(params) { export function tansParams(params) {
let result = '' let result = ''
Object.keys(params).forEach((key) => { Object.keys(params).forEach((key) => {
if (!Object.is(params[key], undefined) && !Object.is(params[key], null)) { if (!Object.is(params[key], undefined) && !Object.is(params[key], null) && !Object.is(JSON.stringify(params[key]), '{}')) {
result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&' result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + '&'
} }
}) })

@ -126,12 +126,9 @@ export default {
Cookies.remove("password"); Cookies.remove("password");
Cookies.remove('rememberMe'); Cookies.remove('rememberMe');
} }
this.$store this.$store.dispatch("Login", this.loginForm).then(() => {
.dispatch("Login", this.loginForm) this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
.then(() => { }).catch(() => {
this.$router.push({ path: this.redirect || "/" });
})
.catch(() => {
this.loading = false; this.loading = false;
this.getCode(); this.getCode();
}); });

@ -421,14 +421,10 @@ export default {
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
deptId: [
{ required: true, message: "归属部门不能为空", trigger: "blur" }
],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" } { required: true, message: "用户密码不能为空", trigger: "blur" }
], ],
email: [ email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" },
{ {
type: "email", type: "email",
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
@ -436,7 +432,6 @@ export default {
} }
], ],
phonenumber: [ phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: "请输入正确的手机号码",

@ -18,7 +18,6 @@
<script> <script>
import { updateUserPwd } from "@/api/system/user"; import { updateUserPwd } from "@/api/system/user";
import Global from "@/layout/components/global.js";
export default { export default {
data() { data() {
@ -65,7 +64,6 @@ export default {
}); });
}, },
close() { close() {
Global.$emit("removeCache", "closeSelectedTag", this.$route);
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/index" }); this.$router.push({ path: "/index" });
} }

@ -24,7 +24,6 @@
<script> <script>
import { updateUserProfile } from "@/api/system/user"; import { updateUserProfile } from "@/api/system/user";
import Global from "@/layout/components/global.js";
export default { export default {
props: { props: {
@ -69,7 +68,6 @@ export default {
}); });
}, },
close() { close() {
Global.$emit("removeCache", "closeSelectedTag", this.$route);
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/index" }); this.$router.push({ path: "/index" });
} }

@ -127,7 +127,6 @@
import { getGenTable, updateGenTable } from "@/api/tool/gen"; import { getGenTable, updateGenTable } from "@/api/tool/gen";
import { optionselect as getDictOptionselect } from "@/api/system/dict/type"; import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
import { listMenu as getMenuTreeselect } from "@/api/system/menu"; import { listMenu as getMenuTreeselect } from "@/api/system/menu";
import Global from "@/layout/components/global.js";
import basicInfoForm from "./basicInfoForm"; import basicInfoForm from "./basicInfoForm";
import genInfoForm from "./genInfoForm"; import genInfoForm from "./genInfoForm";
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
@ -208,7 +207,6 @@ export default {
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close() { close() {
Global.$emit("removeCache", "closeSelectedTag", this.$route);
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/tool/gen", query: { t: Date.now()}}) this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
} }

@ -91,21 +91,21 @@
align="center" align="center"
prop="tableName" prop="tableName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
width="130" width="120"
/> />
<el-table-column <el-table-column
label="表描述" label="表描述"
align="center" align="center"
prop="tableComment" prop="tableComment"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
width="130" width="120"
/> />
<el-table-column <el-table-column
label="实体" label="实体"
align="center" align="center"
prop="className" prop="className"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
width="130" width="120"
/> />
<el-table-column label="创建时间" align="center" prop="createTime" width="160" /> <el-table-column label="创建时间" align="center" prop="createTime" width="160" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="160" /> <el-table-column label="更新时间" align="center" prop="updateTime" width="160" />
@ -159,13 +159,13 @@
<!-- 预览界面 --> <!-- 预览界面 -->
<el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body> <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
<el-tabs v-model="preview.activeName"> <el-tabs v-model="preview.activeName">
<el-tab-pane style="overflow-x: scroll;" <el-tab-pane
v-for="(value, key) in preview.data" v-for="(value, key) in preview.data"
:label="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))" :label="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))" :name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:key="key" :key="key"
> >
<pre>{{ value }}</pre> <highlightjs autodetect :code="value" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-dialog> </el-dialog>
@ -177,6 +177,7 @@
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"; import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
import importTable from "./importTable"; import importTable from "./importTable";
import { downLoadZip } from "@/utils/zipdownload"; import { downLoadZip } from "@/utils/zipdownload";
export default { export default {
name: "Gen", name: "Gen",
components: { importTable }, components: { importTable },

@ -107,7 +107,11 @@ module.exports = {
} }
} }
}) })
config.optimization.runtimeChunk('single') config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './', //到根目录下
}
} }
) )
} }

Loading…
Cancel
Save