30 lines
849 B
Vue
30 lines
849 B
Vue
|
|
<template>
|
||
|
|
<Tree ref="treRef" :data="tree" />
|
||
|
|
</template>
|
||
|
|
<script setup lang="ts">
|
||
|
|
import { getFormalUserList } from '@/api/user-boot/official'
|
||
|
|
import Tree from '../cloudDevice.vue'
|
||
|
|
import { useConfig } from '@/stores/config'
|
||
|
|
import { ref, reactive, nextTick } from 'vue'
|
||
|
|
const config = useConfig()
|
||
|
|
const tree = ref()
|
||
|
|
const treRef = ref()
|
||
|
|
const emit = defineEmits(['selectUser'])
|
||
|
|
getFormalUserList().then((res: any) => {
|
||
|
|
if (res.code === 'A0000') {
|
||
|
|
tree.value = res.data.map((item: any) => {
|
||
|
|
return {
|
||
|
|
...item,
|
||
|
|
icon: 'el-icon-User',
|
||
|
|
color: 'royalblue'
|
||
|
|
}
|
||
|
|
})
|
||
|
|
emit('selectUser', tree.value[0])
|
||
|
|
nextTick(() => {
|
||
|
|
treRef.value.treeRef.setCurrentKey(tree.value[0].id)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
</script>
|
||
|
|
<style lang="scss" scoped></style>
|