This commit is contained in:
GYYM
2024-11-14 18:40:58 +08:00
parent 12201e065f
commit a3051c0ea4
6 changed files with 146 additions and 56 deletions

View File

@@ -14,7 +14,6 @@
:props="defaultProps"
node-key="id"
default-expand-all
show-checkbox
:default-checked-keys="defaultChecked"
@node-click="handleNodeClick"
@check-change="changeSelect"
@@ -25,7 +24,9 @@
class="custom-tree-node"
style="display: flex; align-items: center"
>
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#67C23A;"/>
<svg-icon name="wind" spin></svg-icon>
<Loading v-if="data.isChildNode && data.scriptIdx === currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#E6A23C;"/>
<span>{{ node.label }}</span>
</span>
@@ -52,7 +53,16 @@ const treeList: any = ref([]);
const getTreeData = (val: any) => {
defaultChecked.value = [];
data.value = val;
defaultChecked.value.push(data.value[0].children[0].children[0].id);
if(data.value[0].children[0].hasOwnProperty("children"))
{
defaultChecked.value.push(data.value[0].children[0].children[0].id);
}
else
{
defaultChecked.value.push(data.value[0].children[0].id);
}
treeRef.value.setCurrentKey(defaultChecked.value);
};
const filterText = ref("");