Merge branch 'fork/maoxuner/fix/system-menu-form'
This commit is contained in:
@@ -194,18 +194,46 @@ export const MOCK_MENUS = [
|
||||
export const MOCK_MENU_LIST = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Workspace',
|
||||
name: 'Dashboard',
|
||||
status: 1,
|
||||
type: 'menu',
|
||||
icon: 'mdi:dashboard',
|
||||
path: '/workspace',
|
||||
component: '/dashboard/workspace/index',
|
||||
type: 'catalog',
|
||||
icon: 'lucide:layout-dashboard',
|
||||
path: '/dashboard',
|
||||
meta: {
|
||||
icon: 'carbon:workspace',
|
||||
title: 'page.dashboard.workspace',
|
||||
affixTab: true,
|
||||
order: 0,
|
||||
icon: 'lucide:layout-dashboard',
|
||||
order: -1,
|
||||
title: 'page.dashboard.title',
|
||||
},
|
||||
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,
|
||||
|
||||
@@ -122,12 +122,12 @@ const dashboardMenus = [
|
||||
title: 'page.dashboard.title',
|
||||
},
|
||||
name: 'Dashboard',
|
||||
path: '/',
|
||||
redirect: '/analytics',
|
||||
path: '/dashboard',
|
||||
redirect: '/dashboard/analytics',
|
||||
children: [
|
||||
{
|
||||
name: 'Analytics',
|
||||
path: '/analytics',
|
||||
path: 'analytics',
|
||||
// Here is the path of the page, need to remove 'views/' and '.vue'
|
||||
component: '/dashboard/analytics/index',
|
||||
meta: {
|
||||
@@ -137,7 +137,7 @@ const dashboardMenus = [
|
||||
},
|
||||
{
|
||||
name: 'Workspace',
|
||||
path: '/workspace',
|
||||
path: 'workspace',
|
||||
component: '/dashboard/workspace/index',
|
||||
meta: {
|
||||
title: 'page.dashboard.workspace',
|
||||
|
||||
@@ -120,12 +120,12 @@ const dashboardMenus = [
|
||||
title: 'page.dashboard.title',
|
||||
},
|
||||
name: 'Dashboard',
|
||||
path: '/',
|
||||
redirect: '/analytics',
|
||||
path: '/dashboard',
|
||||
redirect: '/dashboard/analytics',
|
||||
children: [
|
||||
{
|
||||
name: 'Analytics',
|
||||
path: '/analytics',
|
||||
path: 'analytics',
|
||||
// 这里为页面的路径,需要去掉 views/ 和 .vue
|
||||
component: '/dashboard/analytics/index',
|
||||
meta: {
|
||||
@@ -135,7 +135,7 @@ const dashboardMenus = [
|
||||
},
|
||||
{
|
||||
name: 'Workspace',
|
||||
path: '/workspace',
|
||||
path: 'workspace',
|
||||
component: '/dashboard/workspace/index',
|
||||
meta: {
|
||||
title: 'page.dashboard.workspace',
|
||||
|
||||
@@ -88,7 +88,13 @@ const schema: VbenFormSchema[] = [
|
||||
label: $t('system.menu.parent'),
|
||||
renderComponentContent() {
|
||||
return {
|
||||
title({ label, meta }: { label: string; meta: Recordable<any> }) {
|
||||
treeTitleRender({
|
||||
label,
|
||||
meta,
|
||||
}: {
|
||||
label: string;
|
||||
meta: Recordable<any>;
|
||||
}) {
|
||||
const coms = [];
|
||||
if (!label) return '';
|
||||
if (meta?.icon) {
|
||||
@@ -129,12 +135,6 @@ const schema: VbenFormSchema[] = [
|
||||
.string()
|
||||
.min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2]))
|
||||
.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) => {
|
||||
return !(await isMenuPathExists(value, formData.value?.id));
|
||||
@@ -162,12 +162,6 @@ const schema: VbenFormSchema[] = [
|
||||
.string()
|
||||
.min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2]))
|
||||
.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) => {
|
||||
return await isMenuPathExists(value, formData.value?.id);
|
||||
}, $t('system.menu.activePathMustExist'))
|
||||
|
||||
Reference in New Issue
Block a user