mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2026-01-13 00:57:09 +08:00
22 lines
605 B
TypeScript
22 lines
605 B
TypeScript
import { ref } from 'vue'
|
|
import type { TreeNodeData } from '@arco-design/web-vue'
|
|
import { listDeptTree } from '@/apis'
|
|
|
|
/** 部门模块 */
|
|
export function useDept(options?: { onSuccess?: () => void }) {
|
|
const loading = ref(false)
|
|
const deptList = ref<TreeNodeData[]>([])
|
|
|
|
const getDeptList = async (name?: string) => {
|
|
try {
|
|
loading.value = true
|
|
const res = await listDeptTree({ description: name })
|
|
deptList.value = res.data
|
|
options?.onSuccess && options.onSuccess()
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
return { deptList, getDeptList, loading }
|
|
}
|