- 新增产品管理相关路由和页面(dashboard、list、requirement、setting) - 实现产品基础信息编辑弹窗组件(base-info-dialog.vue) - 添加运行时字典功能(dict-select、dict-text、dict-tag组件) - 集成字典管理store和API调用 - 规范ID类型定义为string避免精度丢失问题 - 完善国际化资源文件支持中英文对照 - 新增对象上下文业务域入口页导航实现说明 - 添加Vue DevTools浮动入口注释说明 - 统一权限控制支持全局和对象作用域区分 - 规范分页查询参数类型定义与使用方式
101 lines
2.6 KiB
TypeScript
101 lines
2.6 KiB
TypeScript
import type { RouteMeta } from 'vue-router';
|
|
import ElegantVueRouter from '@elegant-router/vue/vite';
|
|
import type { RouteKey } from '@elegant-router/types';
|
|
|
|
export function setupElegantRouter() {
|
|
return ElegantVueRouter({
|
|
layouts: {
|
|
base: 'src/layouts/base-layout/index.vue',
|
|
blank: 'src/layouts/blank-layout/index.vue'
|
|
},
|
|
customRoutes: {
|
|
names: ['exception_403', 'exception_404', 'exception_500']
|
|
},
|
|
routePathTransformer(routeName, routePath) {
|
|
const key = routeName as RouteKey;
|
|
|
|
if (key === 'login') {
|
|
const modules: UnionKey.LoginModule[] = ['pwd-login', 'reset-pwd'];
|
|
|
|
const moduleReg = modules.join('|');
|
|
|
|
return `/login/:module(${moduleReg})?`;
|
|
}
|
|
|
|
return routePath;
|
|
},
|
|
onRouteMetaGen(routeName) {
|
|
const key = routeName as RouteKey;
|
|
|
|
const constantRoutes: RouteKey[] = ['login', '403', '404', '500'];
|
|
const routeMetaMap: Partial<Record<RouteKey, Partial<RouteMeta>>> = {
|
|
product: {
|
|
icon: 'carbon:product',
|
|
order: 4
|
|
},
|
|
product_list: {
|
|
icon: 'material-symbols:view-list-outline-rounded',
|
|
order: 1,
|
|
keepAlive: true
|
|
},
|
|
product_dashboard: {
|
|
hideInMenu: true,
|
|
activeMenu: 'product_list'
|
|
},
|
|
product_requirement: {
|
|
hideInMenu: true,
|
|
activeMenu: 'product_list'
|
|
},
|
|
product_setting: {
|
|
hideInMenu: true,
|
|
activeMenu: 'product_list'
|
|
},
|
|
system: {
|
|
icon: 'carbon:cloud-service-management',
|
|
order: 9,
|
|
roles: ['R_ADMIN']
|
|
},
|
|
system_menu: {
|
|
icon: 'material-symbols:route',
|
|
order: 3,
|
|
roles: ['R_ADMIN'],
|
|
keepAlive: true
|
|
},
|
|
system_dict: {
|
|
icon: 'mdi:book-open-page-variant-outline',
|
|
order: 4,
|
|
roles: ['R_ADMIN'],
|
|
keepAlive: true
|
|
},
|
|
system_role: {
|
|
icon: 'carbon:user-role',
|
|
order: 2,
|
|
roles: ['R_SUPER']
|
|
},
|
|
system_user: {
|
|
icon: 'ic:round-manage-accounts',
|
|
order: 1,
|
|
roles: ['R_ADMIN']
|
|
},
|
|
'system_user-detail': {
|
|
hideInMenu: true,
|
|
roles: ['R_ADMIN'],
|
|
activeMenu: 'system_user'
|
|
}
|
|
};
|
|
|
|
const meta: Partial<RouteMeta> = {
|
|
title: key,
|
|
i18nKey: `route.${key}` as App.I18n.I18nKey,
|
|
...routeMetaMap[key]
|
|
};
|
|
|
|
if (constantRoutes.includes(key)) {
|
|
meta.constant = true;
|
|
}
|
|
|
|
return meta;
|
|
}
|
|
});
|
|
}
|