This commit is contained in:
caozehui
2024-12-31 19:54:27 +08:00
parent 5e8dda0b75
commit aa52778e99

View File

@@ -35,9 +35,18 @@
</div> </div>
<div class="content-tree"> <div class="content-tree">
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="id" <el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="id"
:data="treeDataUnqualified" :props="defaultProps" @node-click="handleNodeClick"/> :data="treeDataUnqualified" :props="defaultProps" @node-click="handleNodeClick"
class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
</template>
</el-tree>
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="id" <el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="id"
:data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick"/> :data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick" class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
</template>
</el-tree>
</div> </div>
</div> </div>
@@ -184,58 +193,60 @@ const handleSwitchChange = async (data: any) => {
} else { } else {
// 发起请求,查询该测试项的检测结果 // 发起请求,查询该测试项的检测结果
// const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,1}) // const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,1})
treeDataAll = [{ treeDataAll = [
"id": "1", {
"scriptName": "频率准确度检测", "id": "1",
"children": [ "scriptName": "频率准确度检测",
{ "children": [
"id": "1-1", {
"scriptName": "额定工作条件下的检测", "id": "1-1",
"children": [ "scriptName": "额定工作条件下的检测",
{ "children": [
"id": "1-1-1", {
"scriptName": "输入:频率 42.5Hz..." "id": "1-1-1",
}, "scriptName": "输入:频率 42.5Hz..."
{ },
"id": "1-1-2", {
"scriptName": "输入:频率 50.0Hz..." "id": "1-1-2",
}, "scriptName": "输入:频率 50.0Hz..."
{ },
"id": "1-1-3", {
"scriptName": "输入:频率 50.05Hz...." "id": "1-1-3",
} "scriptName": "输入:频率 50.05Hz...."
] }
}, ]
{ },
"id": "1-2", {
"scriptName": "电压对频率测量的影响", "id": "1-2",
"children": [ "scriptName": "电压对频率测量的影响",
{ "children": [
"id": "1-2-1", {
"scriptName": "输入:频率 50.05Hz Ua =10%Un..." "id": "1-2-1",
}, "scriptName": "输入:频率 50.05Hz Ua =10%Un..."
{ },
"id": "1-2-2", {
"scriptName": "输入:频率 51.05Hz Ua =10%Un..." "id": "1-2-2",
}, "scriptName": "输入:频率 51.05Hz Ua =10%Un..."
{ },
"id": "1-2-3", {
"scriptName": "输入:频率 52.05Hz Ua =10%Un..." "id": "1-2-3",
} "scriptName": "输入:频率 52.05Hz Ua =10%Un..."
] }
}, ]
{ },
"id": "1-3", {
"scriptName": "谐波对频率测量的影响", "id": "1-3",
"children": [ "scriptName": "谐波对频率测量的影响",
{ "children": [
"id": "1-3-1", {
"scriptName": "输入:频率 50.05Hz Ua =100%Un..." "id": "1-3-1",
} "scriptName": "输入:频率 50.05Hz Ua =100%Un..."
] }
} ]
] }
}] ]
},
]
} }
@@ -505,13 +516,19 @@ defineExpose({
padding: 10px 0; padding: 10px 0;
border: 1px solid #ccc; border: 1px solid #ccc;
overflow: auto; overflow-y: auto;
.content-tree { .content-tree {
min-width: 100%; width: 100%;
height: 100%; height: 100%;
max-height: 100%; max-height: 100%;
margin-top: 10px; margin-top: 10px;
.custom-tree-node {
overflow-x: hidden !important; // 溢出部分隐藏
white-space: nowrap !important; //禁止自动换行
text-overflow: ellipsis !important; // 使溢出部分以省略号显示
}
} }
} }