表格多条件搜索
# 前端进行多条件表格搜索
handleSearch() {
// 表单数据格式
// searchForm:{field1:'11',field2:'22'}
let form = this.searchForm;
// 表格数据源
let tableList = this.tableData;
// 筛选后的数据
const filterList = tableList.filter((item) => {
return Object.values(form).every((key, index) => {
return item[Object.keys(form)[index]].includes(key)
})
})
this.tableData = filterList
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
上次更新: 2024/07/01, 22:24:11