index.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {Card, Space} from 'antd';
  2. import {FC} from 'react';
  3. import {useParams} from 'react-router-dom';
  4. import {useFormState} from './hooks';
  5. import Field from './field';
  6. import {ModalBtnGroup} from '@components';
  7. import Select from './select';
  8. import {useDictionaryOptions, useStorageOptions} from '@hooks';
  9. const StockOperation: FC = function() {
  10. const {type} = useParams<{type: 'in' | 'out'}>();
  11. const [{control}, {onSubmit}] = useFormState();
  12. const options = useDictionaryOptions('物料字典');
  13. const locationOptions = useStorageOptions();
  14. return (
  15. <section className='content-main'>
  16. <Card title={type === 'in' ? '其他入库' : '其他出库'}>
  17. <form onSubmit={onSubmit}>
  18. <Space direction='vertical'>
  19. <Select
  20. control={control}
  21. label='物料'
  22. name='materialCode'
  23. data={options}
  24. />
  25. <Select
  26. control={control}
  27. label='所在仓库'
  28. name='locationCode'
  29. data={locationOptions}
  30. />
  31. <Field
  32. control={control}
  33. label={type === 'in' ? '入库数量' : '出库数量'}
  34. name='operationNum'
  35. type='number'
  36. />
  37. <Field
  38. control={control}
  39. label='wbs编号'
  40. name='wbsCode'
  41. required={false}
  42. />
  43. <ModalBtnGroup />
  44. </Space>
  45. </form>
  46. </Card>
  47. </section>
  48. );
  49. };
  50. export default StockOperation;