登录 个人 与 零星采购
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Tabs } from 'antd';
|
||||
import { useIntl } from 'umi';
|
||||
import BaseInfoTab from './component/BaseInfoTab';
|
||||
@ -7,6 +7,9 @@ import InvoiceTab from './component/InvoiceTab';
|
||||
import AttachmentsTab from './component/AttachmentsTab';
|
||||
import ContactsInfoTab from './component/ContactsInfoTab';
|
||||
import BankInfoTab from './component/BankInfoTab';
|
||||
import PeBaseInfoTab from './component/PeBaseInfoTab';
|
||||
|
||||
import { coscoSupplierBase } from './services'
|
||||
|
||||
interface CompanyInfoProps {
|
||||
viewType?: boolean;
|
||||
@ -16,31 +19,53 @@ interface CompanyInfoProps {
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
const CompanyInfo: React.FC<CompanyInfoProps> = (props) => {
|
||||
const { viewType = false, record = '999698' } = props;
|
||||
const { viewType = false, record = '' } = props;
|
||||
const intl = useIntl();
|
||||
// 切换tab
|
||||
const [subTab, setSubTab] = useState<string>('base');
|
||||
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])
|
||||
|
||||
return (
|
||||
<Tabs activeKey={subTab} onChange={setSubTab}>
|
||||
<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>
|
||||
{subTab === 'pe' ? (
|
||||
<TabPane tab={intl.formatMessage({ id: 'page.workbench.base' })} key="pe">
|
||||
<PeBaseInfoTab viewType={viewType} record={record} />
|
||||
</TabPane>
|
||||
) : (
|
||||
<>
|
||||
<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>
|
||||
</>
|
||||
)}
|
||||
|
||||
</Tabs>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user