Compare commits
6 Commits
a56ebe2948
...
dev
Author | SHA1 | Date | |
---|---|---|---|
c114972076 | |||
c1b0860711 | |||
9eb0821e6b | |||
71924f1887 | |||
91672707b1 | |||
605c3c26ac |
@ -0,0 +1,241 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useIntl } from 'umi';
|
||||
import { Form, Input, Select, Button, Table, Tooltip, message } from 'antd';
|
||||
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { getEvaluateSupplierList, getAllEvaluateRules } from '@/servers/api/supplierEvaluate';
|
||||
import type { TablePaginationConfig } from 'antd';
|
||||
import GlobalModal from '../GlobalModal/index';
|
||||
|
||||
const EvaluationApproval: React.FC<{
|
||||
visible: boolean;
|
||||
record: any;
|
||||
}> = ({ visible, record = {} }) => {
|
||||
const intl = useIntl();
|
||||
const { Option } = Select;
|
||||
const [resultData, setResultData] = useState<SupplierEvaluateResult.EvaluateSupplierItem[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [visibleGlobalModal, setVisibleGlobalModal] = useState(false);
|
||||
const [id, setId] = useState('');
|
||||
const [form] = Form.useForm();
|
||||
const [evaluateRules, setEvaluateRules] = useState<SupplierEvaluateRuleManage.EvaluateRuleItem[]>(
|
||||
[],
|
||||
);
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) =>
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.pagination.total' }, { total }),
|
||||
});
|
||||
const [searchParams, setSearchParams] =
|
||||
useState<SupplierEvaluateResult.EvaluateSupplierSearchParams>({});
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.index' }),
|
||||
render: (_: any, __: SupplierEvaluateResult.EvaluateSupplierItem, index: number) => index + 1,
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.supplierName' }),
|
||||
dataIndex: 'supplierName',
|
||||
key: 'supplierName',
|
||||
width: 200,
|
||||
ellipsis: {
|
||||
showTitle: false,
|
||||
},
|
||||
render: (supplierName: string, record: SupplierEvaluateResult.EvaluateSupplierItem) => (
|
||||
<Tooltip placement="topLeft" title={supplierName}>
|
||||
<a
|
||||
onClick={() => {
|
||||
setId(record.supplierId);
|
||||
setVisibleGlobalModal(true);
|
||||
}}
|
||||
>
|
||||
{supplierName}
|
||||
</a>
|
||||
</Tooltip>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.categoryName' }),
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.reviewScore' }),
|
||||
dataIndex: 'reviewScore',
|
||||
key: 'reviewScore',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.levelName' }),
|
||||
dataIndex: 'levelName',
|
||||
key: 'levelName',
|
||||
width: 100,
|
||||
align: 'center' as const,
|
||||
},
|
||||
];
|
||||
// 获取评价规则列表
|
||||
const fetchResultDetailList = async (
|
||||
current = 1,
|
||||
pageSize = 10,
|
||||
params: SupplierEvaluateResult.EvaluateSupplierSearchParams = searchParams,
|
||||
) => {
|
||||
// 确保有评价任务ID
|
||||
if (!record?.id) {
|
||||
message.error(intl.formatMessage({ id: 'supplierEvaluateResult.message.missingTaskId' }));
|
||||
return;
|
||||
}
|
||||
// 更新搜索参数状态
|
||||
if (params !== searchParams) {
|
||||
setSearchParams(params);
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
// 构建请求参数
|
||||
const requestParams: SupplierEvaluateResult.EvaluateSupplierRequest = {
|
||||
basePageRequest: {
|
||||
pageNo: current,
|
||||
pageSize: pageSize,
|
||||
},
|
||||
evaluateTaskId: record.id,
|
||||
};
|
||||
|
||||
// 添加搜索条件
|
||||
if (params.supplierName) {
|
||||
requestParams.supplierName = params.supplierName;
|
||||
}
|
||||
if (params.levelName) {
|
||||
requestParams.levelName = params.levelName;
|
||||
}
|
||||
// 调用接口获取数据
|
||||
const response = await getEvaluateSupplierList(requestParams);
|
||||
if (response.data && response.success) {
|
||||
const { records, total, current: currentPage, size } = response.data;
|
||||
setResultData(records);
|
||||
setPagination({
|
||||
...pagination,
|
||||
current: currentPage,
|
||||
pageSize: size,
|
||||
total,
|
||||
});
|
||||
} else {
|
||||
message.error(
|
||||
response.message ||
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchDetailFailed' }),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取评价结果详情列表失败:', error);
|
||||
message.error(intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchDetailFailed' }));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
// 获取评价规则列表
|
||||
const fetchEvaluateRules = async () => {
|
||||
try {
|
||||
const response = await getAllEvaluateRules();
|
||||
if (response.success && response.data) {
|
||||
setEvaluateRules(response.data);
|
||||
} else {
|
||||
message.error(
|
||||
response.message ||
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchRulesFailed' }),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取评价规则列表失败:', error);
|
||||
message.error(intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchRulesFailed' }));
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
fetchEvaluateRules();
|
||||
fetchResultDetailList(pagination.current, pagination.pageSize, {});
|
||||
}
|
||||
}, [visible, record]);
|
||||
// 处理表格分页变化
|
||||
const handleTableChange = (newPagination: TablePaginationConfig) => {
|
||||
fetchResultDetailList(newPagination.current, newPagination.pageSize, searchParams);
|
||||
};
|
||||
|
||||
// 处理搜索
|
||||
const handleSearch = (values: any) => {
|
||||
fetchResultDetailList(1, pagination.pageSize, values);
|
||||
};
|
||||
|
||||
// 处理重置
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
fetchResultDetailList(1, pagination.pageSize, {});
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<div className="content-area">
|
||||
<div className="filter-action-row">
|
||||
<Form form={form} layout="inline" onFinish={handleSearch} className="filter-form">
|
||||
<Form.Item
|
||||
name="supplierName"
|
||||
label={intl.formatMessage({ id: 'supplierEvaluateResult.form.supplierName' })}
|
||||
>
|
||||
<Input
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierEvaluateResult.form.placeholder.supplierName',
|
||||
})}
|
||||
allowClear
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="levelName"
|
||||
label={intl.formatMessage({ id: 'supplierEvaluateResult.form.levelName' })}
|
||||
>
|
||||
<Select
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierEvaluateResult.form.placeholder.levelName',
|
||||
})}
|
||||
allowClear
|
||||
style={{ width: 150 }}
|
||||
>
|
||||
{evaluateRules.map((rule) => (
|
||||
<Option key={rule.id} value={rule.levelName}>
|
||||
{rule.levelName}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item className="filter-btns">
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={() => form.submit()}>
|
||||
{intl.formatMessage({ id: 'supplierEvaluateResult.button.search' })}
|
||||
</Button>
|
||||
<Button type="primary" danger icon={<DeleteOutlined />} onClick={handleReset}>
|
||||
{intl.formatMessage({ id: 'supplierEvaluateResult.button.reset' })}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<div className="right-buttons">返回</div>
|
||||
</div>
|
||||
<Table
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={resultData}
|
||||
loading={loading}
|
||||
scroll={{ x: 1100 }}
|
||||
pagination={pagination}
|
||||
onChange={handleTableChange}
|
||||
/>
|
||||
</div>
|
||||
<GlobalModal
|
||||
visible={visibleGlobalModal}
|
||||
id={id}
|
||||
onCancel={() => setVisibleGlobalModal(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EvaluationApproval;
|
||||
|
@ -8,6 +8,7 @@ interface Data {
|
||||
coscoAccessWork: coscoAccessWorks;
|
||||
coscoAccessSupplierList: coscoAccessSupplierLists[];
|
||||
coscoAccessCategoryList: coscoAccessCategoryLists[];
|
||||
coscoAccessSupplierCategoryList: coscoAccessCategoryLists[];
|
||||
coscoAccessUserls: coscoAccessUserl[];
|
||||
coscoAccessWorkAttachments: coscoAccessWorkAttachments;
|
||||
}
|
||||
@ -28,12 +29,15 @@ interface coscoAccessCategoryLists {
|
||||
}
|
||||
interface coscoAccessSupplierLists {
|
||||
supplierName: string;
|
||||
supplierTypeCn: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
interface coscoAccessWorks {
|
||||
deptId: string;
|
||||
deptName: string;
|
||||
orgName: string;
|
||||
createByName: string;
|
||||
createTime: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
reviewStatusText: string;
|
||||
@ -90,9 +94,15 @@ const ViewModal: React.FC<{
|
||||
)
|
||||
})}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="境内/境外">{data.coscoAccessWork.orgName}</Descriptions.Item>
|
||||
<Descriptions.Item label="境内/境外">
|
||||
{data.coscoAccessSupplierList.map((item) => {
|
||||
return (
|
||||
<span>{item.supplierTypeCn}</span>
|
||||
)
|
||||
})}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="已准入品类">
|
||||
{data.coscoAccessCategoryList.map((item) => {
|
||||
{data.coscoAccessSupplierCategoryList && data.coscoAccessSupplierCategoryList.map((item) => {
|
||||
return (
|
||||
<div style={{ margin: '5px' }}>{item.categoryPathName}</div>
|
||||
)
|
||||
@ -107,8 +117,8 @@ const ViewModal: React.FC<{
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="单位">{data.coscoAccessWork.orgName}</Descriptions.Item>
|
||||
<Descriptions.Item label="申请部门">{data.coscoAccessWork.deptName}</Descriptions.Item>
|
||||
<Descriptions.Item label="申请人">{data.coscoAccessWork.deptName}</Descriptions.Item>
|
||||
<Descriptions.Item label="申请时间">{data.coscoAccessWork.deptName}</Descriptions.Item>
|
||||
<Descriptions.Item label="申请人">{data.coscoAccessWork.createByName}</Descriptions.Item>
|
||||
<Descriptions.Item label="申请时间">{data.coscoAccessWork.createTime}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Spin>
|
||||
|
@ -7,6 +7,7 @@ import CategoryLibraryApproval from './components/CategoryLibraryApproval';
|
||||
import CategoryLibrarySupplierApproval from './components/CategoryLibrarySupplierApproval';
|
||||
import SupplierCategoryAccessApproval from './components/SupplierCategoryAccessApproval';
|
||||
import SupplierInfoChangeApproval from './components/SupplierInfoChangeApproval';
|
||||
import EvaluationApproval from './components/EvaluationApproval';
|
||||
import { refreshDictCache } from '@/servers/api/login';
|
||||
import { encryptWithRsa } from '@/utils/encryptWithRsa';
|
||||
|
||||
@ -27,10 +28,10 @@ const ViewReviewPage: React.FC = () => {
|
||||
const query = /%[0-9A-F]{2}/i.test(decodedStr) ? decodeURIComponent(decodedStr) : decodedStr;
|
||||
const p2 = new URLSearchParams(query);
|
||||
const id = p2.get('id') ?? '';
|
||||
const code = p2.get('code') ?? '';
|
||||
const type = p2.get('type') ?? '';
|
||||
const userId = p2.get('userId') ?? '';
|
||||
if (!id) return;
|
||||
setType(code); // code 现在一定是 string
|
||||
setType(type); // code 现在一定是 string
|
||||
// 初始化字典
|
||||
if (!sessionStorage.getItem('dict')) {
|
||||
refreshDictCache().then((res) => {
|
||||
@ -134,10 +135,10 @@ const ViewReviewPage: React.FC = () => {
|
||||
{/* 评价审批 */}
|
||||
{['evaluationApproval'].includes(type) && (
|
||||
<>
|
||||
{/* <EvaluationApproval
|
||||
<EvaluationApproval
|
||||
visible={modalVisible}
|
||||
record={modalRecord}
|
||||
/> */}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
@ -64,13 +64,13 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
getList(1, pagination.pageSize);
|
||||
getList(pagination.current, pagination.pageSize);
|
||||
};
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
getList(1, pagination.pageSize);
|
||||
getList(pagination.current, pagination.pageSize);
|
||||
};
|
||||
//列表方法
|
||||
const getList = async (pageNo: number = 1, pageSize: number = 10) => {
|
||||
|
@ -54,6 +54,7 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
|
||||
const handleTreeSelect = (keys: string | number) => {
|
||||
const key = keys as string;
|
||||
setSelectedKeys(key);
|
||||
setPagination(p => ({ ...p, current: 1 }));
|
||||
getList(key, 1, pagination.pageSize);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user