mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(other): 新增菜单字典多语言适配 SQL
This commit is contained in:
@ -234,6 +234,12 @@ const local: App.I18n.Schema = {
|
||||
exception_404: '404',
|
||||
exception_500: '500'
|
||||
},
|
||||
menu: {
|
||||
system_tenant: 'Tenant Management',
|
||||
system_log: 'Log Management',
|
||||
'monitor_snail-job': 'Job Management',
|
||||
monitor_admin: 'Admin Monitor'
|
||||
},
|
||||
dict: {
|
||||
sys_user_sex: {
|
||||
male: 'Male',
|
||||
|
@ -221,7 +221,7 @@ const local: App.I18n.Schema = {
|
||||
system_notice: '通知公告',
|
||||
'social-callback': '单点登录回调',
|
||||
system_oss: '文件管理',
|
||||
'system_oss-config': 'OSS配置',
|
||||
'system_oss-config': 'OSS 配置',
|
||||
monitor_cache: '缓存监控',
|
||||
monitor_online: '在线用户',
|
||||
'user-center': '个人中心',
|
||||
@ -234,6 +234,12 @@ const local: App.I18n.Schema = {
|
||||
exception_404: '404',
|
||||
exception_500: '500'
|
||||
},
|
||||
menu: {
|
||||
system_tenant: '租户管理',
|
||||
system_log: '日志管理',
|
||||
'monitor_snail-job': '任务调度中心',
|
||||
monitor_admin: 'Admin 监控'
|
||||
},
|
||||
dict: {
|
||||
sys_user_sex: {
|
||||
male: '男',
|
||||
|
@ -94,7 +94,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
||||
// eslint-disable-next-line complexity
|
||||
function parseRouter(route: ElegantConstRoute, parent?: ElegantConstRoute) {
|
||||
route.meta = route.meta ? route.meta : { title: route.name };
|
||||
if (route.meta.title.startsWith('route.')) {
|
||||
if (route.meta.title.startsWith('route.') || route.meta.title.startsWith('menu.')) {
|
||||
route.meta.i18nKey = route.meta.title as App.I18n.I18nKey;
|
||||
}
|
||||
const isLayout = route.component === 'Layout';
|
||||
|
1
src/typings/app.d.ts
vendored
1
src/typings/app.d.ts
vendored
@ -467,6 +467,7 @@ declare namespace App {
|
||||
};
|
||||
};
|
||||
route: Record<I18nRouteKey, string>;
|
||||
menu: Record<string, string>;
|
||||
dict: Record<string, Record<string, string>>;
|
||||
page: {
|
||||
common: {
|
||||
|
@ -108,6 +108,14 @@ async function handleDeleteMenu(id?: CommonType.IdType) {
|
||||
getMeunTree();
|
||||
}
|
||||
|
||||
function renderLabel({ option }: { option: TreeOption }) {
|
||||
let label = String(option.menuName);
|
||||
if (label?.startsWith('route.') || label?.startsWith('menu.')) {
|
||||
label = $t(label as App.I18n.I18nKey);
|
||||
}
|
||||
return <div>{label}</div>;
|
||||
}
|
||||
|
||||
function renderPrefix({ option }: { option: TreeOption }) {
|
||||
const renderLocalIcon = String(option.icon).startsWith('local-icon-');
|
||||
const icon = renderLocalIcon ? undefined : String(option.icon);
|
||||
@ -347,6 +355,7 @@ const btnColumns: DataTableColumns<Api.System.Menu> = [
|
||||
label-field="menuName"
|
||||
virtual-scroll
|
||||
checkable
|
||||
:render-label="renderLabel"
|
||||
:render-prefix="renderPrefix"
|
||||
:render-suffix="renderSuffix"
|
||||
@update:selected-keys="(_: Array<string & number>, option: Array<TreeOption | null>) => handleClickTree(option)"
|
||||
@ -420,7 +429,11 @@ const btnColumns: DataTableColumns<Api.System.Menu> = [
|
||||
<DictTag size="small" :value="currentMenu.status" dict-code="sys_normal_disable" />
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem :label="$t('page.system.menu.menuName')">
|
||||
{{ currentMenu.menuName }}
|
||||
{{
|
||||
currentMenu.menuName?.startsWith('route.') || currentMenu.menuName?.startsWith('menu.')
|
||||
? $t(currentMenu.menuName)
|
||||
: currentMenu.menuName
|
||||
}}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem v-if="isMenu" :label="$t('page.system.menu.component')">
|
||||
{{ currentMenu.component }}
|
||||
|
Reference in New Issue
Block a user