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:
parent
ef0c7f5769
commit
7bfd26a2b3
@ -21,7 +21,7 @@ export const InitiationsBlockContext = createContext({});
|
|||||||
export const InitiationsBlock = observer((props) => {
|
export const InitiationsBlock = observer((props) => {
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [contextFilter, setContextFilter] = useState({ key: 'initiations', inputFilter: '' });
|
const [contextFilter, setContextFilter] = useState({ key: 'userInitiations', inputFilter: '' });
|
||||||
const [changeValue, setChangeValue] = useState('');
|
const [changeValue, setChangeValue] = useState('');
|
||||||
return (
|
return (
|
||||||
<ExtendCollectionsProvider
|
<ExtendCollectionsProvider
|
||||||
|
@ -28,7 +28,14 @@ export const ApprovalItem = observer((props) => {
|
|||||||
}, [filter, params]);
|
}, [filter, params]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputFilter && defaultData.length) {
|
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);
|
setData(filterData);
|
||||||
} else {
|
} else {
|
||||||
setData(defaultData);
|
setData(defaultData);
|
||||||
|
Loading…
Reference in New Issue
Block a user