|
@@ -1,38 +1,40 @@
|
|
|
-import {FilterButtonGroup, FilterField, FilterFieldWrapper, FilterSelect} from '@components';
|
|
|
-import {useContextSection, useFilterField, useTableSearchEvent, useUserOptions} from '@hooks';
|
|
|
+import {FilterButtonGroup, FilterField, FilterFieldWrapper} from '@components';
|
|
|
+import {useContextSection, useFilterField, useTableSearchToolEvents} from '@hooks';
|
|
|
import {Card} from 'antd';
|
|
|
import {FC} from 'react';
|
|
|
import {context, searchContext} from '../context';
|
|
|
|
|
|
const Filter: FC = function () {
|
|
|
- const userOptions = useUserOptions(true);
|
|
|
- const [{materialId, userId}, onChange] = useFilterField({materialId: '', userId: ''});
|
|
|
- const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
|
|
|
- const onSearch = useTableSearchEvent(context, {materialId, userId});
|
|
|
+ const [fields, onChange] = useFilterField({
|
|
|
+ materialName: '',
|
|
|
+ wllbCode: '',
|
|
|
+ userName: '',
|
|
|
+ });
|
|
|
+ const {isSearching} = useContextSection(searchContext, state => state[0]);
|
|
|
+ const [, {onSearch, onReset}] = useTableSearchToolEvents(context, fields);
|
|
|
|
|
|
return (
|
|
|
<Card>
|
|
|
<FilterFieldWrapper>
|
|
|
- <FilterSelect
|
|
|
- name='materialBindUser'
|
|
|
- options={userOptions}
|
|
|
- label='用户'
|
|
|
- value={userId}
|
|
|
- onChange={onChange('userId')}
|
|
|
- />
|
|
|
<FilterField
|
|
|
- value={materialId}
|
|
|
+ value={fields.wllbCode}
|
|
|
label='物料编号'
|
|
|
- onChange={onChange('materialId')}
|
|
|
- name='materialCode'
|
|
|
+ onChange={onChange('wllbCode')}
|
|
|
+ name='wllbCode'
|
|
|
/>
|
|
|
-
|
|
|
- <FilterButtonGroup
|
|
|
- offset={6}
|
|
|
- onRefresh={refetch}
|
|
|
- onSearch={onSearch}
|
|
|
- isSearching={isSearching}
|
|
|
+ <FilterField
|
|
|
+ value={fields.materialName}
|
|
|
+ label='物料名称'
|
|
|
+ onChange={onChange('materialName')}
|
|
|
+ name='materialName'
|
|
|
+ />
|
|
|
+ <FilterField
|
|
|
+ value={fields.userName}
|
|
|
+ label='用户名称'
|
|
|
+ onChange={onChange('userName')}
|
|
|
+ name='userName'
|
|
|
/>
|
|
|
+ <FilterButtonGroup onSearch={onSearch} isSearching={isSearching} onReset={onReset} />
|
|
|
</FilterFieldWrapper>
|
|
|
</Card>
|
|
|
);
|