//前端筛选功能
|
|
//筛选手动触发
|
function changeFilterEvent (event, option, $panel) {
|
// 手动触发筛选
|
$panel.changeOption(event, !!option.data, option)
|
}
|
|
// 筛选函数
|
const filterChanged = ({ option, row, column }) => {
|
if (option.data) {
|
|
if(column.field.indexOf('.')>-1){
|
let array = column.field.split('.')
|
if (row[array[0]][array[1]]==null){
|
return ''.indexOf(option.data) > -1
|
}else {
|
return row[array[0]][array[1]].toString().indexOf(option.data) > -1
|
}
|
|
}else {
|
if (row[column.field]==null){
|
return ''.indexOf(option.data) > -1
|
}else {
|
return row[column.field].toString().indexOf(option.data) > -1
|
}
|
|
}
|
}
|
return true
|
}
|
|
export {changeFilterEvent,filterChanged}
|