合并代码
This commit is contained in:
@ -4,7 +4,7 @@ import { SearchOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
import { getApprovePage } from './services';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import ViewModal from './components/ViewModal';
|
||||
|
||||
const { Option } = Select;
|
||||
interface SupplierEntryReviewRecord {
|
||||
id: string;
|
||||
accessWorkName: string; // 准入工作
|
||||
@ -18,7 +18,7 @@ interface SupplierEntryReviewRecord {
|
||||
updateTime: string; // 更新时间
|
||||
[key: string]: any; // 允许有其它字段
|
||||
}
|
||||
|
||||
|
||||
interface ModalInfo {
|
||||
visible: boolean;
|
||||
record: string | null;
|
||||
@ -54,7 +54,7 @@ const SupplierEntryReview: React.FC = () => {
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [modalInfo, setModalInfo] = useState<ModalInfo>({ visible: false, record: null });
|
||||
const [modalInfo, setModalInfo] = useState<ModalInfo>({ visible: false, record: null });
|
||||
// 查询数据
|
||||
const fetchData = async (params = {}) => {
|
||||
setLoading(true);
|
||||
@ -86,7 +86,6 @@ const SupplierEntryReview: React.FC = () => {
|
||||
|
||||
useEffect(() => {
|
||||
fetchData({ pageNo: 1 });
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
|
||||
// 表格分页切换
|
||||
@ -115,18 +114,18 @@ const SupplierEntryReview: React.FC = () => {
|
||||
fetchData({ pageNo: 1 });
|
||||
};
|
||||
const openModal = (record: string) => {
|
||||
setModalInfo({visible: true, record});
|
||||
setModalInfo({ visible: true, record });
|
||||
};
|
||||
const closeModal = () => {
|
||||
setModalInfo({ visible: false, record: null });
|
||||
setModalInfo({ visible: false, record: null });
|
||||
};
|
||||
const columns:ColumnsType<SupplierEntryReviewRecord> = [
|
||||
const columns: ColumnsType<SupplierEntryReviewRecord> = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{
|
||||
title: '准入工作',
|
||||
@ -138,7 +137,6 @@ const SupplierEntryReview: React.FC = () => {
|
||||
title: '准入部门',
|
||||
dataIndex: 'deptId',
|
||||
align: 'center',
|
||||
render: (deptId: string) => deptId === 'DEPT001' ? '采购部' : deptId === 'DEPT002' ? '业务部' : deptId,
|
||||
},
|
||||
{
|
||||
title: '准入方式',
|
||||
@ -166,17 +164,22 @@ const SupplierEntryReview: React.FC = () => {
|
||||
dataIndex: 'reviewStatusText',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '审核',
|
||||
dataIndex: 'approveStatusText',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
render: (_: any, record: any) => {
|
||||
console.log(record,'record');
|
||||
return (
|
||||
<Space>
|
||||
<a onClick={() => openModal(record.id)}>查看</a>
|
||||
</Space>
|
||||
)
|
||||
|
||||
console.log(record, 'record');
|
||||
return (
|
||||
<Space>
|
||||
<a onClick={() => openModal(record.id)}>查看</a>
|
||||
</Space>
|
||||
)
|
||||
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -188,14 +191,23 @@ const SupplierEntryReview: React.FC = () => {
|
||||
style={{ marginBottom: 16 }}
|
||||
onFinish={handleSearch}
|
||||
>
|
||||
<Form.Item name="accessTypeText" label="准入方式">
|
||||
<Select options={methodOptions} allowClear style={{ width: 120 }} />
|
||||
<Form.Item name="accessType" label="准入方式">
|
||||
<Select style={{ width: 150 }} placeholder="请选择准入方式" allowClear >
|
||||
<Option value="online">线上准入</Option>
|
||||
<Option value="offline">线下准入</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="deptId" label="准入部门">
|
||||
<Select options={deptOptions} allowClear style={{ width: 120 }} />
|
||||
<Select options={deptOptions} allowClear style={{ width: 120 }} placeholder="请选择准入部门" />
|
||||
</Form.Item>
|
||||
<Form.Item name="reviewStatusText" label="流程状态">
|
||||
<Select options={statusOptions} allowClear style={{ width: 120 }} />
|
||||
|
||||
<Form.Item name="approveStatus" label="流程状态">
|
||||
<Select style={{ width: 150 }} placeholder="请选择状态" allowClear>
|
||||
<Option value="0">未开始</Option>
|
||||
<Option value="1">进行中</Option>
|
||||
<Option value="2">结果汇总中</Option>
|
||||
<Option value="3">已完成</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} style={{ marginRight: 8 }}>
|
||||
@ -220,13 +232,12 @@ const SupplierEntryReview: React.FC = () => {
|
||||
showSizeChanger: true,
|
||||
}}
|
||||
onChange={handleTableChange}
|
||||
bordered
|
||||
/>
|
||||
<ViewModal
|
||||
visible={modalInfo.visible}
|
||||
record={modalInfo.record}
|
||||
onCancel={closeModal}
|
||||
/>
|
||||
<ViewModal
|
||||
visible={modalInfo.visible}
|
||||
record={modalInfo.record}
|
||||
onCancel={closeModal}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user