let obj = {
fileType: this.selectTypeValue,
stamp: this.selectStampValue,
sessiona: this.selectSessionaValue
}
let arr = this.allFileList
// 通过遍历key值来循环处理
Object.keys(obj).forEach(item => {
// 调用自己定义好的筛选方法
arr = filterFunc(obj[item],item , arr)
})
// 为表格赋值
this.fileList = arr;
// val: 查询条件的值
// target: 目标参数,就是你这个值对应的key
// filterarr: 被筛选的数组
function filterFunc(val, target, filterArr) {
// 参数不存在或为空时,就相当于查询全部
if (val == undefined || val == '') return filterArr
// 可以自己加一个.toLowerCase()来兼容一下大小
return filterArr.filter(p => p[target].indexOf(val) > -1)
}