fix: 修改手机端我的发起页面搜索没反应 (#1280)

Reviewed-on: daoyoucloud/tachybase#1280
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-07-05 18:12:33 +08:00 committed by sealday
parent ef0c7f5769
commit 7bfd26a2b3
2 changed files with 9 additions and 2 deletions

View File

@ -21,7 +21,7 @@ export const InitiationsBlockContext = createContext({});
export const InitiationsBlock = observer((props) => {
const fieldSchema = useFieldSchema();
const { t } = useTranslation();
const [contextFilter, setContextFilter] = useState({ key: 'initiations', inputFilter: '' });
const [contextFilter, setContextFilter] = useState({ key: 'userInitiations', inputFilter: '' });
const [changeValue, setChangeValue] = useState('');
return (
<ExtendCollectionsProvider

View File

@ -28,7 +28,14 @@ export const ApprovalItem = observer((props) => {
}, [filter, params]);
useEffect(() => {
if (inputFilter && defaultData.length) {
const filterData = defaultData.filter((value) => (value.title as string)?.includes(inputFilter));
const filterData = defaultData.filter((value) => {
const reason = value?.reason.find((reasonItem) => reasonItem?.value?.toString().includes(inputFilter));
return value.title.includes(inputFilter) || reason;
});
filterData.sort((a, b) => {
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
});
setData(filterData);
} else {
setData(defaultData);