|
@@ -9,7 +9,7 @@
|
|
|
>
|
|
|
<div class="boxnei" style="display: flex;flex-direction: column;">
|
|
|
<div style="overflow: auto;flex:1">
|
|
|
- <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" ref="avueTree"></avue-tree>
|
|
|
+ <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" ref="avueTree" style="display: inline-block;min-width: 100%;"></avue-tree>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
@@ -646,6 +646,7 @@ export default {
|
|
|
loadData:[],
|
|
|
treeOption:{
|
|
|
defaultExpandedKeys:[],
|
|
|
+ currentNode:{},
|
|
|
filter:false,
|
|
|
addBtn:false,
|
|
|
props:{
|
|
@@ -654,12 +655,12 @@ export default {
|
|
|
value:'id',
|
|
|
children:'children'
|
|
|
},
|
|
|
+
|
|
|
lazy: true,
|
|
|
treeLoad: function (node, resolve) {
|
|
|
- console.log(node);
|
|
|
const parentId = (node.level === 0) ? 12345678910 : node.data.id;
|
|
|
|
|
|
- tabTypeLazyTreeAll({parentId,current:1}).then(res => {
|
|
|
+ tabTypeLazyTreeAll({parentId,current:1,size:1000}).then(res => {
|
|
|
resolve(res.data.data.records.map(item => {
|
|
|
return {
|
|
|
...item,
|
|
@@ -860,12 +861,24 @@ export default {
|
|
|
//刷新左边树形数据
|
|
|
refreshTreeData(){
|
|
|
const parentId =12345678910
|
|
|
- tabTypeLazyTreeAll({parentId,current:1}).then(res => {
|
|
|
+ tabTypeLazyTreeAll({parentId,current:1,siez:1000}).then(res => {
|
|
|
this.treeData=res.data.data.records;
|
|
|
this.$nextTick(()=>{
|
|
|
//树默认展开
|
|
|
- this.treeOption.defaultExpandedKeys.push(this.curNode.data.parentId);
|
|
|
- // this.$refs.avueTree.setCurrentKey(this.curNode.data.parentId)
|
|
|
+ if(this.curNode.level===1){
|
|
|
+ this.treeOption.defaultExpandedKeys.push(this.curNode.data.id);
|
|
|
+ this.$refs.avueTree.setCurrentKey(this.curNode.data.id)
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.treeOption.defaultExpandedKeys.push(this.curNode.data.parentId);
|
|
|
+ // 设置选中的节点
|
|
|
+ this.treeOption.currentNode =this.curNode.data.id
|
|
|
+ this.$refs.avueTree.setCurrentKey(this.curNode.data.id)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
});
|
|
|
},
|