From f0dec240a7db3a21eb4de1c5a84693afd84799f2 Mon Sep 17 00:00:00 2001 From: zhouhaibin Date: Mon, 23 Jun 2025 10:56:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=A8=E9=A1=B5=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=AE=9A=E4=BD=8D=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/PdfPreview/PageSelectModal.vue | 1 + .../src/PdfPreview/PdfPreviewComponent.vue | 9 ++-- src/components/UniversalResultDrawer.vue | 54 +++++++++++++++---- src/configs/documentTaskConfigs.ts | 14 ++--- 4 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/components/Preview/src/PdfPreview/PageSelectModal.vue b/src/components/Preview/src/PdfPreview/PageSelectModal.vue index 2aebb5f..9fa9ee2 100644 --- a/src/components/Preview/src/PdfPreview/PageSelectModal.vue +++ b/src/components/Preview/src/PdfPreview/PageSelectModal.vue @@ -7,6 +7,7 @@ width="400" :maskClosable="true" :closable="true" + :destroyOnClose="true" >

该文本在以下页面出现:

diff --git a/src/components/Preview/src/PdfPreview/PdfPreviewComponent.vue b/src/components/Preview/src/PdfPreview/PdfPreviewComponent.vue index 7fc5c99..9947f6c 100644 --- a/src/components/Preview/src/PdfPreview/PdfPreviewComponent.vue +++ b/src/components/Preview/src/PdfPreview/PdfPreviewComponent.vue @@ -254,8 +254,8 @@ } if (foundPages.length === 0) { - message.warning('未在PDF中找到该文本'); - return; + // message.warning('未在PDF中找到该文本'); + throw new Error('未在PDF中找到该文本'); } // 保存要高亮的文本(去除**标记后的) @@ -273,10 +273,7 @@ // 如果找到多个页面,弹出选择对话框 matchedPages.value = foundPages; showPageSelectModal.value = true; - } catch (error) { - console.error('文本定位失败:', error); - message.error('文本定位失败'); - } finally { + } finally { loading.value = false; loadingTip.value = ''; } diff --git a/src/components/UniversalResultDrawer.vue b/src/components/UniversalResultDrawer.vue index da4be56..a75f5cd 100644 --- a/src/components/UniversalResultDrawer.vue +++ b/src/components/UniversalResultDrawer.vue @@ -469,12 +469,21 @@ const dataToProcess = props.taskResultDetail.slice(1); // 跳过第一个数据 // 根据剩余数据生成标签页 - return dataToProcess.map((category, index) => ({ - key: category.name, // 使用数据的name作为key - label: `${category.name} (${category.results?.length || 0})`, - dataIndex: index + 1, // 记录在原数据中的索引(+1因为跳过了第一个) - name: category.name - })); + return dataToProcess.map((category, index) => { + let label = `${category.name} (${category.results?.length || 0})`; + + // 特殊处理:如果是实质性审查,加上审查立场 + if (category.name === '实质性审查' && props.taskInfo?.contractPartyRole) { + label = `(${props.taskInfo.contractPartyRole})实质性审查 (${category.results?.length || 0})`; + } + + return { + key: category.name, // 使用数据的name作为key + label: label, + dataIndex: index + 1, // 记录在原数据中的索引(+1因为跳过了第一个) + name: category.name + }; + }); }); // 过滤后的结果(用于标签模式) @@ -849,6 +858,12 @@ currentSelectItem.value = item; currentSelectCategoryIndex.value = categoryIndex; currentSelectItemIndex.value = itemIndex; + + // 清理当前字段的页面按钮数据,重新获取 + const fieldKey = getFieldKey(item, fieldConfig, categoryIndex, itemIndex); + console.log('fieldKey', fieldKey); + delete fieldPageButtons.value[fieldKey]; + console.log('fieldPageButtons', fieldPageButtons.value); } // 检查是否已经有页面按钮,如果有直接使用第一个页面 @@ -866,7 +881,7 @@ } try { - // 调用原有的PDF定位方法,让它自己处理单页面或显示弹窗 + // 先尝试用完整文本进行定位 await pdfContainerRef.value.locateByText(text, pdfSource); // 延迟检查是否出现了页面选择弹窗 @@ -874,7 +889,27 @@ checkForPageModal(); }, 300); // 等待弹窗显示 } catch (error) { - console.error('PDF定位失败:', error); + console.error('完整文本定位失败,尝试使用前10个字符定位:', error); + + // 如果完整文本定位失败,尝试用前10个字符再次定位 + const shortText = text.trim().substring(0, 10); + if (shortText && shortText !== text.trim()) { + try { + console.log('使用前10个字符进行定位:', shortText); + message.warning('完整文本定位失败,尝试使用前10个字符定位'); + await pdfContainerRef.value.locateByText(shortText, pdfSource); + + // 延迟检查是否出现了页面选择弹窗 + setTimeout(() => { + checkForPageModal(); + }, 300); // 等待弹窗显示 + } catch (shortError) { + console.error('前10个字符定位也失败:', shortError); + message.warning('文本定位失败,该内容可能不在PDF中'); + } + } else { + message.warning('文本定位失败,该内容可能不在PDF中'); + } } }; @@ -912,12 +947,13 @@ modalButtons.forEach(button => { const text = button.textContent || ''; + console.log('button', button.textContent); const match = text.match(/第(\d+)页/); if (match) { pages.push(parseInt(match[1])); } }); - + console.log('pages', pages); // 如果有字段信息,创建页面按钮 if (pages.length > 0 && currentSelectFieldConfig.value && currentSelectItem.value && currentSelectCategoryIndex.value !== null && currentSelectItemIndex.value !== null) { diff --git a/src/configs/documentTaskConfigs.ts b/src/configs/documentTaskConfigs.ts index 0cf749f..8e11ce5 100644 --- a/src/configs/documentTaskConfigs.ts +++ b/src/configs/documentTaskConfigs.ts @@ -7,7 +7,7 @@ export const DOCUMENT_TASK_CONFIGS: Record = { // 文档错误检查 "checkDocumentError": { taskType: "checkDocumentError", - name: "文档错误检查", + name: "文字错误检查", mode: "single", pdfConfig: { layout: "single", @@ -48,7 +48,7 @@ export const DOCUMENT_TASK_CONFIGS: Record = { // 重复文本检查 "checkRepeatText": { taskType: "checkRepeatText", - name: "重复文本检查", + name: "文档相似性检查", mode: "single", pdfConfig: { layout: "single", @@ -83,7 +83,7 @@ export const DOCUMENT_TASK_CONFIGS: Record = { // 全文重复检查 "allCheckRepeatText": { taskType: "allCheckRepeatText", - name: "全文重复检查", + name: "全文档相似性检查", mode: "single", pdfConfig: { layout: "single", @@ -140,7 +140,7 @@ export const DOCUMENT_TASK_CONFIGS: Record = { // 标题名称检查 "checkTitleName": { taskType: "checkTitleName", - name: "标题名称检查", + name: "文档结构检查", mode: "single", pdfConfig: { layout: "single", @@ -151,10 +151,10 @@ export const DOCUMENT_TASK_CONFIGS: Record = { fields: [ { field: 'modificationDisplay', - title: '相关原文', + title: '结构检查情况', dataType: 'string', displayType: 'markdown', - pdfSource: 'document' + // pdfSource: 'document' } ] }, @@ -184,7 +184,7 @@ export const DOCUMENT_TASK_CONFIGS: Record = { // 政策依据检查 "policyBases": { taskType: "policyBases", - name: "政策依据检查", + name: "建设依据检查", mode: "single", pdfConfig: { layout: "single",