import React, { PureComponent } from 'react'; import { Modal, Form, Input, Select, InputNumber, Row, Col, message } from 'antd'; import { UserOutlined, PhoneOutlined, TeamOutlined, ApartmentOutlined } from '@ant-design/icons'; const { Option } = Select; class PerformanceAdd extends PureComponent { constructor(props) { super(props); this.formRef = React.createRef(); } // 提交表单 handleSubmit = (values) => { console.log('新增人员信息:', values); // 这里可以调用API接口保存数据 // 模拟保存成功 message.success('新增人员成功!'); // 重置表单 this.formRef.current?.resetFields(); // 调用父组件的回调函数 if (this.props.onSuccess) { this.props.onSuccess(values); } // 关闭弹窗 this.handleCancel(); }; // 取消操作 handleCancel = () => { // 重置表单 this.formRef.current?.resetFields(); // 调用父组件的关闭回调 if (this.props.onCancel) { this.props.onCancel(); } }; render() { const { visible, loading = false } = this.props; return ( this.formRef.current?.submit()} onCancel={this.handleCancel} width={600} confirmLoading={loading} destroyOnClose={true} maskClosable={false} >
} /> } maxLength={11} />
); } } export default PerformanceAdd;