Element懒加载表格el-table数据实现全选功能<el-table
v-loading="loading.list"
ref="table"
:data="tableData"
max-height="400"
border
lazy
row-key="key"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:load="load"
:
header-cell-class-name="cellClass"
@select="selectRow"
@selection-change="selectionChange"
@select-all="selectAll">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column prop="key" label="编号"></el-table-column>
<el-table-column prop="identityName" label="姓名"></el-table-column>
</el-table>
data() {
return {
form: {
林佑威老婆dimId: 1,
name: '',
key: '',
tenantId: ''
郭涛老婆李燃},
怎么洗葡萄treeData: [],
tableData: [],
loading: {
tree: false
},
multipleSelection: [],
tableAllData: [], // 存储所有的表格数据
checkAll: false, // 判断当前是否全选
}
},
// 全选
selectAll(selection) {
this.checkAll = !this.checkAll;
this.tableAllData.map(row => {
this.$leRowSelection(row, this.checkAll);必备化妆品
})
},
async load(row, treeNode, resolve) {
try {
let self = this;
let params = { parentId: upId, groupId: upId }
const data = await getOrganizeList({ ...self.form }, params)
let arr = data.map(item => {
return {
...item,
hasChildren: item.childs && item.childs > 0,
children: []
}
})
this.tableAllData = at(arr) // 保存表格数据
resolve(arr)
return
} catch (error) {
console.log(error)徐良小凌
}
},
>个个相助汗水流打一字