import React, { useRef, useState } from 'react'; import { useAccess } from '@umijs/max'; import { Button, message, Modal, Tag } from 'antd'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { ExportOutlined, EyeOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons'; import { getCompanyReviewList, batchApproveCompany, batchRejectCompany } from '@/services/jobportal/indoorJobFair'; import type { CompanyReviewItem } from '@/services/jobportal/indoorJobFair'; interface Props { fairId: number; } const CompanyReviewTab: React.FC = () => { const access = useAccess(); const actionRef = useRef(); const [selectedRowKeys, setSelectedRowKeys] = useState([]); const statusMap: Record = { pending: { text: '待审核', color: 'default' }, approved: { text: '已通过', color: 'green' }, rejected: { text: '已拒绝', color: 'red' }, }; const handleBatchApprove = async () => { if (selectedRowKeys.length === 0) { message.warning('请先选择要审核的数据'); return; } const res = await batchApproveCompany(selectedRowKeys as number[]); if (res.code === 200) { message.success('批量审核成功'); setSelectedRowKeys([]); actionRef.current?.reload(); } else { message.error(res.msg); } }; const handleBatchReject = async () => { if (selectedRowKeys.length === 0) { message.warning('请先选择要审核的数据'); return; } const res = await batchRejectCompany(selectedRowKeys as number[]); if (res.code === 200) { message.success('批量审核失败'); setSelectedRowKeys([]); actionRef.current?.reload(); } else { message.error(res.msg); } }; const handleExport = async (type: string) => { if (type === 'selected' && selectedRowKeys.length === 0) { message.warning('请先选择要导出的数据'); return; } message.success(`已导出${type === 'selected' ? '选中' : type === 'page' ? '当前页' : '全部'}数据(模拟)`); }; const columns: ProColumns[] = [ { title: '招聘会名称', dataIndex: 'fairName', ellipsis: true, hideInSearch: true }, { title: '招聘会名称', dataIndex: 'fairName', hideInTable: true, order: 1, }, { title: '单位名称', dataIndex: 'companyName', order: 2, }, { title: '单位名称', dataIndex: 'companyName', ellipsis: true, hideInSearch: true }, { title: '行业', dataIndex: 'industry', width: 100, hideInSearch: true }, { title: '规模', dataIndex: 'scale', width: 100, hideInSearch: true }, { title: '联系人', dataIndex: 'contactPerson', width: 100, hideInSearch: true }, { title: '联系电话', dataIndex: 'contactPhone', width: 130, hideInSearch: true }, { title: '审核状态', dataIndex: 'reviewStatus', valueType: 'select', width: 100, hideInSearch: true, render: (_, record) => { const s = statusMap[record.reviewStatus] || { text: record.reviewStatus, color: 'default' }; return {s.text}; }, }, { title: '操作', valueType: 'option', width: 150, render: (_, record) => [ , , ], }, ]; return (
{ const res = await getCompanyReviewList({ current: params.current, pageSize: params.pageSize, fairName: params.fairName, companyName: params.companyName, reviewStatus: params.reviewStatus, }); return { data: res.rows, total: res.total, success: true }; }} toolBarRender={() => [ , , , , , ]} />
); }; export default CompanyReviewTab;