|
@@ -1,89 +1,74 @@
|
|
|
-import {
|
|
|
- FilterButtonGroup,
|
|
|
- FilterDatePicker,
|
|
|
- FilterField,
|
|
|
- FilterFieldWrapper,
|
|
|
- FilterSelect,
|
|
|
-} from '@components';
|
|
|
import {
|
|
|
useContextSection,
|
|
|
useFilterField,
|
|
|
- useTableExportEvent,
|
|
|
- useTableSearchEvent,
|
|
|
useRangeDate,
|
|
|
+ useTableSearchToolEvents,
|
|
|
+ useFilterDB,
|
|
|
} from '@hooks';
|
|
|
import {GetRelocationOrderListParams} from '@models';
|
|
|
import {Card} from 'antd';
|
|
|
import {FC} from 'react';
|
|
|
-import {context, pageContext, searchContext} from '../content';
|
|
|
-import {exportRelocationOrderList} from '@apis';
|
|
|
-
|
|
|
-const options = [
|
|
|
- {label: '全部', value: ''},
|
|
|
- {label: '已移库', value: '1'},
|
|
|
- {label: '未移库', value: '0'},
|
|
|
-];
|
|
|
+import {context, searchContext} from '../content';
|
|
|
+import {FilterSelectorModal, FilterTool} from '@components';
|
|
|
+import {fixedMap, sourceMap} from './state';
|
|
|
|
|
|
const Filter: FC = function () {
|
|
|
- const [fields, onChange] = useFilterField({
|
|
|
- type: '' as GetRelocationOrderListParams['type'],
|
|
|
- warehouseTransferCode: '',
|
|
|
- materialCode: '',
|
|
|
- materialName: '',
|
|
|
- });
|
|
|
+ const [fields, {onChange, resetState}] = useFilterField(
|
|
|
+ {
|
|
|
+ warehouseTransferCode: '',
|
|
|
+ startTime: '',
|
|
|
+ endTime: '',
|
|
|
+ materialName: '',
|
|
|
+ askGoodsWarehouseaId: '',
|
|
|
+ supplyWarehouseId: '',
|
|
|
+ wbs: '',
|
|
|
+ entryNumber: '',
|
|
|
+ warehouseTransferType: '',
|
|
|
+ materialCode: '',
|
|
|
+ companyCode: '',
|
|
|
+ },
|
|
|
+ true,
|
|
|
+ );
|
|
|
const [{dates, start, end}, onDatesChange] = useRangeDate();
|
|
|
- const {warehouseTransferCode, materialCode, materialName, type} = fields;
|
|
|
- const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
|
|
|
- const onSearch = useTableSearchEvent(context, {...fields, startTime: start, endTime: end});
|
|
|
- const [isExporting, onExport] = useTableExportEvent({
|
|
|
- pageContext,
|
|
|
- fn: exportRelocationOrderList,
|
|
|
+ const {isSearching} = useContextSection(searchContext, state => state[0]);
|
|
|
+ const [visible, {onShowModal, onCloseModal, onReset, onSearch}] = useTableSearchToolEvents(
|
|
|
context,
|
|
|
- });
|
|
|
+ {...fields, startTime: start, endTime: end},
|
|
|
+ {
|
|
|
+ resetCallback() {
|
|
|
+ resetState();
|
|
|
+ onDatesChange([null, null]);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ );
|
|
|
+ const [filterList, {set}] = useFilterDB();
|
|
|
|
|
|
return (
|
|
|
- <Card>
|
|
|
- <FilterFieldWrapper onSearch={onSearch}>
|
|
|
- <FilterField
|
|
|
- name='relocationCode'
|
|
|
- label='移库单编号'
|
|
|
- value={warehouseTransferCode}
|
|
|
- onChange={onChange('warehouseTransferCode')}
|
|
|
- />
|
|
|
- <FilterField
|
|
|
- name='materialName'
|
|
|
- label='物料名称'
|
|
|
- value={materialName}
|
|
|
- onChange={onChange('materialName')}
|
|
|
- />
|
|
|
- <FilterField
|
|
|
- name='materialName'
|
|
|
- label='物料编号'
|
|
|
- value={materialCode}
|
|
|
- onChange={onChange('materialCode')}
|
|
|
- />
|
|
|
- <FilterSelect
|
|
|
- name='type'
|
|
|
- label='移库状态'
|
|
|
- value={type}
|
|
|
- onChange={onChange('type')}
|
|
|
- options={options}
|
|
|
- />
|
|
|
- <FilterDatePicker
|
|
|
- value={dates}
|
|
|
- label='单据日期'
|
|
|
- name='relocationDates'
|
|
|
- onChange={onDatesChange}
|
|
|
- />
|
|
|
- <FilterButtonGroup
|
|
|
+ <>
|
|
|
+ <Card>
|
|
|
+ <FilterTool
|
|
|
onSearch={onSearch}
|
|
|
+ onReset={onReset}
|
|
|
isSearching={isSearching}
|
|
|
- onExport={onExport}
|
|
|
- isExporting={isExporting}
|
|
|
- onRefresh={refetch}
|
|
|
+ onChange={onChange}
|
|
|
+ onDatesChange={onDatesChange}
|
|
|
+ fields={fields}
|
|
|
+ dates={dates}
|
|
|
+ sourceMap={sourceMap}
|
|
|
+ fixedMap={fixedMap}
|
|
|
+ onFilter={onShowModal}
|
|
|
+ filterData={filterList}
|
|
|
/>
|
|
|
- </FilterFieldWrapper>
|
|
|
- </Card>
|
|
|
+ </Card>
|
|
|
+
|
|
|
+ <FilterSelectorModal
|
|
|
+ visible={visible}
|
|
|
+ onClose={onCloseModal}
|
|
|
+ onConfirm={set}
|
|
|
+ filtermap={sourceMap}
|
|
|
+ source={filterList}
|
|
|
+ />
|
|
|
+ </>
|
|
|
);
|
|
|
};
|
|
|
|