import {FilterButtonGroup, FilterField} from '@components';
import {Card, Row} from 'antd';
import {FC} from 'react';
import {useField, useHandle} from './hooks';

const Filter: FC = function() {
  const [{name, code}, onChange] = useField();
  const {onSearch, onExport} = useHandle(name, code);

  return (
    <Card>
      <Row>
        <FilterField name='departmentCode' label='部门编号' value={code} onChange={onChange('code')} />
        <FilterField name='departmentName' label='部门名称' value={name} onChange={onChange('name')} />
        <FilterButtonGroup onSearch={onSearch} onExport={onExport} offset={6} />
      </Row>
    </Card>
  );
};

export default Filter;
