This commit is contained in:
ljx
2025-08-29 16:33:37 +08:00
parent dc59ade2b8
commit 47a8b17061
3 changed files with 380 additions and 382 deletions

View File

@ -167,10 +167,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="toggleExpandAll(true)">一键展开</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="toggleExpandAll(false)">一键收起</el-button>
<el-button type="primary" @click="toggleExpandAll">{{ isExpandAll ? '一键收起' : '一键展开' }}</el-button>
</el-form-item>
</el-form>
</el-card>
@ -514,11 +511,12 @@ const changeSheet = () => {
getTreeList();
};
const toggleExpandAll = (isExpand: boolean) => {
const toggleExpandAll = () => {
isExpandAll.value = !isExpandAll.value;
console.log(isExpandAll.value);
treeData.value.forEach((row) => {
treeTableRef.value.toggleRowExpansion(row, isExpand);
treeTableRef.value.toggleRowExpansion(row, isExpandAll.value);
});
isExpandAll.value = isExpand;
};
//打开获取表数据
const getTreeList = async () => {