import React, { useEffect, useState } from 'react'; import { Table } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; import { coscoSupplierBase } from '../services'; import { useIntl } from 'umi'; // 联系人信息接口 interface Contact { id: string; name: string; department: string; position: string; mobile: string; phone: string; email: string; updateTime: string; } interface Props { viewType?: boolean; record?: string; } const ContactsInfoTab: React.FC = (props) => { const { viewType = false, record = '' } = props; const intl = useIntl(); const [data, setData] = useState([]); const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0, }); const [loading, setLoading] = useState(false); const fetchContacts = async (page: number = 1, pageSize: number = 10) => { coscoSupplierBase(record).then((res) => { if(res.code == 200) { setData([res.data.coscoSupplierBase]) } }) }; useEffect(() => { fetchContacts(); }, []); const handleTableChange = (pagination: TablePaginationConfig) => { fetchContacts(pagination.current!, pagination.pageSize!); }; const columns: ColumnsType = [ { title: intl.formatMessage({ id: 'page.workbench.contacts.index' }), dataIndex: 'index', key: 'index', width: 80, align: 'center', render: (_: any, __: any, index: number) => (pagination.current! - 1) * pagination.pageSize! + index + 1, }, { title: '联系人', dataIndex: 'contactsName', key: 'contactsName', }, { title: '手机号', dataIndex: 'contactsPhone', key: 'contactsPhone', }, { title: '邮箱', dataIndex: 'contactsEmail', key: 'contactsEmail', }, ]; return (
); }; export default ContactsInfoTab;