供应商准入管理除了品类
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useIntl } from 'umi';
|
||||
import { Form, Button, Table, Select, Space, Input } from 'antd';
|
||||
import { Form, Button, Table, 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';
|
||||
import GroupLeaderModal from './components/GroupLeaderModal';
|
||||
|
||||
interface Data {
|
||||
deptName: string;
|
||||
@ -16,7 +17,7 @@ interface Data {
|
||||
}
|
||||
|
||||
interface ModalInfo {
|
||||
type: 'view' | 'result' | null;
|
||||
type: 'teamMembers' | 'groupLeader' | null;
|
||||
visible: boolean;
|
||||
record: Data | null;
|
||||
}
|
||||
@ -30,18 +31,24 @@ const CooperateEnterprise: React.FC = () => {
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
||||
const [modalInfo, setModalInfo] = useState<ModalInfo>({ type: null, visible: false, record: null });
|
||||
|
||||
const openModal = (type: 'view' | 'result', record: Data) => {
|
||||
const openModal = (type: 'teamMembers' | 'groupLeader', record: Data) => {
|
||||
setModalInfo({ type, visible: true, record });
|
||||
};
|
||||
|
||||
//提交关闭审核
|
||||
const closeModal = () => {
|
||||
setModalInfo({ type: null, visible: false, record: null });
|
||||
};
|
||||
//提交审核
|
||||
const submitModal = () => {
|
||||
closeModal();
|
||||
handleReset();
|
||||
};
|
||||
|
||||
// 列表数据
|
||||
const getList = async (params: { pageNo: number; pageSize: number; parentCode: string; }) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { code, data } = await getPage(params);
|
||||
const { code, data } = await getPage({...params });
|
||||
if (code === 200) {
|
||||
setData(data.records);
|
||||
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total });
|
||||
@ -97,8 +104,8 @@ const CooperateEnterprise: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: '品类',
|
||||
dataIndex: 'exitTime',
|
||||
key: 'exitTime',
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
},
|
||||
{
|
||||
title: '准入方式',
|
||||
@ -117,11 +124,19 @@ const CooperateEnterprise: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
render: (_: any, record: any) => (
|
||||
render: (_: any, record: any) => {
|
||||
const showAudit = (
|
||||
(['未开始', '进行中'].includes(record.reviewStatusText) && record.isLeader === '0') ||
|
||||
(['结果汇总中'].includes(record.reviewStatusText) && record.isLeader === '1')
|
||||
);
|
||||
const type = ['未开始', '进行中'].includes(record.reviewStatusText)? 'teamMembers': 'groupLeader';
|
||||
return (
|
||||
<Space>
|
||||
<a onClick={() => openModal('result', record)}>审核</a>
|
||||
</Space>
|
||||
),
|
||||
{showAudit && <a onClick={() => openModal(type, record)}>审核</a>}
|
||||
</Space>
|
||||
)
|
||||
|
||||
},
|
||||
},
|
||||
];
|
||||
return (
|
||||
@ -153,12 +168,23 @@ const CooperateEnterprise: React.FC = () => {
|
||||
loading={loading}
|
||||
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, parentCode: '', })}
|
||||
/>
|
||||
|
||||
<ResultModal
|
||||
visible={modalInfo.type === 'result' && modalInfo.visible}
|
||||
record={modalInfo.record}
|
||||
onCancel={closeModal}
|
||||
/>
|
||||
{ modalInfo.type && modalInfo.type === 'teamMembers' && (
|
||||
<ResultModal
|
||||
visible={modalInfo.visible}
|
||||
record={modalInfo.record}
|
||||
onCancel={closeModal}
|
||||
onSubmit={submitModal}
|
||||
/>
|
||||
)}
|
||||
{ modalInfo.type && modalInfo.type === 'groupLeader' && (
|
||||
<GroupLeaderModal
|
||||
visible={modalInfo.visible}
|
||||
record={modalInfo.record}
|
||||
onCancel={closeModal}
|
||||
onSubmit={submitModal}
|
||||
/>
|
||||
)}
|
||||
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user