文件服务表格高度问题&初始化选中便携式设备问题修改

This commit is contained in:
zhujiyan
2024-10-23 16:29:13 +08:00
parent 8131158545
commit 896362b62f
3 changed files with 22 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ const props = withDefaults(
defaultCheckedKeys: []
}
)
const emit = defineEmits(['init', 'checkChange','deviceTypeChange'])
const emit = defineEmits(['init', 'checkChange', 'deviceTypeChange'])
const config = useConfig()
const tree = ref()
const treRef = ref()
@@ -36,6 +36,7 @@ const changeDeviceType = (val: any, obj: any) => {
}
getDeviceTree().then(res => {
let arr: any[] = []
let arr2: any[] = []
//治理设备
res.data.map((item: any) => {
if (item.name == '治理设备') {
@@ -56,14 +57,20 @@ getDeviceTree().then(res => {
})
})
} else if (item.name == '便携式设备') {
console.log(11111)
item.children.forEach((item: any) => {
item.icon = 'el-icon-Platform'
item.color = config.getColorVal('elementUiPrimary')
item.color = '#e26257 !important'
item.color = item.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
if (item.type == 'device') {
arr2.push(item)
}
item.children.forEach((item2: any) => {
item2.icon = 'el-icon-Platform'
item2.color = item2.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
// item2.children.forEach((item3: any) => {
// item3.icon = 'el-icon-Platform'
// item3.color = config.getColorVal('elementUiPrimary')
@@ -85,8 +92,19 @@ getDeviceTree().then(res => {
level: 2,
...arr[0]
})
return
}
if (arr2.length) {
treRef.value.treeRef2.setCurrentKey(arr2[0].id)
// 注册父组件事件
emit('init', {
level: 2,
...arr2[0]
})
return
} else {
emit('init')
return
}
})
})