This commit is contained in:
yanran200730
2022-08-24 17:56:05 +08:00
parent 883aca74e1
commit 7e52c337c3
2 changed files with 26 additions and 10 deletions

View File

@@ -13,7 +13,6 @@
node-key="id"
ref="tree"
:filter-node-method="filterNode"
default-expand-all
highlight-current>
<template slot-scope="{node,data}">
<div v-text="node.label"/>
@@ -153,7 +152,7 @@ export default {
treeObj: {
treeList: [],
defaultProps: {
children: "girdList",
children: "children",
label: "girdName",
},
defaultExpandedKeys: [],
@@ -216,13 +215,28 @@ export default {
this.getList();
},
getTreeList() {
this.instance.post("/app/appgirdinfo/listAllByTop").then(res => {
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
if (res?.data) {
this.treeObj.treeList = [res.data];
this.info = res.data
// this.treeObj.treeList = [res.data];
// this.info = res.data
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.info.id)
this.$refs.tree.setCurrentKey(res.data.id)
})
this.treeObj.treeList = res.data.filter(e => !e.parentGirdId)
const parentGirdId = this.treeObj.treeList[0].id
this.treeObj.treeList.map(p => this.addChild(p, res.data.map(v => {
if (v.id === parentGirdId) {
// this.defaultExpandedKeys.push(v.id)
}
return {
...v
}
}), {
parent: 'parentGirdId'
}))
}
});
},