Commit cdeaf5b892bbf706bf365ea663203c730e6b0ad2
1 parent
00fbc7c5
feat: menu add parent
Showing
2 changed files
with
11 additions
and
5 deletions
yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue
| @@ -36,7 +36,7 @@ const loginOut = () => { | @@ -36,7 +36,7 @@ const loginOut = () => { | ||
| 36 | }) | 36 | }) |
| 37 | .then(async () => { | 37 | .then(async () => { |
| 38 | userStore.loginOut() | 38 | userStore.loginOut() |
| 39 | - tagsViewStore.delAllViews | 39 | + tagsViewStore.delAllViews() |
| 40 | replace('/login?redirect=/index') | 40 | replace('/login?redirect=/index') |
| 41 | }) | 41 | }) |
| 42 | .catch(() => {}) | 42 | .catch(() => {}) |
yudao-ui-admin-vue3/src/views/system/menu/index.vue
| @@ -42,12 +42,18 @@ const menuProps = { | @@ -42,12 +42,18 @@ const menuProps = { | ||
| 42 | label: 'name', | 42 | label: 'name', |
| 43 | value: 'id' | 43 | value: 'id' |
| 44 | } | 44 | } |
| 45 | -const menuOptions = ref() // 树形结构 | 45 | +interface Tree { |
| 46 | + id: number | ||
| 47 | + name: string | ||
| 48 | + children?: Tree[] | any[] | ||
| 49 | +} | ||
| 50 | +const menuOptions = ref<any[]>([]) // 树形结构 | ||
| 46 | const getTree = async () => { | 51 | const getTree = async () => { |
| 52 | + menuOptions.value = [] | ||
| 47 | const res = await MenuApi.listSimpleMenusApi() | 53 | const res = await MenuApi.listSimpleMenusApi() |
| 48 | - const menu = { id: 0, name: '主类目', children: [] as any[] } | 54 | + let menu: Tree = { id: 0, name: '主类目', children: [] } |
| 49 | menu.children = handleTree(res) | 55 | menu.children = handleTree(res) |
| 50 | - menuOptions.value = menu | 56 | + menuOptions.value.push(menu) |
| 51 | } | 57 | } |
| 52 | // ========== 查询 ========== | 58 | // ========== 查询 ========== |
| 53 | const queryParams = reactive({ | 59 | const queryParams = reactive({ |
| @@ -268,7 +274,7 @@ onMounted(async () => { | @@ -268,7 +274,7 @@ onMounted(async () => { | ||
| 268 | node-key="id" | 274 | node-key="id" |
| 269 | v-model="menuForm.parentId" | 275 | v-model="menuForm.parentId" |
| 270 | :props="menuProps" | 276 | :props="menuProps" |
| 271 | - :data="menuData" | 277 | + :data="menuOptions" |
| 272 | check-strictly | 278 | check-strictly |
| 273 | /> | 279 | /> |
| 274 | </el-form-item> | 280 | </el-form-item> |