修复提示框文字换行问题
This commit is contained in:
@@ -255,54 +255,17 @@ export async function getReviewPoints(fileId: 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') {
|
||||
|
||||
// // 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;
|
||||
// }
|
||||
|
||||
// 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, {page: number | string,value: string}>;
|
||||
for (const key in dataObj) {
|
||||
if (Object.prototype.hasOwnProperty.call(dataObj, key)) {
|
||||
contentPage[key] = dataObj[key].page.toString();
|
||||
let newPage = dataObj[key].page.toString();
|
||||
// 如果newPage里面有文本,则把文本去掉
|
||||
if(newPage.match(/\d+/g)){
|
||||
newPage = newPage.match(/\d+/g)?.map(Number).join('') || '';
|
||||
}
|
||||
contentPage[key] = newPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user