diff --git a/app/api/evaluation_points/reviews.ts b/app/api/evaluation_points/reviews.ts
index afac551..d5616fa 100644
--- a/app/api/evaluation_points/reviews.ts
+++ b/app/api/evaluation_points/reviews.ts
@@ -344,12 +344,42 @@ export async function getReviewPoints(fileId: string) {
"config": {
"logic": "and",
"pairs": [
+ {
+ "sourceField": {"a":{page: 1,value: '张三'}},
+ "targetField": {"b":{page: 1,value: '张三'}},
+ "compareMethod": "exact",
+ "result": true
+ },
+ {
+ "sourceField": {"b":{page: 1,value: '张三'}},
+ "targetField": {"c":{page: 1,value: '张三'}},
+ "compareMethod": "exact",
+ "result": false
+ },
+ {
+ "sourceField": {"c":{page: 1,value: '张三'}},
+ "targetField": {"d":{page: 1,value: '张三'}},
+ "compareMethod": "exact",
+ "result": true
+ },
+ {
+ "sourceField": {"d":{page: 1,value: '张三'}},
+ "targetField": {"e":{page: 1,value: '张三'}},
+ "compareMethod": "exact",
+ "result": true
+ },
{
"sourceField": {"现场笔录-被检查人名称":{page: 1,value: '张三'}},
"targetField": {"证据复制(提取)单-营业执照-名称":{page: 1,value: '张三'}},
"compareMethod": "exact",
"result": true
},
+ {
+ "sourceField": {"证据复制(提取)单-营业执照-名称":{page: 1,value: '张三'}},
+ "targetField": {"证据复制(提取)单-营业执照-目录-名称":{page: 1,value: '张三'}},
+ "compareMethod": "exact",
+ "result": true
+ },
{
"sourceField": {"现场笔录-法定代表人(负责人)":{page: 1,value: '张三'}},
"targetField": {"证据复制(提取)单-营业执照-法定代表人":{page: 1,value: '张三'}},
@@ -364,9 +394,9 @@ export async function getReviewPoints(fileId: string) {
},
{
"sourceField": {"证据复制(提取)单-烟草专卖零售许可证-企业名称":{page: 1,value: '张三'}},
- "targetField": {"证据复制(提取)单-营业执照-名称":{page: 1,value: '张三'}},
+ "targetField": {"证据复制(提取)单-营业执照-名称":{page: 1,value: '张三拉萨看得见佛i啊是觉得离开房间啊善良的是的链接发了上帝就发垃圾袋的时间佛爱上立刻就阿拉山口大家分厘卡即使灯笼裤飞机啊顺利打开解放拉萨酱豆腐立刻阿萨到了经历多空双方叫阿里的肌肤垃圾收到了看见螺丝钉解放了啊撒旦解放垃圾的等级分类教师劳动纠纷爱丽丝的开发教师的肌肤啊撒旦解放考虑进来阿斯兰的看法骄傲'}},
"compareMethod": "exact",
- "result": true
+ "result": false
},
{
"sourceField": {"证据复制(提取)单-烟草专卖零售许可证-负责人姓名":{page: 1,value: '张三'}},
diff --git a/app/components/reviews/ReviewPointsList.tsx b/app/components/reviews/ReviewPointsList.tsx
index d6a8660..3309bd3 100644
--- a/app/components/reviews/ReviewPointsList.tsx
+++ b/app/components/reviews/ReviewPointsList.tsx
@@ -733,7 +733,8 @@ export function ReviewPointsList({
@@ -763,7 +764,17 @@ export function ReviewPointsList({
}
// 检查是否存在配置和pairs数组
- const config = singleReviewPoint.config as { logic?: string; pairs?: Array<{ sourceField: Record; targetField: Record; result: boolean }>; selectedFields?: string[] } | undefined;
+ const config = singleReviewPoint.config as {
+ logic?: string;
+ pairs?: Array<{
+ sourceField: Record;
+ targetField: Record;
+ result: boolean;
+ compareMethod?: string;
+ }>;
+ selectedFields?: string[]
+ } | undefined;
+
if (!config || !config.pairs || !Array.isArray(config.pairs) || config.pairs.length === 0) {
return null;
}
@@ -793,7 +804,8 @@ export function ReviewPointsList({
source: { key: string; page: number; value: string };
target: { key: string; page: number; value: string };
};
- result: boolean
+ result: boolean;
+ compareMethod?: string;
}>>();
pairs.forEach(pair => {
@@ -811,10 +823,11 @@ export function ReviewPointsList({
source: { key: sourceFieldKey, ...pair.sourceField[sourceFieldKey] },
target: { key: targetFieldKey, ...pair.targetField[targetFieldKey] }
},
- result: pair.result
+ result: pair.result,
+ compareMethod: pair.compareMethod
});
});
- console.log('fieldMap-------', fieldMap);
+ // console.log('fieldMap-------', fieldMap);
// 查找链条的起始点(只作为源不作为目标的字段)
const startPoints = new Set();
@@ -831,12 +844,13 @@ export function ReviewPointsList({
startPoints.add(key);
}
}
+ // console.log('startPoints-------', startPoints);
// 从每个起始点开始构建链条
for (const startPoint of startPoints) {
if (visited.has(startPoint)) continue;
- const chain: Array = [];
+ const tempChain: Array = [];
let currentField = startPoint;
// 向后构建链条
@@ -856,8 +870,8 @@ export function ReviewPointsList({
if (!nextTarget) break;
// 添加源字段到链条
- if (chain.length === 0) {
- chain.push({
+ if (tempChain.length === 0) {
+ tempChain.push({
field: currentField,
data: nextTarget.data.source,
result: nextTarget.result
@@ -865,7 +879,7 @@ export function ReviewPointsList({
}
// 添加目标字段到链条
- chain.push({
+ tempChain.push({
field: nextTarget.targetField,
data: nextTarget.data.target,
result: nextTarget.result
@@ -879,12 +893,69 @@ export function ReviewPointsList({
currentField = nextTarget.targetField;
}
- if (chain.length > 0) {
- chains.push(chain);
+ // console.log('tempChain-------', tempChain);
+ // 检查是否有链条,并处理链条断点
+ if (tempChain.length > 0) {
+ // 如果链条长度大于1
+ if (tempChain.length > 1) {
+ // 存储所有拆分后的链条
+ const splittedChains: Array> = [];
+
+ // 从后往前遍历,检查每个相邻元素之间的连接
+ let endIndex = tempChain.length - 1;
+
+ // 从倒数第一个元素开始往前遍历
+ for (let i = tempChain.length - 1; i > 0; i--) {
+ // 检查当前元素与前一个元素的连接是否为false
+ // 当前元素为tempChain[i],前一个元素为tempChain[i-1]
+ // 连接结果存储在当前元素(tempChain[i])的result中
+ const connectionResult = tempChain[i].result;
+
+ // 如果连接为false,或已到达起始位置,拆分链条
+ if (!connectionResult) {
+ // 从当前断点到结束索引构建一个新链条
+ const newChain = tempChain.slice(i, endIndex + 1);
+ if (newChain.length > 1) {
+ splittedChains.push(newChain);
+
+ // 将当前断点的前一个元素和后一个元素组成一个新链条
+ const newChain_before = tempChain.slice(i-1, i+1);
+ console.log('newChain_before-------', newChain_before);
+ splittedChains.push(newChain_before);
+ }
+
+ // 更新结束索引为当前位置的前一个
+ endIndex = i - 1;
+ }
+
+ // 当到达第一个元素前一个位置时,需要处理剩余的链条
+ if (i === 1) {
+ // 处理剩余部分 (0 到 endIndex)
+ const remainingChain = tempChain.slice(0, endIndex + 1);
+ if (remainingChain.length > 1) {
+ splittedChains.push(remainingChain);
+ }
+ }
+ }
+
+ // 如果没有任何断点,添加整个链条
+ if (splittedChains.length === 0) {
+ splittedChains.push([...tempChain]);
+ }
+
+ // 将拆分的链条添加到结果中
+ splittedChains.reverse().forEach(chain => {
+ chains.push(chain);
+ });
+ } else {
+ // 如果链条长度为1,直接添加
+ chains.push([...tempChain]);
+ }
}
}
+ // console.log('chains-------', chains);
- // 处理没有找到的孤立对
+ // 处理没有找到的孤立对(这种情况只要规则配置是没问题的,就一定不会存在孤立的情况)
for (const pair of pairs) {
const sourceFieldKey = Object.keys(pair.sourceField)[0];
const targetFieldKey = Object.keys(pair.targetField)[0];
@@ -919,7 +990,7 @@ export function ReviewPointsList({
{chains.map((chain, chainIndex) => {
const isLongChain = chain.length > 2;
- const result = chain[0].result;
+ const result = chain[1].result;
// 确定样式类名
const itemClassName = result
@@ -933,19 +1004,19 @@ export function ReviewPointsList({
key={`chain_${chainIndex}`}
className={`${itemClassName} border border-${result ? 'green' : 'yellow'}-200 rounded-md overflow-hidden mb-2 bg-${result ? 'green' : 'yellow'}-50`}
>
-
-
+
+
{chain.map((item, idx) => (
{item.field}
{idx < chain.length - 1 && (
-
+
)}
))}
-
+
{chain.map((item, idx) => (
))}
-
-
- {result ? (
-
- ) : (
-
- )}
+
+ {result ? (
+
+ ) : (
+
+ )}
+
);
@@ -993,10 +1064,11 @@ export function ReviewPointsList({
@@ -1028,7 +1102,6 @@ export function ReviewPointsList({
) : (
)}
- {result ? '一致' : '不一致'}
);