index.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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, isLoading}, {onSubmit}] = useFormState();
  12. const options = useDictionaryOptions(
  13. '物料字典',
  14. false,
  15. state => state.code,
  16. );
  17. const locationOptions = useStorageOptions(
  18. false,
  19. state => state.storageLocationCode,
  20. );
  21. return (
  22. <section className='content-main'>
  23. <Card title={type === 'in' ? '其他入库' : '其他出库'}>
  24. <form onSubmit={onSubmit}>
  25. <Space direction='vertical'>
  26. <Select
  27. control={control}
  28. label='物料'
  29. name='materialCode'
  30. data={options}
  31. />
  32. <Select
  33. control={control}
  34. label='所在库位'
  35. name='locationCode'
  36. data={locationOptions}
  37. />
  38. <Field
  39. control={control}
  40. label={type === 'in' ? '入库数量' : '出库数量'}
  41. name='operationNum'
  42. type='number'
  43. />
  44. <Field
  45. control={control}
  46. label='wbs编号'
  47. name='wbsCode'
  48. required={false}
  49. />
  50. <ModalBtnGroup isLoading={isLoading} />
  51. </Space>
  52. </form>
  53. </Card>
  54. </section>
  55. );
  56. };
  57. export default StockOperation;