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