first commit
This commit is contained in:
22
src/hooks/app/space.ts
Normal file
22
src/hooks/app/space.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ref } from 'vue'
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
import { listSpaceTree } from '@/apis'
|
||||
|
||||
/** 部门模块 */
|
||||
export function space(options?: { onSuccess?: () => void }) {
|
||||
const loading = ref(false)
|
||||
const spaceList = ref<TreeNodeData[]>([])
|
||||
|
||||
const getSpaceList = async (name?: string) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await listSpaceTree({ description: name })
|
||||
spaceList.value = res.data
|
||||
// eslint-disable-next-line ts/no-unused-expressions
|
||||
options?.onSuccess && options.onSuccess()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
return { spaceList, getSpaceList, loading }
|
||||
}
|
||||
Reference in New Issue
Block a user