bug
This commit is contained in:
@@ -217,8 +217,6 @@ export default {
|
|||||||
getTreeList() {
|
getTreeList() {
|
||||||
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
|
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
// this.treeObj.treeList = [res.data];
|
|
||||||
// this.info = res.data
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.tree.setCurrentKey(res.data.id)
|
this.$refs.tree.setCurrentKey(res.data.id)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,19 +13,19 @@
|
|||||||
</header>
|
</header>
|
||||||
<div class="tree-div">
|
<div class="tree-div">
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="treeObj.treeList"
|
:data="treeObj.treeList"
|
||||||
:props="treeObj.defaultProps"
|
:props="treeObj.defaultProps"
|
||||||
@node-click="handleNodeClick"
|
@node-click="handleNodeClick"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
ref="tree"
|
ref="tree"
|
||||||
:expand-on-click-node="false"
|
:expand-on-click-node="false"
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
default-expand-all
|
:default-expanded-keys="treeObj.defaultExpandedKeys"
|
||||||
highlight-current>
|
highlight-current>
|
||||||
<template slot-scope="{node,data}">
|
<template slot-scope="{node,data}">
|
||||||
<el-tooltip :content="node.label">
|
<!-- <el-tooltip :content="node.label"> -->
|
||||||
<div class="el-tree-node__label" v-text="node.label"/>
|
<div class="el-tree-node__label" :title="node.label" v-text="node.label"/>
|
||||||
</el-tooltip>
|
<!-- </el-tooltip> -->
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,7 +61,7 @@ export default {
|
|||||||
treeObj: {
|
treeObj: {
|
||||||
treeList: [],
|
treeList: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: "girdList",
|
children: "children",
|
||||||
label: "girdName",
|
label: "girdName",
|
||||||
},
|
},
|
||||||
defaultExpandedKeys: [],
|
defaultExpandedKeys: [],
|
||||||
@@ -88,9 +88,7 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.dict.load("onlineStatus")
|
this.dict.load("onlineStatus")
|
||||||
this.getTreeList().then(() => {
|
this.getTreeList()
|
||||||
this.getLeafNodes()
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
filterText(val) {
|
filterText(val) {
|
||||||
@@ -103,15 +101,29 @@ export default {
|
|||||||
return data.girdName.indexOf(value) !== -1;
|
return data.girdName.indexOf(value) !== -1;
|
||||||
},
|
},
|
||||||
getTreeList() {
|
getTreeList() {
|
||||||
return this.instance.post(`/app/appgirdinfo/listAll`).then((res) => {
|
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
|
||||||
if (res.code == 0) {
|
if (res?.data) {
|
||||||
this.treeObj.treeList = res.data;
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
res.data.length && this.$refs.tree.setCurrentKey(res.data[0].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.treeObj.defaultExpandedKeys.push(v.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...v
|
||||||
|
}
|
||||||
|
}), {
|
||||||
|
parent: 'parentGirdId'
|
||||||
|
}))
|
||||||
|
this.getLeafNodes()
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onMapInit() {
|
onMapInit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user