带录入
This commit is contained in:
@ -5,10 +5,17 @@ import { Form, Button, message, Radio, Checkbox, Modal, Spin } from 'antd';
|
||||
import { HomeOutlined } from '@ant-design/icons';
|
||||
import DomesticForm from './supplier/DomesticForm';
|
||||
import ForeignForm from './supplier/ForeignForm';
|
||||
import { coscoSupplierBaseAdd, fetchSurveyQuestions } from '@/servers/api/register';
|
||||
import { addAgent, coscoSupplierBaseAdd, fetchSurveyQuestions } from '@/servers/api/register';
|
||||
import './register.less';
|
||||
|
||||
const SupplierRegister: React.FC = () => {
|
||||
interface supplierWithInputProps {
|
||||
supplierWithInput?: Boolean;
|
||||
exitId?: string;
|
||||
onOk?: () => void;
|
||||
}
|
||||
|
||||
const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
||||
const { supplierWithInput = false, exitId = '', onOk } = props;
|
||||
const [form] = Form.useForm();
|
||||
const intl = useIntl();
|
||||
const [supplierType, setSupplierType] = useState<string>('dvs');
|
||||
@ -20,6 +27,10 @@ const SupplierRegister: React.FC = () => {
|
||||
|
||||
// 获取问卷列表
|
||||
useEffect(() => {
|
||||
//供应商带录入
|
||||
if (supplierWithInput) {
|
||||
|
||||
}
|
||||
const fetchQuestions = async () => {
|
||||
setFetchingQuestions(true);
|
||||
try {
|
||||
@ -71,12 +82,17 @@ const SupplierRegister: React.FC = () => {
|
||||
|
||||
console.log('供应商注册信息:', values);
|
||||
|
||||
// 直接调用API
|
||||
const response = await coscoSupplierBaseAdd(values);
|
||||
// 直接调用API supplierWithInput === true 供应商注册代录 否则 注册
|
||||
const response = await (supplierWithInput? addAgent(values) : coscoSupplierBaseAdd(values));
|
||||
|
||||
if (response.success) {
|
||||
message.success('注册成功,请登录');
|
||||
history.push('/login');
|
||||
if(!supplierWithInput) {
|
||||
message.success('注册成功,请登录');
|
||||
history.push('/login');
|
||||
} else {
|
||||
message.success(`${exitId? '修改成功': '注册成功'}`);
|
||||
onOk;
|
||||
}
|
||||
} else {
|
||||
message.error(response.message || '注册失败,请重试');
|
||||
}
|
||||
@ -94,17 +110,22 @@ const SupplierRegister: React.FC = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="register-page ">
|
||||
<div className={`register-page ${supplierWithInput ? ' on' : ''}`}>
|
||||
<div className="register-container large-width">
|
||||
<div className="back-home">
|
||||
<a onClick={() => history.push('/index')}>
|
||||
<HomeOutlined /> {intl.formatMessage({ id: 'login.back.home' })}
|
||||
</a>
|
||||
</div>
|
||||
{!supplierWithInput && (
|
||||
<>
|
||||
<div className="back-home">
|
||||
<a onClick={() => history.push('/index')}>
|
||||
<HomeOutlined /> {intl.formatMessage({ id: 'login.back.home' })}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="register-title">
|
||||
{intl.formatMessage({ id: 'register.supplier.title' })}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="register-title">
|
||||
{intl.formatMessage({ id: 'register.supplier.title' })}
|
||||
</div>
|
||||
|
||||
<Spin spinning={fetchingQuestions}>
|
||||
<Form
|
||||
@ -195,7 +216,7 @@ const SupplierRegister: React.FC = () => {
|
||||
okText="我知道了"
|
||||
cancelButtonProps={{ style: { display: 'none' } }}
|
||||
destroyOnClose
|
||||
// maskClosable={false}
|
||||
// maskClosable={false}
|
||||
>
|
||||
<div style={{ maxHeight: '60vh', overflow: 'auto' }}>
|
||||
<p>尊敬的用户:</p>
|
||||
|
Reference in New Issue
Block a user