优化评查详情,新增信息提示框组件

This commit is contained in:
2025-04-23 20:48:32 +08:00
parent ee36ce2620
commit be99fdec79
15 changed files with 1399 additions and 757 deletions
+46 -46
View File
@@ -251,61 +251,61 @@ export async function getReviewPoints(fileId: string) {
}
// 提取页码数组
let contentPage: Record<string, object> = {};
let contentPage: Record<string, string> = {};
// console.log('result-------', result.evaluated_results?.result);
// console.log('datacontent-------', data);
if (data && typeof data === 'object') {
try {
const dataObj = data as Record<string, string>;
// 检查是否是预期的格式 {'立案报告表-完整性检查''缺失部分内容'}
for (const key in dataObj) {
if (Object.prototype.hasOwnProperty.call(dataObj, key)) {
// 使用'-'分割获取前缀(如'立案报告表')
const prefix = key.split('-')[0];
// console.log('prefix-------', prefix);
// 检查document.data中的ocrResult是否存在这个key
if (documentData.data?.ocrResult &&
typeof documentData.data.ocrResult === 'object') {
// try {
// const dataObj = data as Record<string, string>;
// // 检查是否是预期的格式 {'立案报告表-完整性检查''缺失部分内容'}
// for (const key in dataObj) {
// if (Object.prototype.hasOwnProperty.call(dataObj, key)) {
// // 使用'-'分割获取前缀(如'立案报告表')
// const prefix = key.split('-')[0];
// // console.log('prefix-------', prefix);
// // 检查document.data中的ocrResult是否存在这个key
// if (documentData.data?.ocrResult &&
// typeof documentData.data.ocrResult === 'object') {
// ocrResult可能有嵌套的ocr_result属性
let ocrData: OcrData = documentData.data.ocrResult as OcrData;
// // ocrResult可能有嵌套的ocr_result属性
// let ocrData: OcrData = documentData.data.ocrResult as OcrData;
// 检查是否有嵌套的ocr_result对象
if ('ocr_result' in ocrData &&
ocrData.ocr_result &&
typeof ocrData.ocr_result === 'object') {
ocrData = ocrData.ocr_result as OcrData;
}
// // 检查是否有嵌套的ocr_result对象
// if ('ocr_result' in ocrData &&
// ocrData.ocr_result &&
// typeof ocrData.ocr_result === 'object') {
// ocrData = ocrData.ocr_result as OcrData;
// }
for (const ocrKey in ocrData) {
// 如果找到匹配的key
if (ocrKey === prefix &&
ocrData[ocrKey] &&
typeof ocrData[ocrKey] === 'object' &&
'pages' in ocrData[ocrKey]) {
// for (const ocrKey in ocrData) {
// // 如果找到匹配的key
// if (ocrKey === prefix &&
// ocrData[ocrKey] &&
// typeof ocrData[ocrKey] === 'object' &&
// 'pages' in ocrData[ocrKey]) {
// 获取pages数组
const pages = ocrData[ocrKey].pages;
if (Array.isArray(pages)) {
// 存储每个key对应的页码数组
contentPage[key] = pages;
}
break;
}
}
}
}
}
}
// // 4-22 更改数据结构:通过拿到的data数据(每一个key对应一个object),将object中的page提取出来
// try{
// const dataObj = data as Record<string, object>;
// for (const key in dataObj) {
// if (Object.prototype.hasOwnProperty.call(dataObj, key)) {
// contentPage[key] = dataObj[key];
// // 获取pages数组
// const pages = ocrData[ocrKey].pages;
// if (Array.isArray(pages)) {
// // 存储每个key对应的页码数组
// contentPage[key] = pages;
// }
// break;
// }
// }
// }
// }
// }
// }
// }
// 4-22 更改数据结构:通过拿到的data数据(每一个key对应一个object),将object中的page提取出来
try{
const dataObj = data as Record<string, {page: number | string,value: string}>;
for (const key in dataObj) {
if (Object.prototype.hasOwnProperty.call(dataObj, key)) {
contentPage[key] = dataObj[key].page.toString();
}
}
}
catch (e) {
console.error('解析评查点data失败:', e);
contentPage = {};