Merge branch 'fork/maoxuner/fix/system-menu-form'

This commit is contained in:
金毛88
2026-07-21 23:05:33 +08:00
4 changed files with 52 additions and 30 deletions

View File

@@ -194,18 +194,46 @@ export const MOCK_MENUS = [
export const MOCK_MENU_LIST = [ export const MOCK_MENU_LIST = [
{ {
id: 1, id: 1,
name: 'Workspace', name: 'Dashboard',
status: 1, status: 1,
type: 'menu', type: 'catalog',
icon: 'mdi:dashboard', icon: 'lucide:layout-dashboard',
path: '/workspace', path: '/dashboard',
component: '/dashboard/workspace/index',
meta: { meta: {
icon: 'carbon:workspace', icon: 'lucide:layout-dashboard',
title: 'page.dashboard.workspace', order: -1,
affixTab: true, title: 'page.dashboard.title',
order: 0,
}, },
children: [
{
id: 101,
pid: 1,
status: 1,
type: 'menu',
name: 'Analytics',
path: 'analytics',
component: '/dashboard/analytics/index',
meta: {
affixTab: true,
icon: 'lucide:area-chart',
title: 'page.dashboard.analytics',
keepAlive: true,
},
},
{
id: 102,
pid: 1,
status: 1,
type: 'menu',
name: 'Workspace',
path: 'workspace',
component: '/views/dashboard/workspace/index',
meta: {
icon: 'carbon:workspace',
title: 'page.dashboard.workspace',
},
},
],
}, },
{ {
id: 2, id: 2,

View File

@@ -122,12 +122,12 @@ const dashboardMenus = [
title: 'page.dashboard.title', title: 'page.dashboard.title',
}, },
name: 'Dashboard', name: 'Dashboard',
path: '/', path: '/dashboard',
redirect: '/analytics', redirect: '/dashboard/analytics',
children: [ children: [
{ {
name: 'Analytics', name: 'Analytics',
path: '/analytics', path: 'analytics',
// Here is the path of the page, need to remove 'views/' and '.vue' // Here is the path of the page, need to remove 'views/' and '.vue'
component: '/dashboard/analytics/index', component: '/dashboard/analytics/index',
meta: { meta: {
@@ -137,7 +137,7 @@ const dashboardMenus = [
}, },
{ {
name: 'Workspace', name: 'Workspace',
path: '/workspace', path: 'workspace',
component: '/dashboard/workspace/index', component: '/dashboard/workspace/index',
meta: { meta: {
title: 'page.dashboard.workspace', title: 'page.dashboard.workspace',

View File

@@ -120,12 +120,12 @@ const dashboardMenus = [
title: 'page.dashboard.title', title: 'page.dashboard.title',
}, },
name: 'Dashboard', name: 'Dashboard',
path: '/', path: '/dashboard',
redirect: '/analytics', redirect: '/dashboard/analytics',
children: [ children: [
{ {
name: 'Analytics', name: 'Analytics',
path: '/analytics', path: 'analytics',
// 这里为页面的路径,需要去掉 views/ 和 .vue // 这里为页面的路径,需要去掉 views/ 和 .vue
component: '/dashboard/analytics/index', component: '/dashboard/analytics/index',
meta: { meta: {
@@ -135,7 +135,7 @@ const dashboardMenus = [
}, },
{ {
name: 'Workspace', name: 'Workspace',
path: '/workspace', path: 'workspace',
component: '/dashboard/workspace/index', component: '/dashboard/workspace/index',
meta: { meta: {
title: 'page.dashboard.workspace', title: 'page.dashboard.workspace',

View File

@@ -88,7 +88,13 @@ const schema: VbenFormSchema[] = [
label: $t('system.menu.parent'), label: $t('system.menu.parent'),
renderComponentContent() { renderComponentContent() {
return { return {
title({ label, meta }: { label: string; meta: Recordable<any> }) { treeTitleRender({
label,
meta,
}: {
label: string;
meta: Recordable<any>;
}) {
const coms = []; const coms = [];
if (!label) return ''; if (!label) return '';
if (meta?.icon) { if (meta?.icon) {
@@ -129,12 +135,6 @@ const schema: VbenFormSchema[] = [
.string() .string()
.min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2])) .min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2]))
.max(100, $t('ui.formRules.maxLength', [$t('system.menu.path'), 100])) .max(100, $t('ui.formRules.maxLength', [$t('system.menu.path'), 100]))
.refine(
(value: string) => {
return value.startsWith('/');
},
$t('ui.formRules.startWith', [$t('system.menu.path'), '/']),
)
.refine( .refine(
async (value: string) => { async (value: string) => {
return !(await isMenuPathExists(value, formData.value?.id)); return !(await isMenuPathExists(value, formData.value?.id));
@@ -162,12 +162,6 @@ const schema: VbenFormSchema[] = [
.string() .string()
.min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2])) .min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2]))
.max(100, $t('ui.formRules.maxLength', [$t('system.menu.path'), 100])) .max(100, $t('ui.formRules.maxLength', [$t('system.menu.path'), 100]))
.refine(
(value: string) => {
return value.startsWith('/');
},
$t('ui.formRules.startWith', [$t('system.menu.path'), '/']),
)
.refine(async (value: string) => { .refine(async (value: string) => {
return await isMenuPathExists(value, formData.value?.id); return await isMenuPathExists(value, formData.value?.id);
}, $t('system.menu.activePathMustExist')) }, $t('system.menu.activePathMustExist'))