import React, { useState, SetStateAction } from 'react'; import Modal from 'antd/lib/modal/Modal'; import { Input } from 'antd'; import Form, { FormInstance } from 'antd/lib/form/Form'; import FormItem from 'antd/lib/form/FormItem'; import { trailwayAddUser } from '../../service'; type AddUserState = { isShow: boolean; }; type AddUserProps = { onSuccess: () => void; showAddUser?: () => void; }; class AddUser extends React.Component { private formRef = React.createRef(); constructor(props: AddUserProps) { super(props); this.state = { isShow: false, }; } handleOk = () => { this.formRef.current?.submit(); }; handleCancel = () => { this.switchShow(); }; switchShow = () => { this.setState((state) => ({ isShow: !state.isShow, })); }; handleFinish = (values: any) => { trailwayAddUser(values).then((resp: any) => { if (resp.code == 200) { this.switchShow(); this.props.onSuccess(); } }); }; render() { return (
); } } export default AddUser;