实现效果
实现代码
<el-table
:data="searchResult"
style="width: 100%"
height="385"
:header-cell-style="{
'background-color': '#2C2E3D',
'text-align': 'center',
'color': '#fff',
'font-family': 'PingFangSC-Medium, PingFang SC',
'font-weight': 500,
'letter-spacing': '1px',
'height': '60px'
}"
:cell-style="{ 'text-align': 'center', color: '#fff' }"
@row-click="rowClick"
row-key="id"
lazy
:load="load"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
</el-table>
res.data.row.map((item, index) => {
item.id = (this.currentPage - 1) * this.pagesize + index + 1;
item.hasChildren = true;
return item;
});
load(tree, treeNode, resolve) {
this.$api.caseRetrieval.getAllCase({
identityNum: tree.identityNum
})
.then(res => {
res.data.forEach((i, index) => {
i.id = tree.id + "-" + (index + 1);
});
resolve(res.data);
});
},