修改冀北现场反馈问题
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||
<pane :size="size">
|
||||
<AssessTree
|
||||
ref="AssessTreeRef"
|
||||
:default-expand-all="false"
|
||||
@node-click="handleNodeClick"
|
||||
@init="handleNodeClick"
|
||||
ref="assessTreeRef"
|
||||
:highlight-current="true"
|
||||
:current-node-key="currentTreeKey"
|
||||
:expand-on-click-node="false"
|
||||
@@ -263,7 +263,7 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
// 添加树组件的引用
|
||||
const assessTreeRef = ref<any>(null)
|
||||
const AssessTreeRef = ref()
|
||||
// 控制树组件当前高亮的节点key
|
||||
const currentTreeKey = ref<string | number | null>(null)
|
||||
// 保存上一次真正有效的节点key(子节点)
|
||||
@@ -308,6 +308,44 @@ const handleNodeClick = (data: any, node: any) => {
|
||||
infoLoading.value = true
|
||||
outcomeLoading.value = true
|
||||
}
|
||||
const setId = (id: any) => {
|
||||
setTimeout(() => {
|
||||
lastValidNodeKey.value = id
|
||||
currentTreeKey.value = lastValidNodeKey.value
|
||||
dotList.value = findNodeByTreeId(AssessTreeRef.value?.tree, id)?.name || {}
|
||||
currentNodeName.value = findNodeByTreeId(AssessTreeRef.value?.tree, id)?.name || '' //data?.name || ''
|
||||
currentNodeId.value = id
|
||||
AssessTreeRef.value?.scrollToNode(id)
|
||||
}, 100)
|
||||
}
|
||||
/**
|
||||
* 递归查找树形结构中匹配treeId的节点对象
|
||||
* @param {Array} treeData - 树形结构数据(数组)
|
||||
* @param {string} targetTreeId - 要查找的treeId
|
||||
* @returns {object|null} 匹配的节点对象(未找到返回null)
|
||||
*/
|
||||
const findNodeByTreeId = (treeData: any, id: any) => {
|
||||
// 遍历每一个顶层节点
|
||||
for (const node of treeData) {
|
||||
// 1. 当前节点匹配,直接返回
|
||||
if (node.id === id) {
|
||||
return node
|
||||
}
|
||||
// 2. 当前节点有子节点,递归查找子节点
|
||||
if (node.children && Array.isArray(node.children) && node.children.length > 0) {
|
||||
const foundNode: any = findNodeByTreeId(node.children, id)
|
||||
// 子节点中找到则返回(终止递归)
|
||||
if (foundNode) {
|
||||
return foundNode
|
||||
}
|
||||
}
|
||||
}
|
||||
// 遍历完所有节点未找到,返回null
|
||||
return null
|
||||
}
|
||||
defineExpose({
|
||||
setId
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
|
||||
@@ -110,10 +110,10 @@
|
||||
<el-collapse-item title="谐波电流/电压评估结果" :name="4">
|
||||
<div class="flickerWaves" style="height: 520px">
|
||||
<vxe-table :data="harmonicCurrents" height="520px" v-bind="defaultAttribute" :cell-class-name="getCellClassName3" style="width: 50%">
|
||||
<vxe-column title="谐波次数" field="name" />
|
||||
<vxe-column title="谐波次数" field="name" width="90px"/>
|
||||
<vxe-colgroup title="电容器谐波电流评估值(A)">
|
||||
<vxe-column field="notInvested" title="未投入" min-width="160px" />
|
||||
<vxe-column field="hasInvested" title="已投入" min-width="160px" />
|
||||
<vxe-column field="notInvested" title="未投入" />
|
||||
<vxe-column field="hasInvested" title="已投入" />
|
||||
</vxe-colgroup>
|
||||
<vxe-column title="国标限值(%)" field="limitData" />
|
||||
<vxe-column title="判断">
|
||||
@@ -131,10 +131,10 @@
|
||||
:cell-class-name="getCellClassName3"
|
||||
style="width: 50%"
|
||||
>
|
||||
<vxe-column title="谐波次数" field="name" />
|
||||
<vxe-column title="谐波次数" field="name" width="90px"/>
|
||||
<vxe-colgroup title="电容器谐波电压评估值(%)">
|
||||
<vxe-column field="notInvested" title="未投入" min-width="160px" />
|
||||
<vxe-column field="hasInvested" title="已投入" min-width="160px" />
|
||||
<vxe-column field="notInvested" title="未投入" />
|
||||
<vxe-column field="hasInvested" title="已投入" />
|
||||
</vxe-colgroup>
|
||||
<vxe-column title="国标限值(A)" field="limitData" />
|
||||
<vxe-column title="判断">
|
||||
|
||||
Reference in New Issue
Block a user