2025-11-21 04:32:08 +08:00
|
|
|
import { useNavigate } from 'react-router-dom'
|
2025-12-23 00:56:04 +08:00
|
|
|
import { Card, Form, Button, Typography } from 'antd'
|
2025-11-21 04:32:08 +08:00
|
|
|
import { ArrowLeftOutlined } from '@ant-design/icons'
|
2025-12-07 05:07:58 +08:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2025-12-23 00:56:04 +08:00
|
|
|
import { message } from 'antd'
|
|
|
|
|
import LeaderAddForm from '../components/LeaderAddForm'
|
2025-11-21 04:32:08 +08:00
|
|
|
|
|
|
|
|
const { Title } = Typography
|
|
|
|
|
|
|
|
|
|
const LeaderAdd: React.FC = () => {
|
2025-12-07 05:07:58 +08:00
|
|
|
const { t } = useTranslation()
|
2025-11-21 04:32:08 +08:00
|
|
|
const navigate = useNavigate()
|
|
|
|
|
const [form] = Form.useForm()
|
|
|
|
|
|
2025-12-23 00:56:04 +08:00
|
|
|
const handleSuccess = async () => {
|
|
|
|
|
message.success(t('leaderAdd.addSuccess') || '添加 Leader 成功')
|
|
|
|
|
navigate('/leaders')
|
2025-11-21 04:32:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<div style={{ marginBottom: '16px' }}>
|
|
|
|
|
<Button
|
|
|
|
|
icon={<ArrowLeftOutlined />}
|
|
|
|
|
onClick={() => navigate('/leaders')}
|
|
|
|
|
style={{ marginBottom: '16px' }}
|
|
|
|
|
>
|
2025-12-23 00:56:04 +08:00
|
|
|
{t('leaderAdd.back') || '返回'}
|
2025-11-21 04:32:08 +08:00
|
|
|
</Button>
|
2025-12-07 05:07:58 +08:00
|
|
|
<Title level={2} style={{ margin: 0 }}>{t('leaderAdd.title') || '添加 Leader'}</Title>
|
2025-11-21 04:32:08 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Card>
|
2025-12-23 00:56:04 +08:00
|
|
|
<LeaderAddForm
|
2025-11-21 04:32:08 +08:00
|
|
|
form={form}
|
2025-12-23 00:56:04 +08:00
|
|
|
onSuccess={handleSuccess}
|
|
|
|
|
onCancel={() => navigate('/leaders')}
|
|
|
|
|
showCancelButton={true}
|
|
|
|
|
/>
|
2025-11-21 04:32:08 +08:00
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default LeaderAdd
|
|
|
|
|
|