2025-06-24 16:48:10 +08:00
|
|
|
import React, { useEffect, useState } from 'react';
|
2025-07-10 15:38:05 +08:00
|
|
|
import { Table, Form, Select, Button, message, Space } from 'antd';
|
|
|
|
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
2025-06-24 16:48:10 +08:00
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
2025-07-10 15:38:05 +08:00
|
|
|
//接口
|
|
|
|
import { getApprovePage } from './services';
|
2025-07-15 15:10:21 +08:00
|
|
|
import { getDictList } from '@/servers/api/dicts'
|
2025-07-10 15:38:05 +08:00
|
|
|
//组件
|
2025-07-15 15:47:21 +08:00
|
|
|
import AccessDepartmentSelect from '@/components/AccessDepartmentSelect';
|
2025-06-27 10:41:33 +08:00
|
|
|
import ViewModal from './components/ViewModal';
|
2025-07-10 15:38:05 +08:00
|
|
|
//统一列表分页
|
|
|
|
import tableProps from '@/utils/tableProps'
|
|
|
|
|
2025-07-02 16:18:03 +08:00
|
|
|
const { Option } = Select;
|
2025-06-24 16:48:10 +08:00
|
|
|
interface SupplierEntryReviewRecord {
|
|
|
|
id: string;
|
|
|
|
accessWorkName: string; // 准入工作
|
|
|
|
deptId: string; // 准入部门ID
|
|
|
|
accessTypeText: string; // 准入方式
|
|
|
|
reviewStatusText: string; // 流程状态
|
|
|
|
categoryName: string; // 品类名称
|
|
|
|
startTime: string; // 申请时间
|
|
|
|
endTime: string;
|
|
|
|
createTime: string; // 创建时间
|
|
|
|
updateTime: string; // 更新时间
|
|
|
|
[key: string]: any; // 允许有其它字段
|
|
|
|
}
|
2025-07-02 16:18:03 +08:00
|
|
|
|
2025-06-27 10:41:33 +08:00
|
|
|
interface ModalInfo {
|
|
|
|
visible: boolean;
|
|
|
|
record: string | null;
|
|
|
|
}
|
2025-06-24 10:52:30 +08:00
|
|
|
|
2025-07-15 15:10:21 +08:00
|
|
|
interface Dict {
|
|
|
|
dicName: string;
|
|
|
|
code: string;
|
|
|
|
}
|
2025-06-24 10:52:30 +08:00
|
|
|
|
|
|
|
const SupplierEntryReview: React.FC = () => {
|
2025-06-24 16:48:10 +08:00
|
|
|
const [form] = Form.useForm();
|
|
|
|
const [data, setData] = useState<any[]>([]);
|
|
|
|
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
|
|
|
const [loading, setLoading] = useState(false);
|
2025-07-02 16:18:03 +08:00
|
|
|
const [modalInfo, setModalInfo] = useState<ModalInfo>({ visible: false, record: null });
|
2025-07-15 15:10:21 +08:00
|
|
|
//
|
|
|
|
const [enterpriseType, setEnterpriseType] = useState<Dict[]>();
|
2025-06-24 16:48:10 +08:00
|
|
|
// 查询数据
|
|
|
|
const fetchData = async (params = {}) => {
|
|
|
|
setLoading(true);
|
|
|
|
try {
|
|
|
|
const res = await getApprovePage({
|
|
|
|
pageNo: pagination.current,
|
|
|
|
pageSize: pagination.pageSize,
|
|
|
|
...form.getFieldsValue(),
|
|
|
|
...params,
|
|
|
|
});
|
|
|
|
if (res.code === 200) {
|
|
|
|
setData(res.data.records);
|
|
|
|
setPagination({
|
|
|
|
...pagination,
|
|
|
|
current: res.data.current,
|
|
|
|
total: res.data.total,
|
|
|
|
pageSize: res.data.size,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setData([]);
|
|
|
|
setPagination({ ...pagination, total: 0 });
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
message.error('获取数据失败');
|
|
|
|
} finally {
|
|
|
|
setLoading(false);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
fetchData({ pageNo: 1 });
|
2025-07-15 15:10:21 +08:00
|
|
|
getDictList('approve_type').then((res) => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
setEnterpriseType(res.data)
|
|
|
|
}
|
|
|
|
})
|
2025-06-24 16:48:10 +08:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
// 表格分页切换
|
|
|
|
const handleTableChange = (pag: any) => {
|
|
|
|
setPagination({
|
|
|
|
...pagination,
|
|
|
|
current: pag.current,
|
|
|
|
pageSize: pag.pageSize,
|
|
|
|
});
|
|
|
|
fetchData({
|
|
|
|
pageNo: pag.current,
|
|
|
|
pageSize: pag.pageSize,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
// 搜索
|
|
|
|
const handleSearch = () => {
|
|
|
|
setPagination({ ...pagination, current: 1 });
|
|
|
|
fetchData({ pageNo: 1 });
|
|
|
|
};
|
|
|
|
|
|
|
|
// 重置
|
|
|
|
const handleReset = () => {
|
|
|
|
form.resetFields();
|
|
|
|
setPagination({ ...pagination, current: 1 });
|
|
|
|
fetchData({ pageNo: 1 });
|
|
|
|
};
|
2025-06-27 10:41:33 +08:00
|
|
|
const openModal = (record: string) => {
|
2025-07-02 16:18:03 +08:00
|
|
|
setModalInfo({ visible: true, record });
|
2025-06-27 10:41:33 +08:00
|
|
|
};
|
|
|
|
const closeModal = () => {
|
2025-07-02 16:18:03 +08:00
|
|
|
setModalInfo({ visible: false, record: null });
|
2025-06-27 10:41:33 +08:00
|
|
|
};
|
2025-07-02 16:18:03 +08:00
|
|
|
const columns: ColumnsType<SupplierEntryReviewRecord> = [
|
2025-06-27 10:41:33 +08:00
|
|
|
{
|
|
|
|
title: '序号',
|
|
|
|
dataIndex: 'index',
|
2025-07-10 15:38:05 +08:00
|
|
|
width: 60,
|
2025-06-27 10:41:33 +08:00
|
|
|
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-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入工作',
|
|
|
|
dataIndex: 'accessWorkName',
|
|
|
|
align: 'center',
|
|
|
|
ellipsis: true,
|
2025-07-15 09:07:43 +08:00
|
|
|
width: 120,
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入部门',
|
2025-07-16 11:22:57 +08:00
|
|
|
dataIndex: 'deptName',
|
2025-06-27 10:41:33 +08:00
|
|
|
align: 'center',
|
2025-07-15 09:07:43 +08:00
|
|
|
width: 120,
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入方式',
|
|
|
|
dataIndex: 'accessTypeText',
|
|
|
|
align: 'center',
|
2025-07-09 15:30:30 +08:00
|
|
|
ellipsis: true,
|
2025-07-15 09:07:43 +08:00
|
|
|
width: 120,
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '准入品类',
|
2025-07-09 15:30:30 +08:00
|
|
|
dataIndex: 'categoryNameList',
|
2025-07-15 09:07:43 +08:00
|
|
|
width: 120,
|
2025-06-27 10:41:33 +08:00
|
|
|
align: 'center',
|
2025-07-09 15:30:30 +08:00
|
|
|
render: (_: any, record: any) => {
|
|
|
|
return (
|
|
|
|
<>
|
2025-07-10 15:38:05 +08:00
|
|
|
{record.categoryNameList && record.categoryNameList.map((item: string) => {
|
2025-07-09 15:30:30 +08:00
|
|
|
return <div>{`${item}`}</div>
|
|
|
|
})}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
},
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '开始时间',
|
2025-07-10 15:38:05 +08:00
|
|
|
dataIndex: 'createTime',
|
2025-06-27 10:41:33 +08:00
|
|
|
align: 'center',
|
2025-07-09 15:30:30 +08:00
|
|
|
ellipsis: true,
|
2025-07-10 15:38:05 +08:00
|
|
|
width: 180,
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '结束时间',
|
2025-07-10 15:38:05 +08:00
|
|
|
dataIndex: 'lastUpdateTime',
|
2025-06-27 10:41:33 +08:00
|
|
|
align: 'center',
|
2025-07-09 15:30:30 +08:00
|
|
|
ellipsis: true,
|
2025-07-10 15:38:05 +08:00
|
|
|
width: 180,
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-15 15:10:21 +08:00
|
|
|
title: '评审状态',
|
2025-06-27 10:41:33 +08:00
|
|
|
dataIndex: 'reviewStatusText',
|
|
|
|
align: 'center',
|
2025-07-15 09:07:43 +08:00
|
|
|
width: 120,
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
2025-07-02 16:18:03 +08:00
|
|
|
{
|
2025-07-15 15:10:21 +08:00
|
|
|
title: '审批状态',
|
2025-07-02 16:18:03 +08:00
|
|
|
dataIndex: 'approveStatusText',
|
|
|
|
align: 'center',
|
2025-07-15 09:07:43 +08:00
|
|
|
width: 120,
|
2025-07-02 16:18:03 +08:00
|
|
|
},
|
2025-06-27 10:41:33 +08:00
|
|
|
{
|
|
|
|
title: '操作',
|
|
|
|
width: 120,
|
2025-07-15 09:07:43 +08:00
|
|
|
fixed: 'right',
|
2025-06-27 10:41:33 +08:00
|
|
|
render: (_: any, record: any) => {
|
2025-07-02 16:18:03 +08:00
|
|
|
return (
|
|
|
|
<Space>
|
|
|
|
<a onClick={() => openModal(record.id)}>查看</a>
|
|
|
|
</Space>
|
|
|
|
)
|
|
|
|
|
2025-06-27 10:41:33 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
2025-06-24 10:52:30 +08:00
|
|
|
return (
|
2025-07-10 15:38:05 +08:00
|
|
|
<div className="common-container">
|
|
|
|
<div className="filter-action-row">
|
|
|
|
<Form
|
|
|
|
form={form}
|
|
|
|
layout="inline"
|
|
|
|
className="filter-form"
|
|
|
|
onFinish={handleSearch}
|
|
|
|
>
|
|
|
|
<Form.Item name="accessType" label="准入方式">
|
|
|
|
<Select style={{ width: 150 }} placeholder="请选择准入方式" allowClear >
|
|
|
|
<Option value="online">线上准入</Option>
|
|
|
|
<Option value="offline">线下准入</Option>
|
|
|
|
<Option value="scattered">零星采购/应急采购/个人供应商</Option>
|
|
|
|
</Select>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="deptId" label="准入部门">
|
2025-07-15 15:47:21 +08:00
|
|
|
<AccessDepartmentSelect />
|
2025-07-10 15:38:05 +08:00
|
|
|
</Form.Item>
|
|
|
|
|
2025-07-15 15:10:21 +08:00
|
|
|
<Form.Item name="approveStatus" label="审批状态">
|
2025-07-10 15:38:05 +08:00
|
|
|
<Select style={{ width: 150 }} placeholder="请选择状态" allowClear>
|
2025-07-15 15:10:21 +08:00
|
|
|
{enterpriseType?.map(item => (
|
|
|
|
<Select.Option key={item.code} value={item.code}>{item.dicName}</Select.Option>
|
|
|
|
))}
|
2025-07-10 15:38:05 +08:00
|
|
|
</Select>
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
<Form.Item>
|
|
|
|
<Button className="buttonSubmit" type="primary" htmlType="submit" icon={<SearchOutlined />} >
|
|
|
|
搜索
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
|
|
<Button className="buttonReset" icon={<DeleteOutlined />} onClick={handleReset} >重置</Button>
|
|
|
|
</Form.Item>
|
|
|
|
|
2025-06-24 16:48:10 +08:00
|
|
|
|
2025-07-10 15:38:05 +08:00
|
|
|
</Form>
|
|
|
|
</div>
|
2025-06-24 16:48:10 +08:00
|
|
|
<Table
|
2025-06-24 10:52:30 +08:00
|
|
|
columns={columns}
|
2025-06-24 16:48:10 +08:00
|
|
|
dataSource={data}
|
2025-06-24 10:52:30 +08:00
|
|
|
rowKey="id"
|
2025-06-24 16:48:10 +08:00
|
|
|
loading={loading}
|
2025-07-10 15:38:05 +08:00
|
|
|
pagination={{ ...tableProps.pagination, total: pagination.total }}
|
2025-06-24 16:48:10 +08:00
|
|
|
onChange={handleTableChange}
|
2025-07-10 15:38:05 +08:00
|
|
|
style={{ flex: 1, minHeight: 0 }}
|
|
|
|
scroll={{ y: 'calc(100vh - 350px)' }}
|
2025-06-24 10:52:30 +08:00
|
|
|
/>
|
2025-07-02 16:18:03 +08:00
|
|
|
<ViewModal
|
|
|
|
visible={modalInfo.visible}
|
|
|
|
record={modalInfo.record}
|
|
|
|
onCancel={closeModal}
|
|
|
|
/>
|
2025-06-24 10:52:30 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SupplierEntryReview;
|