| | |
| | | import useProductStore from "@/stores/sd/product/prduct" |
| | | let productStore = useProductStore() |
| | | export default function scrollEvnt(row){ |
| | | // 内容高度 |
| | | var scrollHeight = row.$event.target.scrollHeight |
| | | var clientHeight = row.$event.target.clientHeight |
| | | var scrollTop = row.$event.target.scrollTop |
| | | //滚动到底部 |
| | | if ((Math.round(scrollTop + clientHeight) >= scrollHeight ) ) { |
| | | productStore.flag=true |
| | | //前端筛选功能 |
| | | |
| | | //筛选手动触发 |
| | | function changeFilterEvent (event, option, $panel) { |
| | | // 手动触发筛选 |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | |
| | | // 筛选函数 |
| | | const filterChanged = ({ option, row, column }) => { |
| | | if (option && 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 |
| | | } |
| | | |
| | | const filterChangeds = ({ option, row, column }) => { |
| | | if (option.data) { |
| | | // 将筛选关键词统一转为小写 |
| | | const searchStr = option.data.toLowerCase(); |
| | | |
| | | if (column.field.indexOf('.') > -1) { |
| | | let array = column.field.split('.'); |
| | | // 获取要比较的值并转为字符串后再转小写 |
| | | const value = row[array[0]]?.[array[1]]; |
| | | const valueStr = (value?.toString() || '').toLowerCase(); |
| | | return valueStr.indexOf(searchStr) > -1; |
| | | } else { |
| | | // 获取要比较的值并转为字符串后再转小写 |
| | | const value = row[column.field]; |
| | | const valueStr = (value?.toString() || '').toLowerCase(); |
| | | return valueStr.indexOf(searchStr) > -1; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | export {changeFilterEvent,filterChanged,filterChangeds} |