forgeplus-react/src/forge/Team/New.jsx

57 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React,{ forwardRef , useCallback } from 'react';
import './Index.scss';
import { Form , Input , Cascader } from "antd";
import { locData } from "../Utils/locData";
export default Form.create()(
forwardRef(({form})=>{
const { getFieldDecorator, validateFields, setFieldsValue } = form;
const helper = useCallback(
(label, name, rules, widget, isRequired = true) => (
<React.Fragment>
<span className={isRequired?"lables must":"lables"}>{label}</span>
<Form.Item>
{getFieldDecorator(name, { rules, validateFirst: true })(widget)}
</Form.Item>
</React.Fragment>
),
[]
);
return(
<div className="newMain">
<div className="main">
<div className="teamBox">
<p className="teamBox-title">新建组织</p>
<Form className="teamBox-form">
{helper(
<span>组织名称<span className="color-grey-8">(组织名称应该简单明了)</span></span>,
"name",
[{ required: true, message: "请输入组织名称" }],
<Input
placeholder="请输入组织名称"
/>
)}
{helper(
'组织描述',
"desc",
[{ required: true, message: "请输入组织描述" }],
<Input.TextArea
autoSize={{ minRows: 3, maxRows: 5 }}
placeholder="请输入组织描述"
/>
)}
{helper(
'所在地区',
"area",
[],
<Cascader placeholder="请选择城市" options={locData}/>
)}
</Form>
</div>
</div>
</div>
)
})
)