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

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
}
})
})

View File

@@ -229,7 +229,7 @@ defineOptions({
name: 'govern/device/fileService'
})
const pageHeight = mainHeight(20)
const tableHeight = mainHeight(100)
const tableHeight = mainHeight(130)
const loading = ref(false)
//nDid
@@ -243,7 +243,8 @@ const isRoot = ref<boolean>(true)
//储存所有点击过的目录
const activePathList: any = ref([])
const nodeClick = (e: any) => {
if (e.level == 2) {
console.log(e,"------");
if (e && (e.level == 2 || e.type == 'device')) {
loading.value = true
nDid.value = e.ndid
dirList.value = []

View File

@@ -319,7 +319,6 @@ const nodeClick = async (e: anyObj) => {
await getTestRecordInfo(id)
.then(async res => {
deviceData.value = res.data
console.log(deviceData.value, '.......')
if (res.data.records.length == 1) {
activeName.value = res.data.records[0].id
} else {
@@ -334,7 +333,6 @@ const nodeClick = async (e: anyObj) => {
}
})
}
console.log(activeName.value, '7777777777777')
searchForm.value.index = [indexOptions.value[0].id]
schemeTreeRef.value.getPlanData(deviceData.value)
@@ -588,7 +586,6 @@ const init = (flag: boolean) => {
echartsData.value.yAxis[index].max = max
})
}
// console.log("🚀 ~ .1111 ~ echartsData.value :", echartsData.value)
loading.value = false
}
@@ -690,12 +687,10 @@ const handleExport = async () => {
}
let itemList: any = list[index].data[indexs]
if (itemList && itemList.length != 0) {
console.log(itemList, 'hhhhh')
itemList[1] = itemList[1] ? itemList[1] : '/'
index == list.length - 1 ? (strs += itemList[1]) : (strs += itemList[1] + ',')
} else {
index == list.length - 1 ? (strs += '/') : (strs += '/,')
console.log(index, 'my')
}
})
if (count == 0 && xAxis[indexs]) {