import React, { useEffect, useState } from "react"; import { useIntl } from 'umi'; import { Form, Button, Table, Select, Space, Input } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; import { SearchOutlined } from '@ant-design/icons'; import { getPage } from './services'; //查看评审结果 弹窗 import ResultModal from './components/ResultModal'; interface Data { deptName: string; categoryName: string; createTime: string; exitTime: string; exitReason: string; } interface ModalInfo { type: 'view' | 'result' | null; visible: boolean; record: Data | null; } const CooperateEnterprise: React.FC = () => { const [searchForm] = Form.useForm(); const intl = useIntl(); const [data, setData] = useState([]); const [loading, setLoading] = useState(false); const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); const [modalInfo, setModalInfo] = useState({ type: null, visible: false, record: null }); const openModal = (type: 'view' | 'result', record: Data) => { setModalInfo({ type, visible: true, record }); }; const closeModal = () => { setModalInfo({ type: null, visible: false, record: null }); }; // 列表数据 const getList = async (params: { pageNo: number; pageSize: number; parentCode: string; }) => { setLoading(true); try { const { code, data } = await getPage(params); if (code === 200) { setData(data.records); setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total }); } } catch (error) { console.error('Failed to fetch data:', error); } finally { setLoading(false); } }; const handleReset = () => { searchForm.resetFields(); getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10, parentCode: '' }); }; const handleSearch = (values: any) => { const { parentCode } = values; getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10, parentCode: parentCode || '' }); }; useEffect(() => { getList({ pageNo: 1, pageSize: 10, parentCode: '' }); }, []); const columns: ColumnsType = [ { title: '序号', dataIndex: 'index', key: 'index', width: 80, align: 'center', render: (_: any, __: any, index: number) => index + 1, }, { title: '准入工作', dataIndex: 'accessWorkName', key: 'accessWorkName', }, { title: '发起单位', dataIndex: 'deptId', key: 'deptId', }, { title: '准入部门', dataIndex: 'deptId', key: 'deptId', }, { title: '品类', dataIndex: 'exitTime', key: 'exitTime', }, { title: '准入方式', dataIndex: 'accessTypeText', key: 'accessTypeText', }, { title: '评审时间', dataIndex: 'createTime', key: 'createTime', }, { title: '评审状态', dataIndex: 'reviewStatusText', key: 'reviewStatusText', }, { title: '操作', render: (_: any, record: any) => ( openModal('result', record)}>审核 ), }, ]; return ( <>
getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, parentCode: '', })} /> ); }; export default CooperateEnterprise;