mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 20:29:19 +08:00
feat: 菜单增加前端路由名字段
This commit is contained in:
@@ -66,6 +66,7 @@ interface FormData {
|
||||
parentId: number | null;
|
||||
superMenu: boolean;
|
||||
name: string;
|
||||
routeName: string;
|
||||
title: string;
|
||||
path: string;
|
||||
component: string;
|
||||
@@ -84,6 +85,7 @@ const formData = ref<FormData>({
|
||||
parentId: null,
|
||||
superMenu: false,
|
||||
name: '',
|
||||
routeName: '',
|
||||
title: '',
|
||||
path: '',
|
||||
component: '',
|
||||
@@ -346,6 +348,7 @@ function open(edit: boolean, record?: MenuVO.MenuInfo) {
|
||||
parentId: record.parentId || null,
|
||||
superMenu: record.superMenu === 1, // 转换为boolean
|
||||
name: record.name,
|
||||
routeName: record.routeName || '',
|
||||
title: record.title || '',
|
||||
path: record.path || '',
|
||||
component: record.component || '',
|
||||
@@ -375,6 +378,7 @@ function open(edit: boolean, record?: MenuVO.MenuInfo) {
|
||||
parentId: record.id, // 自动设置为当前菜单的ID作为父菜单
|
||||
superMenu: false,
|
||||
name: '',
|
||||
routeName: '',
|
||||
title: '',
|
||||
path: '',
|
||||
component: '',
|
||||
@@ -393,6 +397,7 @@ function open(edit: boolean, record?: MenuVO.MenuInfo) {
|
||||
parentId: null,
|
||||
superMenu: false,
|
||||
name: '',
|
||||
routeName: '',
|
||||
title: '',
|
||||
path: '',
|
||||
component: '',
|
||||
@@ -484,6 +489,7 @@ async function handleSubmit() {
|
||||
const submitData = {
|
||||
...formData.value,
|
||||
parentId: formData.value.parentId ?? null,
|
||||
routeName: formData.value.routeName?.trim() || null,
|
||||
icon: formData.value.icon?.trim() || null,
|
||||
iconSvg: formData.value.iconSvg?.trim() || null,
|
||||
superMenu: formData.value.superMenu ? 1 : 0,
|
||||
@@ -612,6 +618,22 @@ defineExpose({
|
||||
<Input v-model:value="formData.name" placeholder="请输入菜单名称" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="路由名称"
|
||||
name="routeName"
|
||||
:rules="[
|
||||
{
|
||||
pattern: /^[A-Za-z][A-Za-z0-9_]*$/,
|
||||
message: '须以字母开头,仅字母/数字/下划线',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Input
|
||||
v-model:value="formData.routeName"
|
||||
placeholder="Vue Router name,如 ShopList(可空,空则用菜单名称)"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="菜单标题" name="title">
|
||||
<Input v-model:value="formData.title" placeholder="请输入菜单标题" />
|
||||
</Form.Item>
|
||||
|
||||
@@ -67,6 +67,12 @@ const gridOptions: VxeGridProps<any> = {
|
||||
dragSort: true, // 启用拖拽排序
|
||||
// 移除自定义插槽,让拖拽控件正常显示
|
||||
},
|
||||
{
|
||||
field: 'routeName',
|
||||
title: '路由名称',
|
||||
minWidth: 140,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '菜单标题',
|
||||
|
||||
Reference in New Issue
Block a user