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

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

View File

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

View File

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