Files
fe_supplier_frontend/src/components/CompanyInfo/index.tsx

76 lines
2.6 KiB
TypeScript
Raw Normal View History

2025-07-09 14:01:45 +08:00
import React, { useState, useEffect } from 'react';
2025-06-24 10:52:30 +08:00
import { Tabs } from 'antd';
import { useIntl } from 'umi';
import BaseInfoTab from './component/BaseInfoTab';
import QualificationTab from './component/QualificationTab';
import InvoiceTab from './component/InvoiceTab';
2025-07-02 16:18:03 +08:00
import AttachmentsTab from './component/AttachmentsTab';
2025-06-24 10:52:30 +08:00
import ContactsInfoTab from './component/ContactsInfoTab';
import BankInfoTab from './component/BankInfoTab';
2025-07-09 14:01:45 +08:00
import PeBaseInfoTab from './component/PeBaseInfoTab';
import { coscoSupplierBase } from './services'
2025-06-24 10:52:30 +08:00
2025-07-02 16:18:03 +08:00
interface CompanyInfoProps {
viewType?: boolean;
2025-07-03 10:24:33 +08:00
record?: string;
2025-07-02 16:18:03 +08:00
}
2025-06-24 10:52:30 +08:00
const { TabPane } = Tabs;
2025-07-02 16:18:03 +08:00
const CompanyInfo: React.FC<CompanyInfoProps> = (props) => {
const userId = sessionStorage.getItem('userId') || '';
const { viewType = false, record = userId } = props;
2025-06-24 10:52:30 +08:00
const intl = useIntl();
// 切换tab
2025-07-09 14:01:45 +08:00
const [subTab, setSubTab] = useState<string>('');
useEffect(() => {
coscoSupplierBase(record).then((res) => {
if (res.code === 200) {
if (res.data.coscoSupplierBase.supplierType === 'pe') {
setSubTab('pe')
} else {
setSubTab('base')
}
}
})
}, [record])
2025-06-24 10:52:30 +08:00
return (
<Tabs activeKey={subTab} onChange={setSubTab}>
2025-07-09 14:01:45 +08:00
{subTab === 'pe' ? (
<TabPane tab={intl.formatMessage({ id: 'page.workbench.base' })} key="pe">
<PeBaseInfoTab viewType={viewType} record={record} />
</TabPane>
2025-07-09 16:34:10 +08:00
) : subTab ?(
2025-07-09 14:01:45 +08:00
<>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.base' })} key="base">
<BaseInfoTab viewType={viewType} record={record} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.qualification' })} key="qualification">
<QualificationTab viewType={viewType} record={record} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.invoice' })} key="invoice">
<InvoiceTab viewType={viewType} record={record} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.bank' })} key="bank">
<BankInfoTab viewType={viewType} record={record} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.attachments' })} key="attachments">
<AttachmentsTab viewType={viewType} record={record} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'page.workbench.contacts' })} key="contacts">
<ContactsInfoTab viewType={viewType} record={record} />
</TabPane>
</>
2025-07-09 16:34:10 +08:00
):(
<div></div>
2025-07-09 14:01:45 +08:00
)}
2025-06-24 10:52:30 +08:00
</Tabs>
);
};
export default CompanyInfo;