优化评查详情提示框的提示条件
This commit is contained in:
@@ -19,6 +19,9 @@ const API_BASE_URL = 'http://nas.7bm.co:3000';
|
||||
// const API_BASE_URL = 'http://172.16.0.119:9000/admin';
|
||||
// export const API_BASE_URL = 'http://nas.7bm.co:3000';
|
||||
|
||||
// 文档URL前缀
|
||||
export const DOCUMENT_URL = 'http://172.18.0.100:9000/docauditai/';
|
||||
|
||||
// 是否使用模拟数据(开发环境使用)
|
||||
const USE_MOCK_DATA = false; // 设置为true使用模拟数据,避免API连接问题
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ interface OcrDataResult {
|
||||
}
|
||||
|
||||
interface OcrData {
|
||||
[key: string]: OcrDataResult | unknown;
|
||||
ocr_result?: Record<string, OcrDataResult | unknown>;
|
||||
ocr_result?: Record<string, OcrDataResult>;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,6 +254,7 @@ export async function getReviewPoints(fileId: string) {
|
||||
let contentPage: Record<string, string> = {};
|
||||
// console.log('result-------', result.evaluated_results?.result);
|
||||
// console.log('datacontent-------', data);
|
||||
// console.log('documentData-------', documentData);
|
||||
if (data && typeof data === 'object') {
|
||||
// 4-22 更改数据结构:通过拿到的data数据(每一个key对应一个object),将object中的page提取出来
|
||||
try{
|
||||
@@ -263,10 +264,19 @@ export async function getReviewPoints(fileId: string) {
|
||||
let newPage = dataObj[key].page.toString();
|
||||
// 如果newPage里面有文本,则把文本去掉
|
||||
if(newPage.match(/\d+/g)){
|
||||
newPage = newPage.match(/\d+/g)?.map(Number).join('') || '';
|
||||
newPage = newPage.match(/^\d+/g)?.map(Number).join('') || '';
|
||||
}
|
||||
contentPage[key] = newPage;
|
||||
}
|
||||
|
||||
// 如果contentPage[key]为空,则需要根据这个key去ocrResult中找到对应的key,然后根据ocrResult中的pages数组,找到对应的页码
|
||||
if(!contentPage[key]){
|
||||
// 分割key获取数组的第一位
|
||||
const keyArray = key.split('-');
|
||||
const ocrResult = documentData?.data?.ocrResult as OcrData;
|
||||
const pages = ocrResult?.ocr_result?.[keyArray[0]]?.pages;
|
||||
contentPage[key] = pages?.[0]?.toString() || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user