Browse Source

党组织管理懒加载子节点没数据不显示下拉

V1.0
mk 2 years ago
parent
commit
d2ef30e203
  1. 26
      src/views/modules/communityParty/partyOrg/orgTree.vue

26
src/views/modules/communityParty/partyOrg/orgTree.vue

@ -41,8 +41,8 @@
:load="handleTreeNodeExpand" :load="handleTreeNodeExpand"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
ref="table" ref="table"
:row-class-name="rowClassName"
> >
<el-table-column <el-table-column
prop="partyOrgName" prop="partyOrgName"
label="党组织名称" label="党组织名称"
@ -197,7 +197,15 @@ export default {
} }
}); });
}, },
rowClassName(row, rowIndex) {
if (row.row.childrenQty == 0) {
return 'no-expand';
}
return '';
},
hasChildren(row){
console.log(row);
},
/** /**
* 点击"新增" * 点击"新增"
*/ */
@ -259,8 +267,14 @@ export default {
if (!data) { if (!data) {
return; return;
} }
this.partyOrgTree=[] this.partyOrgTree=[]
this.partyOrgTree.push(data); this.partyOrgTree.push(data);
data.children.forEach(item=>{
if(item.childrenQty != 0){
item.hasChildren = true
}
})
this.tableKey = new Date().getTime(); this.tableKey = new Date().getTime();
// 2 // 2
console.log(">>>>", this.partyOrgTree) console.log(">>>>", this.partyOrgTree)
@ -285,6 +299,11 @@ export default {
}) })
this.epmetResultResolver.success((data) => { this.epmetResultResolver.success((data) => {
data.forEach(item=>{
if(item.childrenQty != 0){
item.hasChildren = true
}
})
row.children = data; // row.children = data; //
resolve(row.children); // resolve(row.children); //
// this.partyOrgTree.push(data); // this.partyOrgTree.push(data);
@ -379,4 +398,7 @@ export default {
margin-top: 20px; margin-top: 20px;
text-align: center; text-align: center;
} }
::v-deep .no-expand>:nth-child(1) .cell .el-table__expand-icon{
display: none;
}
</style> </style>

Loading…
Cancel
Save