评审结果 显示reviewName

This commit is contained in:
孙景学
2025-07-17 16:35:30 +08:00
parent 6f2993b8e0
commit da7098aa42
2 changed files with 24 additions and 16 deletions

View File

@ -5,7 +5,7 @@ import { connect } from 'umi';
interface ResultModalProps { interface ResultModalProps {
visible: boolean; visible: boolean;
record?: { id?: string; [key: string]: any } | null; record?: { id?: string;[key: string]: any } | null;
onCancel: () => void; onCancel: () => void;
dispatch: any; dispatch: any;
} }
@ -121,15 +121,15 @@ const ResultModal: React.FC<ResultModalProps> = ({
}, },
...suppliers.map(sup => { ...suppliers.map(sup => {
// 当前公司所有人员所有非summary项取 coscoAccessUserItemList 多个) // 当前公司所有人员所有非summary项取 coscoAccessUserItemList 多个)
const reviewerSet = new Set<string>(); const reviewerMap = new Map<string, string>();
(sup.coscoAccessItemList || []).forEach((item: any) => { (sup.coscoAccessItemList || []).forEach((item: any) => {
if (item.itemType !== 'summary' && Array.isArray(item.coscoAccessUserItemList)) { if (item.itemType !== 'summary' && Array.isArray(item.coscoAccessUserItemList)) {
item.coscoAccessUserItemList.forEach((u: any) => { item.coscoAccessUserItemList.forEach((u: any) => {
reviewerSet.add(u.reviewBy); reviewerMap.set(u.reviewBy, u.reviewName); // 工号 -> 姓名
}); });
} }
}); });
const reviewers = Array.from(reviewerSet); const reviewers = Array.from(reviewerMap.entries()).map(([reviewBy, reviewName]) => ({ reviewBy, reviewName }));
return { return {
title: ( title: (
@ -148,8 +148,8 @@ const ResultModal: React.FC<ResultModalProps> = ({
</a> </a>
</div> </div>
), ),
children: reviewers.map((reviewBy: string) => ({ children: reviewers.map(({ reviewName, reviewBy }) => ({
title: reviewBy, title: reviewName,
dataIndex: `${sup.supplierId}_${reviewBy}`, dataIndex: `${sup.supplierId}_${reviewBy}`,
key: `${sup.supplierId}_${reviewBy}`, key: `${sup.supplierId}_${reviewBy}`,
width: 100, width: 100,

View File

@ -6,7 +6,7 @@ import './GroupLeaderModal.less'
interface GroupLeaderModalProps { interface GroupLeaderModalProps {
visible: boolean; visible: boolean;
view: boolean; view: boolean;
record?: { id?: string; [key: string]: any } | null; record?: { id?: string;[key: string]: any } | null;
onCancel: () => void; onCancel: () => void;
onSubmit: () => void; onSubmit: () => void;
dispatch: any; dispatch: any;
@ -131,7 +131,7 @@ const GroupLeaderModal: React.FC<GroupLeaderModalProps> = ({
}).filter(Boolean); }).filter(Boolean);
let accessWorkId = record?.id || ''; let accessWorkId = record?.id || '';
for (let index = 0; index < summaryParams.length; index++) { for (let index = 0; index < summaryParams.length; index++) {
if(summaryParams[index].reviewResult === null || summaryParams[index].reviewResult === undefined) { if (summaryParams[index].reviewResult === null || summaryParams[index].reviewResult === undefined) {
message.warning('有未评审项'); message.warning('有未评审项');
return return
} }
@ -154,7 +154,16 @@ const GroupLeaderModal: React.FC<GroupLeaderModalProps> = ({
fixed: 'left', fixed: 'left',
}, },
...suppliers.map(sup => { ...suppliers.map(sup => {
const reviewers = supplierReviewerMap[sup.supplierId] || []; // 构建对象数组
const reviewerSet = new Map();
(sup.coscoAccessUserItemList || []).forEach((u: any) => {
if (u.itemType === 'item' && u.reviewBy) {
reviewerSet.set(u.reviewBy, u.reviewName || u.reviewBy);
}
});
const reviewers = Array.from(reviewerSet.entries()).map(([reviewBy, reviewName]) => ({ reviewBy, reviewName }));
// const reviewers = supplierReviewerMap[sup.supplierId] || [];
return { return {
title: ( title: (
<div> <div>
@ -170,14 +179,13 @@ const GroupLeaderModal: React.FC<GroupLeaderModalProps> = ({
</a> </a>
</div> </div>
), ),
children: reviewers.map((reviewBy: string) => ({ children: reviewers.map(({ reviewName, reviewBy }) => ({
title: reviewBy, title: reviewName,
dataIndex: `${sup.supplierId}_${reviewBy}`, dataIndex: `${sup.supplierId}_${reviewBy}`,
key: `${sup.supplierId}_${reviewBy}`, key: `${sup.supplierId}_${reviewBy}`,
width: 100, width: 100,
align: 'center', align: 'center',
render: (_: any, row: any) => { render: (_: any, row: any) => {
// itemName+reviewBy精确查找
const userItem = (sup.coscoAccessUserItemList || []).find( const userItem = (sup.coscoAccessUserItemList || []).find(
(u: any) => u.itemType === 'item' && u.itemName === row.itemName && u.reviewBy === reviewBy (u: any) => u.itemType === 'item' && u.itemName === row.itemName && u.reviewBy === reviewBy
); );
@ -232,9 +240,9 @@ const GroupLeaderModal: React.FC<GroupLeaderModalProps> = ({
return ( return (
<Table.Summary.Cell index={index} key={sup.supplierId} colSpan={colSpan} align="center"> <Table.Summary.Cell index={index} key={sup.supplierId} colSpan={colSpan} align="center">
{view && ( {view && (
<span style={{color: groupSummaryResult[sup.supplierId] === '0'? '#52c41a': '#f5222d' }}> {groupSummaryResult[sup.supplierId] === '0'? '合格': '不合格'}</span> <span style={{ color: groupSummaryResult[sup.supplierId] === '0' ? '#52c41a' : '#f5222d' }}> {groupSummaryResult[sup.supplierId] === '0' ? '合格' : '不合格'}</span>
)} )}
{ !view && ( {!view && (
<Select <Select
style={{ width: 120 }} style={{ width: 120 }}
value={groupSummaryResult[sup.supplierId]} value={groupSummaryResult[sup.supplierId]}