Files
admin-govern/src/components/tree/deviceTree.vue

36 lines
1.0 KiB
Vue
Raw Normal View History

2024-01-09 13:49:21 +08:00
<template>
<Tree :data="tree" />
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import Tree from './index.vue'
import { getDeviceTree } from '@/api/cs-device-boot/csLedger'
import { useConfig } from '@/stores/config'
defineOptions({
name: 'govern/deviceTree'
})
const config = useConfig()
const tree = ref()
getDeviceTree().then(res => {
let arr: any[] = []
2024-01-09 16:45:29 +08:00
res.data.forEach((item: any) => {
2024-01-09 13:49:21 +08:00
item.icon = 'el-icon-HomeFilled'
item.color = config.getColorVal('elementUiPrimary')
2024-01-09 16:45:29 +08:00
item.children.forEach((item2: any) => {
2024-01-09 13:49:21 +08:00
item2.icon = 'el-icon-List'
item.color = config.getColorVal('elementUiPrimary')
2024-01-09 16:45:29 +08:00
item2.children.forEach((item3: any) => {
2024-01-09 13:49:21 +08:00
item3.icon = 'el-icon-Platform'
item3.color = config.getColorVal('elementUiPrimary')
if (item3.comFlag === 1) {
item3.color = '#e26257 !important'
}
arr.push(item3)
})
})
})
tree.value = res.data
})
</script>