123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { Input, Card, Select, Button, message } from "antd"
  2. import { useEffect, useState } from 'react'
  3. import { Form } from "antd";
  4. import { history } from 'umi';
  5. import ProCard from '@ant-design/pro-card'
  6. const { Option } = Select
  7. const goBack = () => {
  8. history.goBack()
  9. }
  10. const FormItem = Form.Item
  11. export default (props) => {
  12. const [form] = Form.useForm()
  13. const [loading, setLoading] = useState(false)
  14. const formItemLayout = {
  15. //布局
  16. labelCol: { span: 6 },
  17. wrapperCol: { span: 14 },
  18. };
  19. const Submit = values => {
  20. console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
  21. };
  22. return (
  23. <Card >
  24. <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}
  25. >
  26. <ProCard.TabPane key={1} tab="人员管理">
  27. <Form {...formItemLayout} onFinish={Submit} form={form} >
  28. <FormItem label="账号" name="shopName" rules={[{ required: true, message: '请输入' }]}>
  29. <Input placeholder="请输入" style={{ width: '350px' }} />
  30. </FormItem>
  31. <FormItem label="姓名" name="title" rules={[{ required: true, message: '请输入' }]}>
  32. <Input placeholder="请输入" style={{ width: '350px' }} />
  33. </FormItem>
  34. <FormItem label="邮箱" name="phone" rules={[{ required: true, message: '邮箱格式不正确或内容为空', pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ }]}>
  35. <Input placeholder="请输入" style={{ width: '350px' }} />
  36. </FormItem>
  37. <FormItem label="角色" name="user" rules={[{ required: true, message: '请选择' }]}>
  38. <Select
  39. placeholder="请选择方式"
  40. // onChange={onGenderChange}
  41. allowClear
  42. style={{ width: '350px' }}
  43. >
  44. <Option value="nongji">农机手</Option>
  45. <Option value="nonghu">农户</Option>
  46. </Select>
  47. </FormItem>
  48. <FormItem label="状态" name="stry" rules={[{ required: true, message: '请选择', }]} >
  49. <Select
  50. placeholder="请选择方式"
  51. // onChange={onGenderChange}
  52. allowClear
  53. style={{ width: '350px' }}
  54. >
  55. <Option value="0">启用</Option>
  56. <Option value="1">禁用</Option>
  57. </Select>
  58. </FormItem>
  59. <FormItem label=" " colon={false} >
  60. <Button type='default' onClick={() => goBack()} >返回</Button>
  61. <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
  62. </FormItem>
  63. </Form>
  64. </ProCard.TabPane>
  65. </ProCard>
  66. </Card>
  67. )
  68. }