diff --git a/app/components/reviews/ReviewPointsList.tsx b/app/components/reviews/ReviewPointsList.tsx index 68f8797..f8b684c 100644 --- a/app/components/reviews/ReviewPointsList.tsx +++ b/app/components/reviews/ReviewPointsList.tsx @@ -44,6 +44,28 @@ const getCompareMethodText = (method?: string): string => { return typeof text === 'string' ? text : String(text); }; +/** + * 规则类型映射 + * 将后端返回的规则类型英文值映射为友好的中文显示 + */ +const ruleTypeMap: Record = { + 'exists': '有无判断', + 'format': '格式判断', + 'logic': '逻辑判断', + 'regex': '正则表达式', + // 可以根据需要添加更多映射 +}; + +/** + * 获取规则类型的中文显示 + * @param type 规则类型的原始值 + * @returns 映射后的中文显示文本 + */ +const getRuleTypeText = (type?: string): string => { + if (!type) return ''; + return ruleTypeMap[type] || type; +}; + /** * 评查点类型定义 * 用于展示单个评查结果 @@ -200,13 +222,13 @@ export function ReviewPointsList({ } // 将参数输出到控制台 - console.log('评查点审核操作', { - id: reviewPointResultId, - editAuditStatusId: editAuditStatusId, - action: action, - content: message, - status: action === 'approve' ? 'true' : (action === 'reject' ? 'false' : 'review') - }); + // console.log('评查点审核操作', { + // id: reviewPointResultId, + // editAuditStatusId: editAuditStatusId, + // action: action, + // content: message, + // status: action === 'approve' ? 'true' : (action === 'reject' ? 'false' : 'review') + // }); // 清除编辑状态 setEditingReviewPoint(null); @@ -460,7 +482,7 @@ export function ReviewPointsList({ const renderHumanReviewBadge = (reviewPoint: ReviewPoint) => { if (reviewPoint.postAction === 'manual') { return ( - + 需人工 ); @@ -498,23 +520,28 @@ export function ReviewPointsList({ const renderContent = (reviewPoint: ReviewPoint, otherRules: Array>) => { return ( <> - {/* 渲染其他规则分组 */} {otherRules.map((rule, index) => { return
{renderOtherRule(rule, reviewPoint)}
; })} -
+ {/*
*/} {/* 渲染各个一致性的规则分组 */} {reviewPoint.evaluatedPointResultsLog?.rules?.map((rule, index) => { // console.log('rule-------', rule); if (rule.type === 'consistency') { // console.log('rule-------', rule); - return
{renderConsistencyRule(rule, reviewPoint)}
; + return
+
+ {renderConsistencyRule(rule, reviewPoint)} +
; } if (rule.type === 'ai') { - return
{renderModelRule(rule, reviewPoint)}
; + return
+
+ {renderModelRule(rule, reviewPoint)} +
; } @@ -857,7 +884,8 @@ export function ReviewPointsList({ const itemClassName = res ? "comparison-item match" : "comparison-item mismatch"; - + + // console.log('currentchain-------', chain); // 如果是长链(3个或以上元素) if (isLongChain) { // console.log('currentlongchain-------', chain); @@ -947,12 +975,38 @@ export function ReviewPointsList({ ))} -
+
{res ? ( ) : ( )} + {/* 悬停提示框 - 横向布局 */} +
+
+ {/*
规则检查结果
*/} +
+ {chain.map((item, idx) => + idx >= 1 ? ( +
+
+ {typeof item.compareMethod === 'object' + ? '' + : getCompareMethodText(item.compareMethod)} +
+
+ {res ? '通过' : '不通过'} +
+
+ ) : null + )} +
+
+
+
@@ -960,7 +1014,7 @@ export function ReviewPointsList({ } // 如果是标准的成对比较(2个元素) - // console.log('currentpairchain-------', chain); + return (
{chain[1].data.value?.toString() || ''}
-
+
{res ? ( ) : ( )} + {/* 悬停提示框 - 横向布局 */} +
+
+
+
+
+ {typeof chain[1].compareMethod === 'object' + ? '' + : getCompareMethodText(chain[1].compareMethod)} +
+
+ {res ? '通过' : '不通过'} +
+
+
+
+
+
); @@ -1068,7 +1144,7 @@ export function ReviewPointsList({ const [, mainTypeValue] = mainTypeEntry; return ( - ); @@ -1565,7 +1668,7 @@ export function ReviewPointsList({ return ( <> {checkContentPage(reviewPoint).pageIndex === 0 && ( -

该评查点无法找到索引内容,无法自动定位到对应页面。

+

该评查点无法找到索引内容,无法自动定位到对应页面。

)}
{/* {reviewPoint.suggestion && ( @@ -1632,7 +1735,7 @@ export function ReviewPointsList({ return ( <> {checkContentPage(reviewPoint).pageIndex === 0 && ( -

该评查点无法找到索引内容,无法自动定位到对应页面。

+

该评查点无法找到索引内容,无法自动定位到对应页面。

)} {/* 评查点内容显示区域 */} {reviewPoint.content && Object.entries(reviewPoint.content).length > 0 && ( @@ -1646,11 +1749,11 @@ export function ReviewPointsList({ } return ( -
+
{/* 没有索引内容提示 */} {checkContentPage(reviewPoint).pageIndex === 0 && ( -

该评查点无法找到索引内容,无法自动定位到对应页面。

+

该评查点无法找到索引内容,无法自动定位到对应页面。

)} {/* 建议内容显示区域 */} @@ -1886,12 +1989,12 @@ export function ReviewPointsList({ key={reviewPoint.id} className={`rounded-md review-point-item ${activeReviewPointResultId === reviewPoint.id ? 'active border-l-4 border-l-[#00684a] shadow-md' : 'border-l-4 border-l-transparent'} transition-all duration-300 ease-in-out - hover:shadow-lg hover:-translate-x-0.5 hover:bg-[rgba(0,0,0,0.02)]`} + hover:shadow-lg hover:-translate-x-0.5 hover:bg-[rgba(0,0,0,0.02)] my-2`} role="button" tabIndex={0} style={{ userSelect: 'text' }} onClick={() => { - console.log('reviewPoint', reviewPoint); + // console.log('reviewPoint', reviewPoint); handleReviewPointClick(reviewPoint.id); }} onKeyDown={(e) => { @@ -1902,7 +2005,7 @@ export function ReviewPointsList({ > {/* 评查点标题和状态 */} {/* 评查点名称 pointName*/} -
+
{reviewPoint.pointName}
diff --git a/app/styles/reviews.css b/app/styles/reviews.css index 7eb386a..136d5e0 100644 --- a/app/styles/reviews.css +++ b/app/styles/reviews.css @@ -215,7 +215,7 @@ .review-point-item { /* box-sizing: border-box; */ /* margin: 10px; */ - padding: 10px; + padding: 5px 10px 10px 10px; /* border-bottom: 1px solid var(--border-color); */ cursor: pointer; width: 100%; @@ -225,7 +225,7 @@ .review-point-item:hover { /* background-color: #f5f5f5; */ /* box-shadow: 10px 10px 10px 3px rgba(250, 173, 20, 0.6); */ - transform: translateX(-1px); + transform: translateX(-2px); box-shadow: 1px 4px 10px rgba(0, 0, 0, 0.08); }