优化评查结果显示的效果

This commit is contained in:
2025-05-30 21:45:57 +08:00
parent e9084ad500
commit e9c1db64d2
+36 -6
View File
@@ -777,7 +777,7 @@ export function ReviewPointsList({
// 将当前断点的前一个元素和后一个元素组成一个新链条 // 将当前断点的前一个元素和后一个元素组成一个新链条
const newChain_before = tempChain.slice(i-1, i+1); const newChain_before = tempChain.slice(i-1, i+1);
console.log('newChain_before-------', newChain_before); // console.log('newChain_before-------', newChain_before);
splittedChains.push(newChain_before); splittedChains.push(newChain_before);
} }
@@ -860,7 +860,7 @@ export function ReviewPointsList({
// 如果是长链(3个或以上元素) // 如果是长链(3个或以上元素)
if (isLongChain) { if (isLongChain) {
console.log('currentlongchain-------', chain); // console.log('currentlongchain-------', chain);
return ( return (
<div <div
key={`chain_${chainIndex}`} key={`chain_${chainIndex}`}
@@ -870,12 +870,17 @@ export function ReviewPointsList({
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
// 遍历chain找到第一个有效的page // 遍历chain找到第一个有效的page
let hasPage = false;
for (const item of chain) { for (const item of chain) {
if (item.data.page && typeof onReviewPointSelect === 'function') { if (item.data.page && typeof onReviewPointSelect === 'function') {
hasPage = true;
onReviewPointSelect(reviewPoint.id, Number(item.data.page)); onReviewPointSelect(reviewPoint.id, Number(item.data.page));
break; break;
} }
} }
if (!hasPage) {
toastService.error('没有找到有效的页码');
}
}} }}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { if (e.key === 'Enter' || e.key === ' ') {
@@ -916,13 +921,15 @@ export function ReviewPointsList({
className="value-content p-1 cursor-text text-xs border-b border-dashed border-gray-200 last:border-b-0 text-left w-full rounded transition-colors" className="value-content p-1 cursor-text text-xs border-b border-dashed border-gray-200 last:border-b-0 text-left w-full rounded transition-colors"
onClick={(e) => { onClick={(e) => {
if (item.data.page) { if (item.data.page) {
console.log('currentitem-------', reviewPoint); // console.log('currentitem-------', reviewPoint);
// 假设onReviewPointSelect在作用域内可用 // 假设onReviewPointSelect在作用域内可用
const reviewPointId = reviewPoint.id as string; const reviewPointId = reviewPoint.id as string;
if (reviewPointId && typeof onReviewPointSelect === 'function') { if (reviewPointId && typeof onReviewPointSelect === 'function') {
e.stopPropagation(); e.stopPropagation();
onReviewPointSelect(reviewPointId, Number(item.data.page)); onReviewPointSelect(reviewPointId, Number(item.data.page));
} }
}else{
toastService.error(`没有找到${item.field}对应的索引内容`);
} }
}} }}
aria-label={`查看${item.field}内容详情`} aria-label={`查看${item.field}内容详情`}
@@ -930,7 +937,11 @@ export function ReviewPointsList({
<div className="flex justify-between w-full"> <div className="flex justify-between w-full">
{/* <span className="font-medium">{item.field}:</span> */} {/* <span className="font-medium">{item.field}:</span> */}
<span className="w-full overflow-hidden line-clamp-2 hover:line-clamp-none hover:shadow-[0_0_10px_rgba(0,0,0,0.1)] <span className="w-full overflow-hidden line-clamp-2 hover:line-clamp-none hover:shadow-[0_0_10px_rgba(0,0,0,0.1)]
hover: z-10 hover:overflow-auto rounded transition-all duration-300 ease-in-out max-h-96">{item.data.value?.toString() || ''}</span> hover: z-10 hover:overflow-auto rounded transition-all duration-300 ease-in-out max-h-96">{item.data.value?.toString() || ''}
{!item.data.page && !item.data.value && (
<i className="ri-information-line text-red-500 text-xs"></i>
)}
</span>
</div> </div>
</button> </button>
))} ))}
@@ -970,11 +981,17 @@ export function ReviewPointsList({
e.stopPropagation(); e.stopPropagation();
onReviewPointSelect(reviewPointId, chain[0].data.page); onReviewPointSelect(reviewPointId, chain[0].data.page);
} }
}else{
toastService.error(`没有找到${chain[0].field}对应的索引内容`);
} }
}} }}
aria-label={`查看${chain[0].field}内容详情`} aria-label={`查看${chain[0].field}内容详情`}
> >
<div className="value-source text-xs text-gray-500 mb-1">{chain[0].field}</div> <div className="value-source text-xs text-gray-500 mb-1">{chain[0].field}
{!chain[0].data.page && !chain[0].data.value && (
<i className="ri-information-line text-red-500 text-xs ml-1"></i>
)}
</div>
<div className="value-content text-xs overflow-hidden line-clamp-2 hover:line-clamp-none hover:shadow-[0_0_10px_rgba(0,0,0,0.1)] <div className="value-content text-xs overflow-hidden line-clamp-2 hover:line-clamp-none hover:shadow-[0_0_10px_rgba(0,0,0,0.1)]
hover:z-10 hover:overflow-auto rounded transition-all duration-300 ease-in-out cursor-text max-h-96">{chain[0].data.value?.toString() || ''}</div> hover:z-10 hover:overflow-auto rounded transition-all duration-300 ease-in-out cursor-text max-h-96">{chain[0].data.value?.toString() || ''}</div>
</button> </button>
@@ -987,11 +1004,17 @@ export function ReviewPointsList({
e.stopPropagation(); e.stopPropagation();
onReviewPointSelect(reviewPointId, chain[1].data.page); onReviewPointSelect(reviewPointId, chain[1].data.page);
} }
}else{
toastService.error(`没有找到${chain[1].field}对应的索引内容`);
} }
}} }}
aria-label={`查看${chain[1].field}内容详情`} aria-label={`查看${chain[1].field}内容详情`}
> >
<div className="value-source text-xs text-gray-500 mb-1">{chain[1].field}</div> <div className="value-source text-xs text-gray-500 mb-1">{chain[1].field}
{!chain[1].data.page && !chain[1].data.value && (
<i className="ri-information-line text-red-500 text-xs ml-1"></i>
)}
</div>
<div className="value-content text-xs overflow-hidden line-clamp-2 hover:line-clamp-none hover:shadow-[0_0_10px_rgba(0,0,0,0.1)] <div className="value-content text-xs overflow-hidden line-clamp-2 hover:line-clamp-none hover:shadow-[0_0_10px_rgba(0,0,0,0.1)]
hover:z-10 hover:overflow-auto rounded transition-all duration-300 ease-in-out cursor-text max-h-96">{chain[1].data.value?.toString() || ''}</div> hover:z-10 hover:overflow-auto rounded transition-all duration-300 ease-in-out cursor-text max-h-96">{chain[1].data.value?.toString() || ''}</div>
</button> </button>
@@ -1052,6 +1075,8 @@ export function ReviewPointsList({
if (mainTypeValue.page && typeof onReviewPointSelect === 'function') { if (mainTypeValue.page && typeof onReviewPointSelect === 'function') {
e.stopPropagation(); e.stopPropagation();
onReviewPointSelect(reviewPoint.id, Number(mainTypeValue.page)); onReviewPointSelect(reviewPoint.id, Number(mainTypeValue.page));
}else{
toastService.error(`没有找到${fieldKey}对应的索引内容`);
} }
}} }}
onKeyDown={(e) => { onKeyDown={(e) => {
@@ -1059,6 +1084,8 @@ export function ReviewPointsList({
e.preventDefault(); e.preventDefault();
if (mainTypeValue.page && typeof onReviewPointSelect === 'function') { if (mainTypeValue.page && typeof onReviewPointSelect === 'function') {
onReviewPointSelect(reviewPoint.id, Number(mainTypeValue.page)); onReviewPointSelect(reviewPoint.id, Number(mainTypeValue.page));
}else{
toastService.error(`没有找到${fieldKey}对应的索引内容`);
} }
} }
}} }}
@@ -1069,6 +1096,9 @@ export function ReviewPointsList({
{/* 字段名称 */} {/* 字段名称 */}
<div className="text-xs text-gray-500 mb-1"> <div className="text-xs text-gray-500 mb-1">
{fieldKey} {fieldKey}
{!mainTypeValue.page && !mainTypeValue.value && (
<i className="ri-information-line text-red-500 text-xs ml-1"></i>
)}
{/* 缺失显示 */} {/* 缺失显示 */}
{mainTypeValue.res === false && !mainTypeValue.value && ( {mainTypeValue.res === false && !mainTypeValue.value && (
<span className="ml-2 text-xs text-yellow-500"> <span className="ml-2 text-xs text-yellow-500">