mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	| @@ -46,6 +46,12 @@ public class MetaVO implements Serializable { | ||||
|     @Schema(description = "菜单图标", example = "user") | ||||
|     private String icon; | ||||
|  | ||||
|     /** | ||||
|      * 排序 | ||||
|      */ | ||||
|     @Schema(description = "排序", example = "1") | ||||
|     private Integer order; | ||||
|  | ||||
|     /** | ||||
|      * 是否隐藏 | ||||
|      */ | ||||
|   | ||||
| @@ -124,6 +124,7 @@ public class LoginServiceImpl implements LoginService { | ||||
|             metaVO.setIcon(m.getIcon()); | ||||
|             metaVO.setIgnoreCache(!m.getIsCache()); | ||||
|             metaVO.setHideInMenu(m.getIsHidden()); | ||||
|             metaVO.setOrder(m.getSort()); | ||||
|             tree.putExtra("meta", metaVO); | ||||
|         }); | ||||
|         return BeanUtil.copyToList(treeList, RouteVO.class); | ||||
|   | ||||
							
								
								
									
										1
									
								
								continew-admin-ui/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								continew-admin-ui/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | ||||
| .DS_Store | ||||
| node_modules/ | ||||
| dist/ | ||||
| demo/ | ||||
| npm-debug.log* | ||||
| yarn-debug.log* | ||||
| yarn-error.log* | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { computed } from 'vue'; | ||||
| import { RouteRecordRaw, RouteRecordNormalized } from 'vue-router'; | ||||
| import usePermission from '@/hooks/permission'; | ||||
| import { useAppStore } from '@/store'; | ||||
| import appClientMenus from '@/router/app-menus'; | ||||
| import staticMenus from '@/router/app-menus'; | ||||
| import { cloneDeep } from 'lodash'; | ||||
|  | ||||
| export default function useMenuTree() { | ||||
| @@ -10,9 +10,9 @@ export default function useMenuTree() { | ||||
|   const appStore = useAppStore(); | ||||
|   const appRoute = computed(() => { | ||||
|     if (appStore.menuFromServer) { | ||||
|       return appStore.appAsyncMenus; | ||||
|       return [...staticMenus, ...appStore.appAsyncMenus]; | ||||
|     } | ||||
|     return appClientMenus; | ||||
|     return staticMenus; | ||||
|   }); | ||||
|   const menuTree = computed(() => { | ||||
|     const copyRouter = cloneDeep(appRoute.value) as RouteRecordNormalized[]; | ||||
|   | ||||
| @@ -13,6 +13,6 @@ | ||||
|   "globalSettings": false, | ||||
|   "device": "desktop", | ||||
|   "tabBar": false, | ||||
|   "menuFromServer": false, | ||||
|   "menuFromServer": true, | ||||
|   "serverMenu": [] | ||||
| } | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| import { appRoutes, appExternalRoutes } from '../routes'; | ||||
| import { fixedRoutes, demoRoutes } from '../routes'; | ||||
|  | ||||
| const mixinRoutes = [...appRoutes, ...appExternalRoutes]; | ||||
| const mixinRoutes = [...fixedRoutes, ...demoRoutes]; | ||||
|  | ||||
| const appClientMenus = mixinRoutes.map((el) => { | ||||
| const staticMenus = mixinRoutes.map((el) => { | ||||
|   const { name, path, meta, redirect, children } = el; | ||||
|   return { | ||||
|     name, | ||||
| @@ -13,4 +13,4 @@ const appClientMenus = mixinRoutes.map((el) => { | ||||
|   }; | ||||
| }); | ||||
|  | ||||
| export default appClientMenus; | ||||
| export default staticMenus; | ||||
|   | ||||
| @@ -11,7 +11,7 @@ function setupPageGuard(router: Router) { | ||||
| } | ||||
|  | ||||
| export default function createRouteGuard(router: Router) { | ||||
|   setupPageGuard(router); | ||||
|   setupUserLoginInfoGuard(router); | ||||
|   setupPermissionGuard(router); | ||||
|   setupPageGuard(router); | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ import NProgress from 'nprogress'; // progress bar | ||||
|  | ||||
| import usePermission from '@/hooks/permission'; | ||||
| import { useLoginStore, useAppStore } from '@/store'; | ||||
| import { appRoutes } from '../routes'; | ||||
| import { fixedRoutes, demoRoutes } from '../routes'; | ||||
| import { WHITE_LIST, NOT_FOUND } from '../constants'; | ||||
|  | ||||
| export default function setupPermissionGuard(router: Router) { | ||||
| @@ -24,7 +24,12 @@ export default function setupPermissionGuard(router: Router) { | ||||
|       ) { | ||||
|         await appStore.fetchServerMenuConfig(); | ||||
|       } | ||||
|       const serverMenuConfig = [...appStore.appAsyncMenus, ...WHITE_LIST]; | ||||
|       const serverMenuConfig = [ | ||||
|         ...appStore.appAsyncMenus, | ||||
|         ...WHITE_LIST, | ||||
|         ...fixedRoutes, | ||||
|         ...demoRoutes, | ||||
|       ]; | ||||
|  | ||||
|       let exist = false; | ||||
|       while (serverMenuConfig.length && !exist) { | ||||
| @@ -45,8 +50,10 @@ export default function setupPermissionGuard(router: Router) { | ||||
|       if (permissionsAllow) next(); | ||||
|       else { | ||||
|         const destination = | ||||
|           Permission.findFirstPermissionRoute(appRoutes, loginStore.roles[0]) || | ||||
|           NOT_FOUND; | ||||
|           Permission.findFirstPermissionRoute( | ||||
|             [...fixedRoutes, ...demoRoutes], | ||||
|             loginStore.roles[0] | ||||
|           ) || NOT_FOUND; | ||||
|         next(destination); | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'; | ||||
| import NProgress from 'nprogress'; // progress bar | ||||
| import 'nprogress/nprogress.css'; | ||||
|  | ||||
| import { appRoutes } from './routes'; | ||||
| import { appRoutes, fixedRoutes, demoRoutes } from './routes'; | ||||
| import { REDIRECT_MAIN, NOT_FOUND_ROUTE } from './routes/base'; | ||||
| import createRouteGuard from './guard'; | ||||
|  | ||||
| @@ -24,6 +24,8 @@ const router = createRouter({ | ||||
|       }, | ||||
|     }, | ||||
|     ...appRoutes, | ||||
|     ...fixedRoutes, | ||||
|     ...demoRoutes, | ||||
|     REDIRECT_MAIN, | ||||
|     NOT_FOUND_ROUTE, | ||||
|   ], | ||||
|   | ||||
| @@ -1,10 +0,0 @@ | ||||
| export default { | ||||
|   path: 'https://arco.design/vue/docs/start', | ||||
|   name: 'ArcoWebsite', | ||||
|   meta: { | ||||
|     locale: 'menu.arcoWebsite', | ||||
|     icon: 'link', | ||||
|     requiresAuth: true, | ||||
|     order: 106, | ||||
|   }, | ||||
| }; | ||||
| @@ -1,10 +0,0 @@ | ||||
| export default { | ||||
|   path: 'https://github.com/Charles7c/continew-admin', | ||||
|   name: 'GitHub', | ||||
|   meta: { | ||||
|     locale: 'menu.github', | ||||
|     icon: 'github', | ||||
|     requiresAuth: true, | ||||
|     order: 107, | ||||
|   }, | ||||
| }; | ||||
| @@ -1,9 +1,8 @@ | ||||
| import type { RouteRecordNormalized } from 'vue-router'; | ||||
|  | ||||
| const modules = import.meta.glob('./modules/**/*.ts', { eager: true }); | ||||
| const externalModules = import.meta.glob('./externalModules/*.ts', { | ||||
|   eager: true, | ||||
| }); | ||||
| const appModules = import.meta.glob('./modules/*.ts', { eager: true }); | ||||
| const fixedModules = import.meta.glob('./modules/fixed/*.ts', { eager: true }); | ||||
| const demoModules = import.meta.glob('./modules/demo/*.ts', { eager: true }); | ||||
|  | ||||
| function formatModules(_modules: any, result: RouteRecordNormalized[]) { | ||||
|   Object.keys(_modules).forEach((key) => { | ||||
| @@ -17,9 +16,12 @@ function formatModules(_modules: any, result: RouteRecordNormalized[]) { | ||||
|   return result; | ||||
| } | ||||
|  | ||||
| export const appRoutes: RouteRecordNormalized[] = formatModules(modules, []); | ||||
|  | ||||
| export const appExternalRoutes: RouteRecordNormalized[] = formatModules( | ||||
|   externalModules, | ||||
| export const appRoutes: RouteRecordNormalized[] = formatModules(appModules, []); | ||||
| export const fixedRoutes: RouteRecordNormalized[] = formatModules( | ||||
|   fixedModules, | ||||
|   [] | ||||
| ); | ||||
| export const demoRoutes: RouteRecordNormalized[] = formatModules( | ||||
|   demoModules, | ||||
|   [] | ||||
| ); | ||||
|   | ||||
| @@ -3,18 +3,17 @@ import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const EXCEPTION: AppRouteRecordRaw = { | ||||
|   path: '/exception', | ||||
|   name: 'exception', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.exception', | ||||
|     requiresAuth: true, | ||||
|     icon: 'exclamation-circle', | ||||
|     order: 104, | ||||
|     order: 904, | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: '403', | ||||
|       name: '403', | ||||
|       path: '403', | ||||
|       component: () => import('@/views/arco-design/exception/403/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.exception.403', | ||||
| @@ -23,8 +22,8 @@ const EXCEPTION: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '404', | ||||
|       name: '404', | ||||
|       path: '404', | ||||
|       component: () => import('@/views/arco-design/exception/404/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.exception.404', | ||||
| @@ -33,8 +32,8 @@ const EXCEPTION: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '500', | ||||
|       name: '500', | ||||
|       path: '500', | ||||
|       component: () => import('@/views/arco-design/exception/500/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.exception.500', | ||||
| @@ -3,18 +3,17 @@ import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const FORM: AppRouteRecordRaw = { | ||||
|   path: '/form', | ||||
|   name: 'form', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.form', | ||||
|     icon: 'bookmark', | ||||
|     requiresAuth: true, | ||||
|     order: 101, | ||||
|     order: 901, | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'step', | ||||
|       name: 'Step', | ||||
|       path: 'step', | ||||
|       component: () => import('@/views/arco-design/form/step/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.form.step', | ||||
| @@ -23,8 +22,8 @@ const FORM: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: 'group', | ||||
|       name: 'Group', | ||||
|       path: 'group', | ||||
|       component: () => import('@/views/arco-design/form/group/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.form.group', | ||||
| @@ -3,18 +3,17 @@ import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const LIST: AppRouteRecordRaw = { | ||||
|   path: '/list', | ||||
|   name: 'list', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.list', | ||||
|     requiresAuth: true, | ||||
|     icon: 'list', | ||||
|     order: 100, | ||||
|     order: 900, | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'search-table', // The midline path complies with SEO specifications
 | ||||
|       name: 'SearchTable', | ||||
|       path: 'search-table', // The midline path complies with SEO specifications
 | ||||
|       component: () => | ||||
|         import('@/views/arco-design/list/search-table/index.vue'), | ||||
|       meta: { | ||||
| @@ -24,8 +23,8 @@ const LIST: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: 'card', | ||||
|       name: 'Card', | ||||
|       path: 'card', | ||||
|       component: () => import('@/views/arco-design/list/card/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.list.cardList', | ||||
| @@ -3,18 +3,17 @@ import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const PROFILE: AppRouteRecordRaw = { | ||||
|   path: '/profile', | ||||
|   name: 'profile', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.profile', | ||||
|     requiresAuth: true, | ||||
|     icon: 'file', | ||||
|     order: 102, | ||||
|     order: 902, | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'basic', | ||||
|       name: 'Basic', | ||||
|       path: 'basic', | ||||
|       component: () => import('@/views/arco-design/profile/basic/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.profile.basic', | ||||
| @@ -3,18 +3,17 @@ import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const RESULT: AppRouteRecordRaw = { | ||||
|   path: '/result', | ||||
|   name: 'result', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.result', | ||||
|     icon: 'check-circle', | ||||
|     requiresAuth: true, | ||||
|     order: 103, | ||||
|     order: 903, | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'success', | ||||
|       name: 'Success', | ||||
|       path: 'success', | ||||
|       component: () => import('@/views/arco-design/result/success/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.result.success', | ||||
| @@ -23,8 +22,8 @@ const RESULT: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: 'error', | ||||
|       name: 'Error', | ||||
|       path: 'error', | ||||
|       component: () => import('@/views/arco-design/result/error/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.result.error', | ||||
| @@ -3,18 +3,17 @@ import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const VISUALIZATION: AppRouteRecordRaw = { | ||||
|   path: '/visualization', | ||||
|   name: 'visualization', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.visualization', | ||||
|     requiresAuth: true, | ||||
|     icon: 'bar-chart', | ||||
|     order: 105, | ||||
|     order: 905, | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'data-analysis', | ||||
|       name: 'DataAnalysis', | ||||
|       path: 'data-analysis', | ||||
|       component: () => | ||||
|         import('@/views/arco-design/visualization/data-analysis/index.vue'), | ||||
|       meta: { | ||||
| @@ -24,8 +23,8 @@ const VISUALIZATION: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: 'multi-dimension-data-analysis', | ||||
|       name: 'MultiDimensionDataAnalysis', | ||||
|       path: 'multi-dimension-data-analysis', | ||||
|       component: () => | ||||
|         import( | ||||
|           '@/views/arco-design/visualization/multi-dimension-data-analysis/index.vue' | ||||
| @@ -37,8 +36,8 @@ const VISUALIZATION: AppRouteRecordRaw = { | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: 'monitor', | ||||
|       name: 'Monitor', | ||||
|       path: 'monitor', | ||||
|       component: () => | ||||
|         import('@/views/arco-design/visualization/monitor/index.vue'), | ||||
|       meta: { | ||||
| @@ -1,9 +1,9 @@ | ||||
| import { DEFAULT_LAYOUT } from '../base'; | ||||
| import { AppRouteRecordRaw } from '../types'; | ||||
| import { DEFAULT_LAYOUT } from '../../base'; | ||||
| import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const DASHBOARD: AppRouteRecordRaw = { | ||||
|   path: '/dashboard', | ||||
|   name: 'dashboard', | ||||
|   name: 'Dashboard', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   redirect: '/dashboard/workplace', | ||||
|   meta: { | ||||
| @@ -15,14 +15,14 @@ const DASHBOARD: AppRouteRecordRaw = { | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'workplace', | ||||
|       name: 'Workplace', | ||||
|       path: 'workplace', | ||||
|       component: () => import('@/views/dashboard/workplace/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.dashboard.workplace', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|         activeMenu: 'dashboard', | ||||
|         activeMenu: 'Dashboard', | ||||
|       }, | ||||
|     }, | ||||
|   ], | ||||
| @@ -1,9 +1,8 @@ | ||||
| import { DEFAULT_LAYOUT } from '../base'; | ||||
| import { AppRouteRecordRaw } from '../types'; | ||||
| import { DEFAULT_LAYOUT } from '../../base'; | ||||
| import { AppRouteRecordRaw } from '../../types'; | ||||
| 
 | ||||
| const UserCenter: AppRouteRecordRaw = { | ||||
|   path: '/login/user', | ||||
|   name: 'user', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.user', | ||||
| @@ -12,8 +11,8 @@ const UserCenter: AppRouteRecordRaw = { | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: 'center', | ||||
|       name: 'UserCenter', | ||||
|       path: 'center', | ||||
|       component: () => import('@/views/system/user/center/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.user.center', | ||||
| @@ -3,7 +3,6 @@ import { AppRouteRecordRaw } from '../types'; | ||||
|  | ||||
| const Monitor: AppRouteRecordRaw = { | ||||
|   path: '/monitor', | ||||
|   name: 'monitor', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.monitor', | ||||
| @@ -13,23 +12,21 @@ const Monitor: AppRouteRecordRaw = { | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: '/monitor/online', | ||||
|       name: 'OnlineUser', | ||||
|       path: '/monitor/online', | ||||
|       component: () => import('@/views/monitor/online/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.online.user.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '/monitor/log/login', | ||||
|       name: 'LoginLog', | ||||
|       path: '/monitor/log/login', | ||||
|       component: () => import('@/views/monitor/log/login/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.log.login.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
| @@ -39,17 +36,15 @@ const Monitor: AppRouteRecordRaw = { | ||||
|       meta: { | ||||
|         locale: 'menu.log.operation.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '/monitor/log/system', | ||||
|       name: 'SystemLog', | ||||
|       path: '/monitor/log/system', | ||||
|       component: () => import('@/views/monitor/log/system/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.log.system.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|   ], | ||||
|   | ||||
| @@ -3,7 +3,6 @@ import { AppRouteRecordRaw } from '../types'; | ||||
|  | ||||
| const System: AppRouteRecordRaw = { | ||||
|   path: '/system', | ||||
|   name: 'system', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.system', | ||||
| @@ -13,53 +12,48 @@ const System: AppRouteRecordRaw = { | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: '/system/user', | ||||
|       name: 'User', | ||||
|       path: '/system/user', | ||||
|       component: () => import('@/views/system/user/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.system.user.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '/system/role', | ||||
|       name: 'Role', | ||||
|       path: '/system/role', | ||||
|       component: () => import('@/views/system/role/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.system.role.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '/system/menu', | ||||
|       name: 'Menu', | ||||
|       path: '/system/menu', | ||||
|       component: () => import('@/views/system/menu/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.system.menu.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '/system/dept', | ||||
|       name: 'Dept', | ||||
|       path: '/system/dept', | ||||
|       component: () => import('@/views/system/dept/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.system.dept.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|       path: '/system/announcement', | ||||
|       name: 'Announcement', | ||||
|       path: '/system/announcement', | ||||
|       component: () => import('@/views/system/announcement/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.system.announcement.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|   ], | ||||
|   | ||||
| @@ -3,7 +3,6 @@ import { AppRouteRecordRaw } from '../types'; | ||||
|  | ||||
| const Tool: AppRouteRecordRaw = { | ||||
|   path: '/tool', | ||||
|   name: 'tool', | ||||
|   component: DEFAULT_LAYOUT, | ||||
|   meta: { | ||||
|     locale: 'menu.tool', | ||||
| @@ -13,13 +12,12 @@ const Tool: AppRouteRecordRaw = { | ||||
|   }, | ||||
|   children: [ | ||||
|     { | ||||
|       path: '/tool/generator', | ||||
|       name: 'Generator', | ||||
|       path: '/tool/generator', | ||||
|       component: () => import('@/views/tool/generator/index.vue'), | ||||
|       meta: { | ||||
|         locale: 'menu.tool.generator.list', | ||||
|         requiresAuth: true, | ||||
|         roles: ['*'], | ||||
|       }, | ||||
|     }, | ||||
|   ], | ||||
|   | ||||
| @@ -49,21 +49,21 @@ const useAppStore = defineStore('app', { | ||||
|       try { | ||||
|         notifyInstance = Notification.info({ | ||||
|           id: 'menuNotice', // Keep the instance id the same | ||||
|           content: 'loading', | ||||
|           content: '菜单加载中...', | ||||
|           closable: true, | ||||
|         }); | ||||
|         const { data } = await listRoute(); | ||||
|         this.serverMenu = data; | ||||
|         notifyInstance = Notification.success({ | ||||
|           id: 'menuNotice', | ||||
|           content: 'success', | ||||
|           content: '菜单加载成功', | ||||
|           closable: true, | ||||
|         }); | ||||
|       } catch (error) { | ||||
|         // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||||
|         notifyInstance = Notification.error({ | ||||
|           id: 'menuNotice', | ||||
|           content: 'error', | ||||
|           content: '菜单加载失败', | ||||
|           closable: true, | ||||
|         }); | ||||
|       } | ||||
|   | ||||
| @@ -30,6 +30,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | ||||
| import cn.hutool.extra.spring.SpringUtil; | ||||
|  | ||||
| import top.charles7c.cnadmin.common.model.query.PageQuery; | ||||
| @@ -59,6 +60,7 @@ public class GeneratorController { | ||||
|     private final GeneratorService generatorService; | ||||
|  | ||||
|     @Operation(summary = "分页查询数据表", description = "分页查询数据表") | ||||
|     @SaCheckPermission("tool:generator:list") | ||||
|     @GetMapping("/table") | ||||
|     public R<PageDataVO<TableVO>> pageTable(TableQuery query, @Validated PageQuery pageQuery) throws SQLException { | ||||
|         return R.ok(generatorService.pageTable(query, pageQuery)); | ||||
| @@ -69,6 +71,7 @@ public class GeneratorController { | ||||
|         @Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", | ||||
|             in = ParameterIn.PATH), | ||||
|         @Parameter(name = "requireSync", description = "是否需要同步", example = "true", in = ParameterIn.QUERY)}) | ||||
|     @SaCheckPermission("tool:generator:list") | ||||
|     @GetMapping("/field/{tableName}") | ||||
|     public R<List<FieldConfigDO>> listFieldConfig(@PathVariable String tableName, | ||||
|         @RequestParam(required = false, defaultValue = "false") Boolean requireSync) { | ||||
| @@ -77,6 +80,7 @@ public class GeneratorController { | ||||
|  | ||||
|     @Operation(summary = "查询生成配置信息", description = "查询生成配置信息") | ||||
|     @Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH) | ||||
|     @SaCheckPermission("tool:generator:list") | ||||
|     @GetMapping("/config/{tableName}") | ||||
|     public R<GenConfigDO> getGenConfig(@PathVariable String tableName) throws SQLException { | ||||
|         return R.ok(generatorService.getGenConfig(tableName)); | ||||
| @@ -84,6 +88,7 @@ public class GeneratorController { | ||||
|  | ||||
|     @Operation(summary = "保存配置信息", description = "保存配置信息") | ||||
|     @Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH) | ||||
|     @SaCheckPermission("tool:generator:list") | ||||
|     @PostMapping("/config/{tableName}") | ||||
|     public R saveConfig(@Validated @RequestBody GenConfigRequest request, @PathVariable String tableName) { | ||||
|         generatorService.saveConfig(request, tableName); | ||||
| @@ -92,6 +97,7 @@ public class GeneratorController { | ||||
|  | ||||
|     @Operation(summary = "生成代码", description = "生成代码") | ||||
|     @Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH) | ||||
|     @SaCheckPermission("tool:generator:list") | ||||
|     @PostMapping("/{tableName}") | ||||
|     public R generate(@PathVariable String tableName) { | ||||
|         ValidationUtils.throwIf("prod".equals(SpringUtil.getActiveProfile()), "仅支持在开发环境生成代码"); | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
| -- changeset Charles7c:1 | ||||
| -- 初始化默认菜单 | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1000, '系统管理', 0, 1, 'system', NULL, NULL, 'settings', b'0', b'0', b'0', NULL, 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1000, '系统管理', 0, 1, '/system', NULL, NULL, 'settings', b'0', b'0', b'0', NULL, 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1010, '用户管理', 1000, 2, '/system/user', 'User', '/system/user/index', NULL, b'0', b'0', b'0', 'system:user:list', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1011, '用户新增', 1010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:user:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1012, '用户修改', 1010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:user:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| @@ -10,29 +10,29 @@ INSERT IGNORE INTO `sys_menu` VALUES (1013, '用户删除', 1010, 3, NULL, NULL, | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1014, '用户导出', 1010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:user:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1015, '重置密码', 1010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:user:password:reset', 5, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1016, '分配角色', 1010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:user:role:update', 6, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1020, '角色管理', 1000, 2, '/system/role', 'Role', 'system/role/index', NULL, b'0', b'0', b'0', 'system:role:list', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1020, '角色管理', 1000, 2, '/system/role', 'Role', '/system/role/index', NULL, b'0', b'0', b'0', 'system:role:list', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1021, '角色新增', 1020, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:role:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1022, '角色修改', 1020, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:role:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1023, '角色删除', 1020, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:role:delete', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1024, '角色导出', 1020, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:role:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1030, '菜单管理', 1000, 2, '/system/menu', 'Menu', 'system/menu/index', NULL, b'0', b'0', b'0', 'system:menu:list', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1031, '菜单新增', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1032, '菜单修改', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1033, '菜单删除', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:delete', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1034, '菜单导出', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1040, '部门管理', 1000, 2, '/system/dept', 'Dept', 'system/dept/index', NULL, b'0', b'0', b'0', 'system:dept:list', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1041, '部门新增', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1042, '部门修改', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1043, '部门删除', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:delete', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1044, '部门导出', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2000, '系统监控', 0, 1, 'monitor', NULL, NULL, 'computer', b'0', b'0', b'0', NULL, 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2010, '在线用户', 2000, 2, '/monitor/online', 'OnlineUser', 'monitor/online/index', NULL, b'0', b'0', b'0', 'monitor:online:user:list', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2011, '强退用户', 2010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'monitor:online:user:delete', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2030, '登录日志', 2000, 2, '/monitor/log/login', 'LoginLog', 'monitor/log/login/index', NULL, b'0', b'0', b'0', 'monitor:log:login:list', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2050, '操作日志', 2000, 2, '/monitor/log/operation', 'OperationLog', 'monitor/log/operation/index', NULL, b'0', b'0', b'0', 'monitor:log:operation:list', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2070, '系统日志', 2000, 2, '/monitor/log/system', 'SystemLog', 'monitor/log/system/index', NULL, b'0', b'0', b'0', 'monitor:log:system:list', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (10000, 'Arco Design Vue', 0, 1, 'https://arco.design/vue/docs/start', NULL, NULL, 'link', b'1', b'0', b'0', NULL, 100, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (10001, 'GitHub', 0, 1, 'https://github.com/Charles7c/continew-admin', NULL, NULL, 'github', b'1', b'0', b'0', NULL, 101, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1030, '部门管理', 1000, 2, '/system/dept', 'Dept', '/system/dept/index', NULL, b'0', b'0', b'0', 'system:dept:list', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1031, '部门新增', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1032, '部门修改', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1033, '部门删除', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:delete', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1034, '部门导出', 1030, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dept:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1900, '菜单管理', 1000, 2, '/system/menu', 'Menu', '/system/menu/index', NULL, b'0', b'0', b'0', 'system:menu:list', 999, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1901, '菜单新增', 1900, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1902, '菜单修改', 1900, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1903, '菜单删除', 1900, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:delete', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1904, '菜单导出', 1900, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:menu:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (9000, '系统监控', 0, 1, '/monitor', NULL, NULL, 'computer', b'0', b'0', b'0', NULL, 899, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (9010, '在线用户', 9000, 2, '/monitor/online', 'OnlineUser', '/monitor/online/index', NULL, b'0', b'0', b'0', 'monitor:online:user:list', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (9011, '强退用户', 9010, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'monitor:online:user:delete', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (9030, '登录日志', 9000, 2, '/monitor/log/login', 'LoginLog', '/monitor/log/login/index', NULL, b'0', b'0', b'0', 'monitor:log:login:list', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (9050, '操作日志', 9000, 2, '/monitor/log/operation', 'OperationLog', '/monitor/log/operation/index', NULL, b'0', b'0', b'0', 'monitor:log:operation:list', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (9070, '系统日志', 9000, 2, '/monitor/log/system', 'SystemLog', '/monitor/log/system/index', NULL, b'0', b'0', b'0', 'monitor:log:system:list', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (10000, 'Arco Design Vue', 0, 1, 'https://arco.design/vue/docs/start', NULL, NULL, 'link', b'1', b'0', b'0', NULL, 998, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (10001, 'GitHub', 0, 1, 'https://github.com/Charles7c/continew-admin', NULL, NULL, 'github', b'1', b'0', b'0', NULL, 999, 1, 1, NOW(), NULL, NULL); | ||||
|  | ||||
| -- 初始化默认部门 | ||||
| INSERT IGNORE INTO `sys_dept` VALUES (1, 'Xxx科技有限公司', 0, '0', '系统初始部门', 1, 1, 1, 1, NOW(), NULL, NULL); | ||||
|   | ||||
| @@ -1,2 +1,10 @@ | ||||
| -- liquibase formatted sql | ||||
|  | ||||
| -- changeset Charles7c:1 | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1040, '公告管理', 1000, 2, '/system/announcement', 'Announcement', 'system/announcement/index', NULL, b'0', b'0', b'0', 'system:announcement:list', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1041, '公告新增', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:announcement:add', 1, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1042, '公告修改', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:announcement:update', 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1043, '公告删除', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:announcement:delete', 3, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (1044, '公告导出', 1040, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:announcement:export', 4, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2000, '系统工具', 0, 1, '/tool', NULL, NULL, 'tool', b'0', b'0', b'0', NULL, 2, 1, 1, NOW(), NULL, NULL); | ||||
| INSERT IGNORE INTO `sys_menu` VALUES (2010, '代码生成', 2000, 2, '/tool/generator', 'Generator', '/tool/generator/index', NULL, b'0', b'0', b'0', 'tool:generator:list', 1, 1, 1, NOW(), NULL, NULL); | ||||
		Reference in New Issue
	
	Block a user