This commit is contained in:
2024-01-15 00:40:52 +08:00
parent deb5a2ea11
commit 5f5268d3ec
4 changed files with 26 additions and 40 deletions

View File

@@ -9,10 +9,15 @@ type AddUserState = {
isShow: boolean;
};
class AddUser extends React.Component<{}, AddUserState> {
type AddUserProps = {
onSuccess: () => void;
showAddUser?: () => void;
};
class AddUser extends React.Component<AddUserProps, AddUserState> {
private formRef = React.createRef<FormInstance>();
constructor(props: {}) {
constructor(props: AddUserProps) {
super(props);
this.state = {
isShow: false,
@@ -20,13 +25,19 @@ class AddUser extends React.Component<{}, AddUserState> {
}
handleOk = () => {
console.log(this.formRef.current?.submit());
this.formRef.current?.submit();
this.props.onSuccess();
};
switchShow = () => {
this.setState((state) => ({
isShow: !state.isShow,
}));
this.setState(
(state) => ({
isShow: !state.isShow,
}),
() => {
this.props.showAddUser && this.props.showAddUser();
}
);
};
handleFinish = (values: any) => {