2025-06-24 10:52:30 +08:00
|
|
|
import React, { useEffect, useState } from "react";
|
2025-06-24 11:08:51 +08:00
|
|
|
import { useIntl } from 'umi';
|
2025-06-24 16:48:10 +08:00
|
|
|
import { Form, Button, Table, Space, Input } from 'antd';
|
2025-06-24 10:52:30 +08:00
|
|
|
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
|
|
|
import { SearchOutlined } from '@ant-design/icons';
|
|
|
|
import { getPage } from './services';
|
|
|
|
//查看评审结果 弹窗
|
|
|
|
import ResultModal from './components/ResultModal';
|
2025-06-24 16:48:10 +08:00
|
|
|
import GroupLeaderModal from './components/GroupLeaderModal';
|
2025-06-27 10:41:33 +08:00
|
|
|
import ViewModal from './components/ViewModal';
|
2025-06-24 10:52:30 +08:00
|
|
|
|
|
|
|
interface Data {
|
|
|
|
deptName: string;
|
|
|
|
categoryName: string;
|
|
|
|
createTime: string;
|
|
|
|
exitTime: string;
|
|
|
|
exitReason: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ModalInfo {
|
2025-06-27 10:41:33 +08:00
|
|
|
type: 'teamMembers' | 'groupLeader' | 'view' | null;
|
2025-06-24 10:52:30 +08:00
|
|
|
visible: boolean;
|
|
|
|
record: Data | null;
|
2025-06-27 10:41:33 +08:00
|
|
|
view: boolean;
|
2025-06-24 10:52:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const CooperateEnterprise: React.FC = () => {
|
|
|
|
const [searchForm] = Form.useForm();
|
|
|
|
const intl = useIntl();
|
|
|
|
const [data, setData] = useState<Data[]>([]);
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
2025-06-27 10:41:33 +08:00
|
|
|
const [modalInfo, setModalInfo] = useState<ModalInfo>({ type: null, visible: false, record: null, view:false });
|
2025-06-24 10:52:30 +08:00
|
|
|
|
2025-06-27 10:41:33 +08:00
|
|
|
const openModal = (type: 'teamMembers' | 'groupLeader' | 'view', record: Data, view = false ) => {
|
|
|
|
setModalInfo({ type, visible: true, record, view });
|
2025-06-24 10:52:30 +08:00
|
|
|
};
|
2025-06-24 16:48:10 +08:00
|
|
|
//提交关闭审核
|
2025-06-24 10:52:30 +08:00
|
|
|
const closeModal = () => {
|
2025-06-27 10:41:33 +08:00
|
|
|
setModalInfo({ type: null, visible: false, record: null, view:false });
|
2025-06-24 10:52:30 +08:00
|
|
|
};
|
2025-06-24 16:48:10 +08:00
|
|
|
//提交审核
|
|
|
|
const submitModal = () => {
|
|
|
|
closeModal();
|
|
|
|
handleReset();
|
|
|
|
};
|
|
|
|
|
2025-06-24 10:52:30 +08:00
|
|
|
// 列表数据
|
2025-07-02 16:18:03 +08:00
|
|
|
const getList = async (params: { pageNo: number; pageSize: number;}) => {
|
2025-06-24 10:52:30 +08:00
|
|
|
setLoading(true);
|
2025-07-02 16:18:03 +08:00
|
|
|
try {
|
|
|
|
const values = searchForm.getFieldsValue();
|
2025-07-03 10:24:33 +08:00
|
|
|
const { code, data } = await getPage({...params, ...values});
|
2025-06-24 10:52:30 +08:00
|
|
|
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();
|
2025-07-02 16:18:03 +08:00
|
|
|
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10 });
|
2025-06-24 10:52:30 +08:00
|
|
|
};
|
|
|
|
|
2025-07-02 16:18:03 +08:00
|
|
|
const handleSearch = () => {
|
2025-06-24 10:52:30 +08:00
|
|
|
getList({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: pagination.pageSize ?? 10,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-07-02 16:18:03 +08:00
|
|
|
getList({ pageNo: 1, pageSize: 10 });
|
2025-06-24 10:52:30 +08:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
const columns: ColumnsType<Data> = [
|
|
|
|
{
|
|
|
|
title: '序号',
|
|
|
|
dataIndex: 'index',
|
|
|
|
key: 'index',
|
|
|
|
width: 80,
|
|
|
|
align: 'center',
|
2025-07-02 16:18:03 +08:00
|
|
|
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入工作',
|
|
|
|
dataIndex: 'accessWorkName',
|
|
|
|
key: 'accessWorkName',
|
2025-07-02 16:18:03 +08:00
|
|
|
ellipsis: true,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '发起单位',
|
|
|
|
dataIndex: 'deptId',
|
|
|
|
key: 'deptId',
|
2025-07-09 15:30:30 +08:00
|
|
|
ellipsis: true,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入部门',
|
|
|
|
dataIndex: 'deptId',
|
|
|
|
key: 'deptId',
|
2025-07-09 15:30:30 +08:00
|
|
|
ellipsis: true,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-09 15:30:30 +08:00
|
|
|
title: '准入品类',
|
|
|
|
dataIndex: 'categoryNameList',
|
|
|
|
align: 'center',
|
|
|
|
render: (_: any, record: any) => {
|
|
|
|
return (
|
|
|
|
<>
|
2025-07-10 09:31:22 +08:00
|
|
|
{record.categoryNameList && record.categoryNameList.map((item:string) => {
|
2025-07-09 15:30:30 +08:00
|
|
|
return <div>{`${item}`}</div>
|
|
|
|
})}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
},
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入方式',
|
|
|
|
dataIndex: 'accessTypeText',
|
|
|
|
key: 'accessTypeText',
|
2025-07-09 15:30:30 +08:00
|
|
|
ellipsis: true,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '评审时间',
|
|
|
|
dataIndex: 'createTime',
|
|
|
|
key: 'createTime',
|
2025-07-02 16:18:03 +08:00
|
|
|
ellipsis: true,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '评审状态',
|
|
|
|
dataIndex: 'reviewStatusText',
|
|
|
|
key: 'reviewStatusText',
|
2025-06-27 10:41:33 +08:00
|
|
|
width: 120,
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '操作',
|
2025-07-02 16:18:03 +08:00
|
|
|
width: 140,
|
2025-06-24 16:48:10 +08:00
|
|
|
render: (_: any, record: any) => {
|
2025-06-27 10:41:33 +08:00
|
|
|
// 已完成 3 、结果汇总中 2 、进行中1 、 未开始0
|
|
|
|
// 显示评审 按钮
|
2025-06-24 16:48:10 +08:00
|
|
|
const showAudit = (
|
2025-06-27 10:41:33 +08:00
|
|
|
(['0', '1'].includes(record.reviewStatus) && record.isLeader === '0') ||
|
|
|
|
(['2'].includes(record.reviewStatus) && record.isLeader === '1')
|
2025-06-24 16:48:10 +08:00
|
|
|
);
|
2025-06-27 10:41:33 +08:00
|
|
|
// 进行中1 、未开始0 弹出组员组件 否则弹出组长组件
|
|
|
|
const type = ['0', '1'].includes(record.reviewStatus)? 'teamMembers': 'groupLeader';
|
|
|
|
|
|
|
|
//评审结果 结果汇总中2 弹出组员组件, 已完成3弹出组长组件
|
|
|
|
const isLeader = (record.reviewStatus === '2' && record.isLeader === '0')? 'teamMembers':
|
|
|
|
(record.reviewStatus === '3' && record.isLeader === '1')? 'groupLeader':'';
|
2025-06-24 16:48:10 +08:00
|
|
|
return (
|
2025-06-24 10:52:30 +08:00
|
|
|
<Space>
|
2025-06-27 10:41:33 +08:00
|
|
|
{showAudit && <a onClick={() => openModal(type, record)}>评审</a>}
|
|
|
|
<a onClick={() => openModal('view', record)}>查看</a>
|
|
|
|
{ isLeader != '' && <a onClick={() => openModal(isLeader, record, true)}>评审结果</a>}
|
|
|
|
</Space>
|
2025-06-24 16:48:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
},
|
2025-06-24 10:52:30 +08:00
|
|
|
},
|
|
|
|
];
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Form
|
|
|
|
form={searchForm}
|
|
|
|
layout="inline"
|
|
|
|
onFinish={handleSearch}
|
|
|
|
style={{ marginBottom: 16 }}
|
|
|
|
>
|
2025-07-02 16:18:03 +08:00
|
|
|
<Form.Item name="accessWorkName" label="准入工作">
|
|
|
|
<Input placeholder="请输入准入工作" allowClear maxLength={50} />
|
2025-06-24 10:52:30 +08:00
|
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
|
|
<Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
|
|
|
|
搜索
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
|
|
<Button onClick={handleReset}>重置</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
|
|
|
<Table
|
|
|
|
rowKey="id"
|
|
|
|
className="custom-table"
|
|
|
|
columns={columns}
|
|
|
|
dataSource={data}
|
|
|
|
pagination={pagination}
|
|
|
|
loading={loading}
|
2025-07-02 16:18:03 +08:00
|
|
|
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize! })}
|
2025-06-24 10:52:30 +08:00
|
|
|
/>
|
2025-06-24 16:48:10 +08:00
|
|
|
{ modalInfo.type && modalInfo.type === 'teamMembers' && (
|
|
|
|
<ResultModal
|
|
|
|
visible={modalInfo.visible}
|
2025-06-27 10:41:33 +08:00
|
|
|
view={modalInfo.view}
|
2025-06-24 16:48:10 +08:00
|
|
|
record={modalInfo.record}
|
|
|
|
onCancel={closeModal}
|
|
|
|
onSubmit={submitModal}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{ modalInfo.type && modalInfo.type === 'groupLeader' && (
|
|
|
|
<GroupLeaderModal
|
|
|
|
visible={modalInfo.visible}
|
2025-06-27 10:41:33 +08:00
|
|
|
view={modalInfo.view}
|
2025-06-24 16:48:10 +08:00
|
|
|
record={modalInfo.record}
|
|
|
|
onCancel={closeModal}
|
|
|
|
onSubmit={submitModal}
|
|
|
|
/>
|
|
|
|
)}
|
2025-06-27 10:41:33 +08:00
|
|
|
{ modalInfo.type && modalInfo.type === 'view' && (
|
|
|
|
<ViewModal
|
|
|
|
visible={modalInfo.visible}
|
|
|
|
record={modalInfo.record}
|
|
|
|
onCancel={closeModal}
|
|
|
|
/>
|
|
|
|
)}
|
2025-06-24 16:48:10 +08:00
|
|
|
|
2025-06-24 10:52:30 +08:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2025-06-24 11:08:51 +08:00
|
|
|
export default CooperateEnterprise;
|