合并代码
This commit is contained in:
@ -1,21 +1,79 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Descriptions } from 'antd';
|
||||
import { Descriptions, Button } from 'antd';
|
||||
import { coscoSupplierBase } from '../services';
|
||||
import { useIntl } from 'umi';
|
||||
import BaseInfoFormModal from './BaseInfoFormModal'
|
||||
|
||||
|
||||
export interface Request {
|
||||
capital: string;
|
||||
contactsEmail: string;
|
||||
contactsName: string;
|
||||
contactsPhone: string;
|
||||
contactsType: string;
|
||||
enterpriseType: string;
|
||||
id: string;
|
||||
idCard: string;
|
||||
legalPerson: string;
|
||||
licenceAccessory: string;
|
||||
licenceDate: string;
|
||||
name: string;
|
||||
nameEn: string;
|
||||
parentCompanyInvestor: string;
|
||||
range: string;
|
||||
regAddress: string;
|
||||
socialCreditCode: string;
|
||||
telephone: string;
|
||||
workAddress: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
interface changeDataValueProps {
|
||||
id?:string;
|
||||
title?:string;
|
||||
changeDesc?:string;
|
||||
coscoSupplierSurveyAttachments?:coscoSupplierSurveyAttachments[];
|
||||
}
|
||||
interface coscoSupplierSurveyAttachments {
|
||||
attachmentsType: string;
|
||||
fileName: string;
|
||||
fileType: string;
|
||||
fileSize: string;
|
||||
filePath: string;
|
||||
fileUrl: string;
|
||||
}
|
||||
|
||||
const BaseInfoTab: React.FC = () => {
|
||||
interface BaseInfoTabProps {
|
||||
viewType?:boolean;
|
||||
}
|
||||
|
||||
const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
|
||||
const { viewType = false } = props;
|
||||
const intl = useIntl();
|
||||
const [registerInfo, setRegisterInfo] = useState<any>();
|
||||
|
||||
const [registerInfo, setRegisterInfo] = useState<Request>();
|
||||
//变更说明与附件
|
||||
const [changeDataValue, setChangeDataValue] = useState<changeDataValueProps>();
|
||||
const fetchData = async () => {
|
||||
const res = await coscoSupplierBase();
|
||||
const res = await coscoSupplierBase();
|
||||
if (res.code === 200) {
|
||||
setRegisterInfo(res.data);
|
||||
setChangeDataValue({
|
||||
title: res.data.title,
|
||||
changeDesc: res.data.changeDesc,
|
||||
coscoSupplierSurveyAttachments: res.data.coscoSupplierSurveyAttachments,
|
||||
})
|
||||
}
|
||||
};
|
||||
//增改查
|
||||
const [formVisible, setFormVisible] = useState(false);
|
||||
const handleAdd = () => {
|
||||
setFormVisible(true);
|
||||
};
|
||||
const handleFormSubmit = () => {
|
||||
setFormVisible(false);
|
||||
fetchData();
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
//供应商信息
|
||||
fetchData()
|
||||
@ -25,6 +83,10 @@ const BaseInfoTab: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div style={{ padding: '0 30px 0 0' }}>
|
||||
|
||||
{ !viewType && (
|
||||
<Button type="primary" onClick={handleAdd}>修改</Button>
|
||||
)}
|
||||
<Descriptions
|
||||
bordered
|
||||
column={2}
|
||||
@ -101,6 +163,13 @@ const BaseInfoTab: React.FC = () => {
|
||||
{registerInfo.coscoSupplierBase.telephone}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<BaseInfoFormModal
|
||||
visible={formVisible}
|
||||
onOk={handleFormSubmit}
|
||||
onCancel={() => setFormVisible(false)}
|
||||
initialValues={registerInfo.coscoSupplierBase || undefined}
|
||||
changeData={changeDataValue}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user