fix: 菜单ID类型声明错误修改

Former-commit-id: 9819c4c1b6ed8741fc412cecbd9f459f74ef7b57
This commit is contained in:
郝先瑞
2022-04-19 12:26:43 +08:00
parent 23771a1fdc
commit 66d411c32e
2 changed files with 8 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ export interface MenuFormData {
/**
* 菜单ID
*/
id: string ,
id?: string ,
/**
* 父菜单ID
*/
@@ -51,7 +51,7 @@ export interface MenuFormData {
/**
* 组件路径
*/
component: string,
component?: string,
/**
* 路由路径
*/

View File

@@ -49,7 +49,8 @@
<el-dialog :title="dialog.title" v-model="dialog.visible" @close="cancel" width="750px">
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="父级菜单" prop="parentId">
<el-tree-select v-model="formData.parentId" placeholder="选择上级菜单" :data="menuOptions" filterable check-strictly />
<el-tree-select v-model="formData.parentId" placeholder="选择上级菜单" :data="menuOptions" filterable
check-strictly />
</el-form-item>
<el-form-item label="菜单名称" prop="name">
@@ -230,10 +231,11 @@ function handleRowClick(row: any) {
}
async function handleAdd(row: any) {
state.formData.id = undefined
await loadMenuData();
state.dialog = {
title: "添加菜单",
visible: true,
visible: true
};
if (row.id) {
// 行点击新增
@@ -241,13 +243,13 @@ async function handleAdd(row: any) {
if (row.id == '0') {
state.formData.component = "Layout";
} else {
state.formData.component = "";
state.formData.component = undefined;
}
} else {
if (state.currentRow) {
// 工具栏新增
state.formData.parentId = (state.currentRow as any).id;
state.formData.component = "";
state.formData.component = undefined;
} else {
state.formData.parentId = "0";
state.formData.component = "Layout";