feat: 新增角色管理

This commit is contained in:
2024-04-14 11:31:12 +08:00
parent 98b249a3a2
commit ceef5ceb15
9 changed files with 605 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
export * from './useMenu'
export * from './useDept'
export * from './useRole'
export * from './useDict'

21
src/hooks/app/useMenu.ts Normal file
View File

@@ -0,0 +1,21 @@
import { ref } from 'vue'
import { listMenuTree } from '@/apis'
import type { TreeNodeData } from '@arco-design/web-vue'
/** 菜单模块 */
export function useMenu(options?: { onSuccess?: () => void }) {
const loading = ref(false)
const menuList = ref<TreeNodeData[]>([])
const getMenuList = async (name?: string) => {
try {
loading.value = true
const res = await listMenuTree({ description: name })
menuList.value = res.data
options?.onSuccess && options.onSuccess()
} finally {
loading.value = false
}
}
return { menuList, getMenuList, loading }
}