合并代码
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Table } from 'antd';
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
import { coscoSupplier } from '../services';
|
||||
import { coscoSupplierBase } from '../services';
|
||||
import { useIntl } from 'umi';
|
||||
|
||||
// 联系人信息接口
|
||||
@ -27,20 +27,29 @@ const ContactsInfoTab: React.FC = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const fetchContacts = async (page: number = 1, pageSize: number = 10) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await coscoSupplier(page);
|
||||
if (res.code === 200) {
|
||||
setData(res.contacts || []);
|
||||
setPagination({
|
||||
current: page,
|
||||
pageSize,
|
||||
total: res.totalContacts || (res.contacts?.length || 0),
|
||||
});
|
||||
|
||||
coscoSupplierBase().then((res) => {
|
||||
if(res.code == 200) {
|
||||
setData([res.data.coscoSupplierBase])
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
// setLoading(true);
|
||||
// try {
|
||||
// const res = await coscoSupplier(page);
|
||||
// if (res.code === 200) {
|
||||
// setData(res.contacts || []);
|
||||
// setPagination({
|
||||
// current: page,
|
||||
// pageSize,
|
||||
// total: res.totalContacts || (res.contacts?.length || 0),
|
||||
// });
|
||||
// }
|
||||
// } finally {
|
||||
// setLoading(false);
|
||||
// }
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@ -56,45 +65,25 @@ const ContactsInfoTab: React.FC = () => {
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.index' }),
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 60,
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, index: number) =>
|
||||
(pagination.current! - 1) * pagination.pageSize! + index + 1,
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.name' }),
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
title: '联系人',
|
||||
dataIndex: 'contactsName',
|
||||
key: 'contactsName',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.department' }),
|
||||
dataIndex: 'department',
|
||||
key: 'department',
|
||||
title: '手机号',
|
||||
dataIndex: 'contactsPhone',
|
||||
key: 'contactsPhone',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.position' }),
|
||||
dataIndex: 'position',
|
||||
key: 'position',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.mobile' }),
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.phone' }),
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.email' }),
|
||||
dataIndex: 'email',
|
||||
key: 'email',
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'page.workbench.contacts.updateTime' }),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
title: '邮箱',
|
||||
dataIndex: 'contactsEmail',
|
||||
key: 'contactsEmail',
|
||||
},
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user