1、上传新增图片类型
2、审计内容的AI生成恢复生成报告接口
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
已加入 {{ queuedFileNames.length }} 个文件
|
已加入 {{ queuedFileNames.length }} 个文件
|
||||||
</div>
|
</div>
|
||||||
<a-upload-dragger
|
<a-upload-dragger
|
||||||
accept=".pdf,.doc,.docx,.txt,.md,.xls,.xlsx"
|
accept=".pdf,.doc,.docx,.txt,.md,.xls,.xlsx,.jpg,.png,.jpeg"
|
||||||
:show-upload-list="false"
|
:show-upload-list="false"
|
||||||
:customRequest="doUpload"
|
:customRequest="doUpload"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
|
|||||||
@@ -35,10 +35,19 @@
|
|||||||
</a-descriptions>
|
</a-descriptions>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-card style="margin-bottom: 20px; text-align: center; background: transparent" :bordered="false">
|
<a-card
|
||||||
|
style="margin-bottom: 20px; text-align: center; background: transparent"
|
||||||
|
:bordered="false"
|
||||||
|
>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-tooltip title="并行生成所有 9 个章节的内容(包含各小节)">
|
<a-tooltip title="并行生成所有 9 个章节的内容(包含各小节)">
|
||||||
<a-button size="large" type="primary" @click="handleGenerateAll" :loading="generatingAll" class="generate-all-button">
|
<a-button
|
||||||
|
size="large"
|
||||||
|
type="primary"
|
||||||
|
@click="handleGenerateAll"
|
||||||
|
:loading="generatingAll"
|
||||||
|
class="generate-all-button"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<UngroupOutlined />
|
<UngroupOutlined />
|
||||||
</template>
|
</template>
|
||||||
@@ -61,7 +70,12 @@
|
|||||||
加载草稿
|
加载草稿
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-button size="large" type="danger" class="export-button" @click="handleExport">
|
<a-button
|
||||||
|
size="large"
|
||||||
|
type="danger"
|
||||||
|
class="export-button"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<UploadOutlined />
|
<UploadOutlined />
|
||||||
</template>
|
</template>
|
||||||
@@ -73,10 +87,16 @@
|
|||||||
<!-- 快速导航 -->
|
<!-- 快速导航 -->
|
||||||
<a-card style="margin-bottom: 20px" :bordered="false">
|
<a-card style="margin-bottom: 20px" :bordered="false">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between;">
|
<div
|
||||||
|
style="
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
"
|
||||||
|
>
|
||||||
<span>快速导航</span>
|
<span>快速导航</span>
|
||||||
<a-tooltip title="快捷键:Ctrl+1~9 快速跳转,Ctrl+↑↓ 上下导航">
|
<a-tooltip title="快捷键:Ctrl+1~9 快速跳转,Ctrl+↑↓ 上下导航">
|
||||||
<QuestionCircleOutlined style="color: #999; cursor: help;"/>
|
<QuestionCircleOutlined style="color: #999; cursor: help" />
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -90,7 +110,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
@click="scrollToSection(index)"
|
@click="scrollToSection(index)"
|
||||||
class="nav-button"
|
class="nav-button"
|
||||||
:class="{ 'active': currentSection === index }"
|
:class="{ active: currentSection === index }"
|
||||||
>
|
>
|
||||||
<span class="nav-number">{{ item.number }}</span>
|
<span class="nav-number">{{ item.number }}</span>
|
||||||
<span class="nav-text">{{ item.name }}</span>
|
<span class="nav-text">{{ item.name }}</span>
|
||||||
@@ -102,7 +122,11 @@
|
|||||||
<div class="progress-bar">
|
<div class="progress-bar">
|
||||||
<div
|
<div
|
||||||
class="progress-fill"
|
class="progress-fill"
|
||||||
:style="{ width: `${((currentSection + 1) / navigationItems.length) * 100}%` }"
|
:style="{
|
||||||
|
width: `${
|
||||||
|
((currentSection + 1) / navigationItems.length) * 100
|
||||||
|
}%`
|
||||||
|
}"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress-text">
|
<div class="progress-text">
|
||||||
@@ -170,34 +194,72 @@
|
|||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- 单内容部分 -->
|
<!-- 单内容部分 -->
|
||||||
<template v-if="!item.children">
|
<template v-if="!item.children">
|
||||||
<div class="content-with-ai-button">
|
<!-- <div class="content-with-ai-button">-->
|
||||||
|
<!-- <a-textarea-->
|
||||||
|
<!-- v-model:value="item.content"-->
|
||||||
|
<!-- :rows="item.rows || 8"-->
|
||||||
|
<!-- :placeholder="'点击 (AI 生成) 按钮让 AI 为您生成该部分内容,或直接填入'"-->
|
||||||
|
<!-- class="content-textarea"-->
|
||||||
|
<!-- style="background-color: #f0fdf4"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- <a-button-->
|
||||||
|
<!-- type="primary"-->
|
||||||
|
<!-- size="large"-->
|
||||||
|
<!-- @click="generateContent(index)"-->
|
||||||
|
<!-- :loading="item.generating"-->
|
||||||
|
<!-- class="ai-generate-btn"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <template #icon>-->
|
||||||
|
<!-- <RobotOutlined/>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- AI 生成-->
|
||||||
|
<!-- </a-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
<a-textarea
|
<a-textarea
|
||||||
v-model:value="item.content"
|
v-model:value="item.content"
|
||||||
:rows="item.rows || 8"
|
:rows="item.rows || 8"
|
||||||
:placeholder="'点击(AI生成)按钮让AI为您生成该部分内容,或直接填入'"
|
:placeholder="'点击(AI生成)按钮让AI为您生成该部分内容,或直接填入'"
|
||||||
class="content-textarea"
|
class="content-textarea"
|
||||||
style="background-color: #f0fdf4"
|
style="margin-top: 16px; background-color: #f0fdf4"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div style="margin-top: 12px">
|
||||||
|
<div class="question-prompt">AI小助手</div>
|
||||||
|
<div class="textarea-with-button" style="width: 600px">
|
||||||
|
<a-textarea
|
||||||
|
v-model:value="item.suggestion"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入您的要求并回车..."
|
||||||
|
class="suggestion-textarea-inner"
|
||||||
|
@pressEnter="generateContent(index)"
|
||||||
/>
|
/>
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="danger"
|
||||||
size="large"
|
size="small"
|
||||||
@click="generateContent(index)"
|
@click="generateContent(index)"
|
||||||
:loading="item.generating"
|
:loading="item.generating"
|
||||||
class="ai-generate-btn"
|
class="send-button-inner"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<RobotOutlined />
|
<RobotOutlined />
|
||||||
</template>
|
</template>
|
||||||
AI 生成
|
发送
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 多内容部分 -->
|
<!-- 多内容部分 -->
|
||||||
<template v-if="item.children">
|
<template v-if="item.children">
|
||||||
<div v-for="(child, childIndex) in item.children" :key="childIndex" class="child-section">
|
<div
|
||||||
|
v-for="(child, childIndex) in item.children"
|
||||||
|
:key="childIndex"
|
||||||
|
class="child-section"
|
||||||
|
>
|
||||||
<div class="child-header">
|
<div class="child-header">
|
||||||
<span class="child-title">{{ `(${childIndex + 1})${child.name}` }}</span>
|
<span class="child-title">{{
|
||||||
|
`(${childIndex + 1})${child.name}`
|
||||||
|
}}</span>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -260,7 +322,7 @@ import {ref, reactive, watch, onMounted, onUnmounted} from 'vue';
|
|||||||
import { Form, message } from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject } from 'ele-admin-pro';
|
import { assignObject } from 'ele-admin-pro';
|
||||||
import { copyText } from '@/utils/common';
|
import { copyText } from '@/utils/common';
|
||||||
import {PwlProject} from "@/api/pwl/pwlProject/model";
|
import { PwlProject } from '@/api/pwl/pwlProject/model';
|
||||||
import {
|
import {
|
||||||
UngroupOutlined,
|
UngroupOutlined,
|
||||||
DownloadOutlined,
|
DownloadOutlined,
|
||||||
@@ -271,7 +333,13 @@ import {
|
|||||||
ReloadOutlined,
|
ReloadOutlined,
|
||||||
SaveOutlined
|
SaveOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import {generateDefaultText, downloadAuditReport, queryAuditReport, saveAuditReport} from "@/api/ai/auditReport";
|
import {
|
||||||
|
generateDefaultText,
|
||||||
|
downloadAuditReport,
|
||||||
|
queryAuditReport,
|
||||||
|
saveAuditReport,
|
||||||
|
generateAuditReport
|
||||||
|
} from '@/api/ai/auditReport';
|
||||||
import { getPwlProjectLibraryByIds } from '@/api/pwl/pwlProjectLibrary';
|
import { getPwlProjectLibraryByIds } from '@/api/pwl/pwlProjectLibrary';
|
||||||
|
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
@@ -371,7 +439,8 @@ const navigationItems = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '(四)审计期间合并口径年度资产负债及各项业务总体情况',
|
name: '(四)审计期间合并口径年度资产负债及各项业务总体情况',
|
||||||
placeholder: '请输入审计期间合并口径年度资产负债及各项业务总体情况...',
|
placeholder:
|
||||||
|
'请输入审计期间合并口径年度资产负债及各项业务总体情况...',
|
||||||
content: '',
|
content: '',
|
||||||
suggestion: '',
|
suggestion: '',
|
||||||
formCommit: 44,
|
formCommit: 44,
|
||||||
@@ -398,7 +467,8 @@ const navigationItems = ref([
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: '(一)贯彻执行党和国家有关经济方针和上级决策部署情况',
|
name: '(一)贯彻执行党和国家有关经济方针和上级决策部署情况',
|
||||||
placeholder: '请输入贯彻执行党和国家有关经济方针和上级决策部署情况...',
|
placeholder:
|
||||||
|
'请输入贯彻执行党和国家有关经济方针和上级决策部署情况...',
|
||||||
content: '',
|
content: '',
|
||||||
suggestion: '',
|
suggestion: '',
|
||||||
formCommit: 51,
|
formCommit: 51,
|
||||||
@@ -409,7 +479,8 @@ const navigationItems = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '(二)公司发展战略规划的制定、执行和效果情况以及年度责任目标完成情况',
|
name: '(二)公司发展战略规划的制定、执行和效果情况以及年度责任目标完成情况',
|
||||||
placeholder: '请输入公司发展战略规划的制定、执行和效果情况以及年度责任目标完成情况...',
|
placeholder:
|
||||||
|
'请输入公司发展战略规划的制定、执行和效果情况以及年度责任目标完成情况...',
|
||||||
content: '',
|
content: '',
|
||||||
suggestion: '',
|
suggestion: '',
|
||||||
formCommit: 52,
|
formCommit: 52,
|
||||||
@@ -431,7 +502,8 @@ const navigationItems = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '(四)公司法人治理结构的建立、健全和运行情况,内部控制制度的制定和执行情况',
|
name: '(四)公司法人治理结构的建立、健全和运行情况,内部控制制度的制定和执行情况',
|
||||||
placeholder: '请输入公司法人治理结构的建立、健全和运行情况,内部控制制度的制定和执行情况...',
|
placeholder:
|
||||||
|
'请输入公司法人治理结构的建立、健全和运行情况,内部控制制度的制定和执行情况...',
|
||||||
content: '',
|
content: '',
|
||||||
suggestion: '',
|
suggestion: '',
|
||||||
formCommit: 54,
|
formCommit: 54,
|
||||||
@@ -442,7 +514,8 @@ const navigationItems = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '(五)公司财务的真实合法效益情况,风险管控情况,境外资产管理情况',
|
name: '(五)公司财务的真实合法效益情况,风险管控情况,境外资产管理情况',
|
||||||
placeholder: '请输入公司财务的真实合法效益情况,风险管控情况,境外资产管理情况...',
|
placeholder:
|
||||||
|
'请输入公司财务的真实合法效益情况,风险管控情况,境外资产管理情况...',
|
||||||
content: '',
|
content: '',
|
||||||
suggestion: '',
|
suggestion: '',
|
||||||
formCommit: 55,
|
formCommit: 55,
|
||||||
@@ -453,7 +526,8 @@ const navigationItems = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '(六)在经济活动中落实有关党风廉政建设责任和遵守廉洁从业规定情况',
|
name: '(六)在经济活动中落实有关党风廉政建设责任和遵守廉洁从业规定情况',
|
||||||
placeholder: '请输入在经济活动中落实有关党风廉政建设责任和遵守廉洁从业规定情况...',
|
placeholder:
|
||||||
|
'请输入在经济活动中落实有关党风廉政建设责任和遵守廉洁从业规定情况...',
|
||||||
content: '',
|
content: '',
|
||||||
suggestion: '',
|
suggestion: '',
|
||||||
formCommit: 56,
|
formCommit: 56,
|
||||||
@@ -490,7 +564,8 @@ const navigationItems = ref([
|
|||||||
number: '六',
|
number: '六',
|
||||||
name: '重要风险的识别及应对',
|
name: '重要风险的识别及应对',
|
||||||
title: '6、重要风险的识别及应对',
|
title: '6、重要风险的识别及应对',
|
||||||
description: '点击"AI 生成"按钮让 AI 为您生成该部分内容,或直接在下方编辑',
|
description:
|
||||||
|
'点击"AI 生成"按钮让 AI 为您生成该部分内容,或直接在下方编辑',
|
||||||
generating: false,
|
generating: false,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
@@ -654,7 +729,7 @@ const form = reactive<PwlProject>({
|
|||||||
// 修改时间
|
// 修改时间
|
||||||
updateTime: undefined,
|
updateTime: undefined,
|
||||||
// 知识库id
|
// 知识库id
|
||||||
kbId: undefined,
|
kbId: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
// 请求状态
|
// 请求状态
|
||||||
@@ -689,9 +764,9 @@ const handleGenerateAll = async () => {
|
|||||||
generatingAll.value = true;
|
generatingAll.value = true;
|
||||||
try {
|
try {
|
||||||
// 先清空所有内容
|
// 先清空所有内容
|
||||||
navigationItems.value.forEach(item => {
|
navigationItems.value.forEach((item) => {
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
item.children.forEach(child => {
|
item.children.forEach((child) => {
|
||||||
child.content = '';
|
child.content = '';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -730,7 +805,7 @@ const hasContent = (index: number) => {
|
|||||||
if (!section) return false;
|
if (!section) return false;
|
||||||
|
|
||||||
if (section.children) {
|
if (section.children) {
|
||||||
return section.children.some(child => child.content?.trim());
|
return section.children.some((child) => child.content?.trim());
|
||||||
}
|
}
|
||||||
return !!section.content?.trim();
|
return !!section.content?.trim();
|
||||||
};
|
};
|
||||||
@@ -760,17 +835,25 @@ const saveAllDrafts = async () => {
|
|||||||
tableType: 'audit_report',
|
tableType: 'audit_report',
|
||||||
content: '', // 主章节内容为空
|
content: '', // 主章节内容为空
|
||||||
formCommit: navItem.formCommit,
|
formCommit: navItem.formCommit,
|
||||||
records: [{
|
records: [
|
||||||
|
{
|
||||||
name: child.name,
|
name: child.name,
|
||||||
content: child.content || '',
|
content: child.content || '',
|
||||||
formCommit: child.formCommit
|
formCommit: child.formCommit
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// 构建当前小节的预览 HTML
|
// 构建当前小节的预览 HTML
|
||||||
let previewHtml = '<div class="audit-report">';
|
let previewHtml = '<div class="audit-report">';
|
||||||
previewHtml += `<h3>${currentChildData.number}、${currentChildData.name}${currentChildData.title ? ' - ' + currentChildData.title : ''}</h3>`;
|
previewHtml += `<h3>${currentChildData.number}、${
|
||||||
previewHtml += `<div><strong>${child.name}:</strong> ${child.content || ''}</div>`;
|
currentChildData.name
|
||||||
|
}${
|
||||||
|
currentChildData.title ? ' - ' + currentChildData.title : ''
|
||||||
|
}</h3>`;
|
||||||
|
previewHtml += `<div><strong>${child.name}:</strong> ${
|
||||||
|
child.content || ''
|
||||||
|
}</div>`;
|
||||||
previewHtml += '</div>';
|
previewHtml += '</div>';
|
||||||
|
|
||||||
await saveAuditReport({
|
await saveAuditReport({
|
||||||
@@ -787,7 +870,9 @@ const saveAllDrafts = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
savedCount++;
|
savedCount++;
|
||||||
console.log(`[保存草稿] 已保存:${navItem.number}、${navItem.name} - ${child.name}, formCommit: ${child.formCommit}`);
|
console.log(
|
||||||
|
`[保存草稿] 已保存:${navItem.number}、${navItem.name} - ${child.name}, formCommit: ${child.formCommit}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 无子项,直接保存主章节
|
// 无子项,直接保存主章节
|
||||||
@@ -803,7 +888,11 @@ const saveAllDrafts = async () => {
|
|||||||
|
|
||||||
// 构建当前章节的预览 HTML
|
// 构建当前章节的预览 HTML
|
||||||
let previewHtml = '<div class="audit-report">';
|
let previewHtml = '<div class="audit-report">';
|
||||||
previewHtml += `<h3>${currentSectionData.number}、${currentSectionData.name}${currentSectionData.title ? ' - ' + currentSectionData.title : ''}</h3>`;
|
previewHtml += `<h3>${currentSectionData.number}、${
|
||||||
|
currentSectionData.name
|
||||||
|
}${
|
||||||
|
currentSectionData.title ? ' - ' + currentSectionData.title : ''
|
||||||
|
}</h3>`;
|
||||||
if (currentSectionData.content) {
|
if (currentSectionData.content) {
|
||||||
previewHtml += `<div>${currentSectionData.content}</div>`;
|
previewHtml += `<div>${currentSectionData.content}</div>`;
|
||||||
}
|
}
|
||||||
@@ -823,7 +912,9 @@ const saveAllDrafts = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
savedCount++;
|
savedCount++;
|
||||||
console.log(`[保存草稿] 已保存:${navItem.number}、${navItem.name}, formCommit: ${navItem.formCommit}`);
|
console.log(
|
||||||
|
`[保存草稿] 已保存:${navItem.number}、${navItem.name}, formCommit: ${navItem.formCommit}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,13 +939,13 @@ const loadDrafts = async () => {
|
|||||||
|
|
||||||
// 收集所有的 formCommit 值(包括主章节和所有小节)
|
// 收集所有的 formCommit 值(包括主章节和所有小节)
|
||||||
const formCommits: number[] = [];
|
const formCommits: number[] = [];
|
||||||
navigationItems.value.forEach(item => {
|
navigationItems.value.forEach((item) => {
|
||||||
if (item.formCommit) {
|
if (item.formCommit) {
|
||||||
// 主章节有 formCommit,直接使用
|
// 主章节有 formCommit,直接使用
|
||||||
formCommits.push(item.formCommit);
|
formCommits.push(item.formCommit);
|
||||||
} else if (item.children && item.children.length > 0) {
|
} else if (item.children && item.children.length > 0) {
|
||||||
// 有子项的章节,收集所有小节的 formCommit
|
// 有子项的章节,收集所有小节的 formCommit
|
||||||
item.children.forEach(child => {
|
item.children.forEach((child) => {
|
||||||
if (child.formCommit) {
|
if (child.formCommit) {
|
||||||
formCommits.push(child.formCommit);
|
formCommits.push(child.formCommit);
|
||||||
}
|
}
|
||||||
@@ -884,7 +975,7 @@ const loadDrafts = async () => {
|
|||||||
|
|
||||||
// 解析并填充数据
|
// 解析并填充数据
|
||||||
let hasData = false;
|
let hasData = false;
|
||||||
results.forEach(result => {
|
results.forEach((result) => {
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
hasData = true;
|
hasData = true;
|
||||||
const reportContent = JSON.parse(result.data.reportContent || '{}');
|
const reportContent = JSON.parse(result.data.reportContent || '{}');
|
||||||
@@ -893,24 +984,40 @@ const loadDrafts = async () => {
|
|||||||
const section = reportContent.sections[0];
|
const section = reportContent.sections[0];
|
||||||
if (section) {
|
if (section) {
|
||||||
// 找到对应的 navigationItem(通过匹配任意一个 formCommit)
|
// 找到对应的 navigationItem(通过匹配任意一个 formCommit)
|
||||||
const navItemIndex = navigationItems.value.findIndex(item =>
|
const navItemIndex = navigationItems.value.findIndex(
|
||||||
|
(item) =>
|
||||||
item.formCommit === result.formCommit ||
|
item.formCommit === result.formCommit ||
|
||||||
(item.children && item.children.some(child => child.formCommit === result.formCommit))
|
(item.children &&
|
||||||
|
item.children.some(
|
||||||
|
(child) => child.formCommit === result.formCommit
|
||||||
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (navItemIndex >= 0) {
|
if (navItemIndex >= 0) {
|
||||||
const navItem = navigationItems.value[navItemIndex];
|
const navItem = navigationItems.value[navItemIndex];
|
||||||
|
|
||||||
console.log(`[加载草稿] 恢复章节:${navItem.number}、${navItem.name}, formCommit: ${result.formCommit}`);
|
console.log(
|
||||||
|
`[加载草稿] 恢复章节:${navItem.number}、${navItem.name}, formCommit: ${result.formCommit}`
|
||||||
|
);
|
||||||
|
|
||||||
// 恢复内容
|
// 恢复内容
|
||||||
if (navItem.children && section.records && Array.isArray(section.records)) {
|
if (
|
||||||
|
navItem.children &&
|
||||||
|
section.records &&
|
||||||
|
Array.isArray(section.records)
|
||||||
|
) {
|
||||||
// 有子项,根据 formCommit 匹配每个小节
|
// 有子项,根据 formCommit 匹配每个小节
|
||||||
section.records.forEach((rec: any) => {
|
section.records.forEach((rec: any) => {
|
||||||
const childIndex = navItem.children.findIndex(child => child.formCommit === rec.formCommit);
|
const childIndex = navItem.children.findIndex(
|
||||||
|
(child) => child.formCommit === rec.formCommit
|
||||||
|
);
|
||||||
if (childIndex >= 0) {
|
if (childIndex >= 0) {
|
||||||
navItem.children[childIndex].content = rec.content || '';
|
navItem.children[childIndex].content = rec.content || '';
|
||||||
console.log(` - 恢复小节:${navItem.children[childIndex].name}, content length: ${rec.content?.length || 0}`);
|
console.log(
|
||||||
|
` - 恢复小节:${
|
||||||
|
navItem.children[childIndex].name
|
||||||
|
}, content length: ${rec.content?.length || 0}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!navItem.children && section.content) {
|
} else if (!navItem.children && section.content) {
|
||||||
@@ -918,7 +1025,10 @@ const loadDrafts = async () => {
|
|||||||
navItem.content = section.content || '';
|
navItem.content = section.content || '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn('[加载草稿] 未找到匹配的章节,formCommit:', result.formCommit);
|
console.warn(
|
||||||
|
'[加载草稿] 未找到匹配的章节,formCommit:',
|
||||||
|
result.formCommit
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -958,7 +1068,9 @@ const saveSectionContent = async (sectionIndex: number) => {
|
|||||||
for (const child of section.children) {
|
for (const child of section.children) {
|
||||||
// 检查内容是否为空,为空则跳过不保存
|
// 检查内容是否为空,为空则跳过不保存
|
||||||
if (!child.content || !child.content.trim()) {
|
if (!child.content || !child.content.trim()) {
|
||||||
console.log(`[保存整章] 跳过空内容:${section.number}、${section.name} - ${child.name}`);
|
console.log(
|
||||||
|
`[保存整章] 跳过空内容:${section.number}、${section.name} - ${child.name}`
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -969,17 +1081,25 @@ const saveSectionContent = async (sectionIndex: number) => {
|
|||||||
tableType: 'audit_report',
|
tableType: 'audit_report',
|
||||||
content: '', // 主章节内容为空
|
content: '', // 主章节内容为空
|
||||||
formCommit: section.formCommit,
|
formCommit: section.formCommit,
|
||||||
records: [{
|
records: [
|
||||||
|
{
|
||||||
name: child.name,
|
name: child.name,
|
||||||
content: child.content || '',
|
content: child.content || '',
|
||||||
formCommit: child.formCommit
|
formCommit: child.formCommit
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// 构建当前小节的预览 HTML
|
// 构建当前小节的预览 HTML
|
||||||
let previewHtml = '<div class="audit-report">';
|
let previewHtml = '<div class="audit-report">';
|
||||||
previewHtml += `<h3>${currentChildData.number}、${currentChildData.name}${currentChildData.title ? ' - ' + currentChildData.title : ''}</h3>`;
|
previewHtml += `<h3>${currentChildData.number}、${
|
||||||
previewHtml += `<div><strong>${child.name}:</strong> ${child.content || ''}</div>`;
|
currentChildData.name
|
||||||
|
}${
|
||||||
|
currentChildData.title ? ' - ' + currentChildData.title : ''
|
||||||
|
}</h3>`;
|
||||||
|
previewHtml += `<div><strong>${child.name}:</strong> ${
|
||||||
|
child.content || ''
|
||||||
|
}</div>`;
|
||||||
previewHtml += '</div>';
|
previewHtml += '</div>';
|
||||||
|
|
||||||
await saveAuditReport({
|
await saveAuditReport({
|
||||||
@@ -996,19 +1116,25 @@ const saveSectionContent = async (sectionIndex: number) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
savedChildrenCount++;
|
savedChildrenCount++;
|
||||||
console.log(`[保存整章] 已保存:${section.number}、${section.name} - ${child.name}, formCommit: ${child.formCommit}`);
|
console.log(
|
||||||
|
`[保存整章] 已保存:${section.number}、${section.name} - ${child.name}, formCommit: ${child.formCommit}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (savedChildrenCount === 0) {
|
if (savedChildrenCount === 0) {
|
||||||
message.info('该章节没有需要保存的内容(所有小节均为空)');
|
message.info('该章节没有需要保存的内容(所有小节均为空)');
|
||||||
} else {
|
} else {
|
||||||
message.success(`${section.number}、${section.name} 已保存(共 ${savedChildrenCount}/${section.children.length} 个小节)`);
|
message.success(
|
||||||
|
`${section.number}、${section.name} 已保存(共 ${savedChildrenCount}/${section.children.length} 个小节)`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 无子项,直接保存主章节
|
// 无子项,直接保存主章节
|
||||||
// 检查内容是否为空,为空则跳过不保存
|
// 检查内容是否为空,为空则跳过不保存
|
||||||
if (!section.content || !section.content.trim()) {
|
if (!section.content || !section.content.trim()) {
|
||||||
console.log(`[保存整章] 跳过空内容:${section.number}、${section.name}`);
|
console.log(
|
||||||
|
`[保存整章] 跳过空内容:${section.number}、${section.name}`
|
||||||
|
);
|
||||||
message.info('该章节没有需要保存的内容');
|
message.info('该章节没有需要保存的内容');
|
||||||
sectionSaving[sectionIndex] = false;
|
sectionSaving[sectionIndex] = false;
|
||||||
return;
|
return;
|
||||||
@@ -1026,7 +1152,11 @@ const saveSectionContent = async (sectionIndex: number) => {
|
|||||||
|
|
||||||
// 只构建当前章节的预览 HTML
|
// 只构建当前章节的预览 HTML
|
||||||
let previewHtml = '<div class="audit-report">';
|
let previewHtml = '<div class="audit-report">';
|
||||||
previewHtml += `<h3>${currentSectionData.number}、${currentSectionData.name}${currentSectionData.title ? ' - ' + currentSectionData.title : ''}</h3>`;
|
previewHtml += `<h3>${currentSectionData.number}、${
|
||||||
|
currentSectionData.name
|
||||||
|
}${
|
||||||
|
currentSectionData.title ? ' - ' + currentSectionData.title : ''
|
||||||
|
}</h3>`;
|
||||||
if (currentSectionData.content) {
|
if (currentSectionData.content) {
|
||||||
previewHtml += `<div>${currentSectionData.content}</div>`;
|
previewHtml += `<div>${currentSectionData.content}</div>`;
|
||||||
}
|
}
|
||||||
@@ -1087,17 +1217,23 @@ const saveChildContent = async (sectionIndex: number, childIndex: number) => {
|
|||||||
tableType: 'audit_report',
|
tableType: 'audit_report',
|
||||||
content: '', // 主章节内容为空
|
content: '', // 主章节内容为空
|
||||||
formCommit: section.formCommit,
|
formCommit: section.formCommit,
|
||||||
records: [{
|
records: [
|
||||||
|
{
|
||||||
name: child.name,
|
name: child.name,
|
||||||
content: child.content || '',
|
content: child.content || '',
|
||||||
formCommit: child.formCommit
|
formCommit: child.formCommit
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// 构建当前小节的预览 HTML
|
// 构建当前小节的预览 HTML
|
||||||
let previewHtml = '<div class="audit-report">';
|
let previewHtml = '<div class="audit-report">';
|
||||||
previewHtml += `<h3>${currentChildData.number}、${currentChildData.name}${currentChildData.title ? ' - ' + currentChildData.title : ''}</h3>`;
|
previewHtml += `<h3>${currentChildData.number}、${currentChildData.name}${
|
||||||
previewHtml += `<div><strong>${child.name}:</strong> ${child.content || ''}</div>`;
|
currentChildData.title ? ' - ' + currentChildData.title : ''
|
||||||
|
}</h3>`;
|
||||||
|
previewHtml += `<div><strong>${child.name}:</strong> ${
|
||||||
|
child.content || ''
|
||||||
|
}</div>`;
|
||||||
previewHtml += '</div>';
|
previewHtml += '</div>';
|
||||||
|
|
||||||
// 调用保存接口(使用当前小节的 formCommit)
|
// 调用保存接口(使用当前小节的 formCommit)
|
||||||
@@ -1140,10 +1276,14 @@ const reloadSectionData = async (sectionIndex: number) => {
|
|||||||
try {
|
try {
|
||||||
// 如果章节有子项,需要查询所有子项的数据
|
// 如果章节有子项,需要查询所有子项的数据
|
||||||
if (section.children && section.children.length > 0) {
|
if (section.children && section.children.length > 0) {
|
||||||
console.log(`[重载章节数据] 开始重载有子项的章节:${section.number}、${section.name}`);
|
console.log(
|
||||||
|
`[重载章节数据] 开始重载有子项的章节:${section.number}、${section.name}`
|
||||||
|
);
|
||||||
|
|
||||||
// 收集所有子项的 formCommit
|
// 收集所有子项的 formCommit
|
||||||
const childFormCommits = section.children.map(child => child.formCommit).filter(fc => fc);
|
const childFormCommits = section.children
|
||||||
|
.map((child) => child.formCommit)
|
||||||
|
.filter((fc) => fc);
|
||||||
console.log(`[重载章节数据] 子项 formCommits:`, childFormCommits);
|
console.log(`[重载章节数据] 子项 formCommits:`, childFormCommits);
|
||||||
|
|
||||||
// 并行查询所有子项的数据
|
// 并行查询所有子项的数据
|
||||||
@@ -1165,16 +1305,25 @@ const reloadSectionData = async (sectionIndex: number) => {
|
|||||||
|
|
||||||
// 解析并填充每个子项的数据
|
// 解析并填充每个子项的数据
|
||||||
let loadedCount = 0;
|
let loadedCount = 0;
|
||||||
results.forEach(result => {
|
results.forEach((result) => {
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
const reportContent = JSON.parse(result.data.reportContent || '{}');
|
const reportContent = JSON.parse(result.data.reportContent || '{}');
|
||||||
|
|
||||||
if (reportContent.sections && Array.isArray(reportContent.sections)) {
|
if (
|
||||||
|
reportContent.sections &&
|
||||||
|
Array.isArray(reportContent.sections)
|
||||||
|
) {
|
||||||
const sectionData = reportContent.sections[0];
|
const sectionData = reportContent.sections[0];
|
||||||
if (sectionData && sectionData.records && Array.isArray(sectionData.records)) {
|
if (
|
||||||
|
sectionData &&
|
||||||
|
sectionData.records &&
|
||||||
|
Array.isArray(sectionData.records)
|
||||||
|
) {
|
||||||
// 找到对应的子项并填充数据
|
// 找到对应的子项并填充数据
|
||||||
sectionData.records.forEach((rec: any) => {
|
sectionData.records.forEach((rec: any) => {
|
||||||
const childIndex = section.children.findIndex(child => child.formCommit === rec.formCommit);
|
const childIndex = section.children.findIndex(
|
||||||
|
(child) => child.formCommit === rec.formCommit
|
||||||
|
);
|
||||||
if (childIndex >= 0) {
|
if (childIndex >= 0) {
|
||||||
section.children[childIndex].content = rec.content || '';
|
section.children[childIndex].content = rec.content || '';
|
||||||
loadedCount++;
|
loadedCount++;
|
||||||
@@ -1185,18 +1334,24 @@ const reloadSectionData = async (sectionIndex: number) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`[重载章节数据] 已加载 ${loadedCount}/${section.children.length} 个小节的数据`);
|
console.log(
|
||||||
|
`[重载章节数据] 已加载 ${loadedCount}/${section.children.length} 个小节的数据`
|
||||||
|
);
|
||||||
|
|
||||||
if (loadedCount === 0) {
|
if (loadedCount === 0) {
|
||||||
message.info('该章节暂无保存的数据');
|
message.info('该章节暂无保存的数据');
|
||||||
} else {
|
} else {
|
||||||
message.success(`${section.number}、${section.name} 数据已重新加载(共 ${loadedCount}/${section.children.length} 个小节)`);
|
message.success(
|
||||||
|
`${section.number}、${section.name} 数据已重新加载(共 ${loadedCount}/${section.children.length} 个小节)`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 无子项,直接加载主章节
|
// 无子项,直接加载主章节
|
||||||
const formCommitToUse = section.formCommit || 1;
|
const formCommitToUse = section.formCommit || 1;
|
||||||
|
|
||||||
console.log(`[重载章节数据] 开始重载主章节,sectionIndex: ${sectionIndex}, formCommit: ${formCommitToUse}`);
|
console.log(
|
||||||
|
`[重载章节数据] 开始重载主章节,sectionIndex: ${sectionIndex}, formCommit: ${formCommitToUse}`
|
||||||
|
);
|
||||||
|
|
||||||
const res: any = await queryAuditReport({
|
const res: any = await queryAuditReport({
|
||||||
projectId: form.id,
|
projectId: form.id,
|
||||||
@@ -1210,8 +1365,14 @@ const reloadSectionData = async (sectionIndex: number) => {
|
|||||||
const sectionData = reportContent.sections[0];
|
const sectionData = reportContent.sections[0];
|
||||||
if (sectionData) {
|
if (sectionData) {
|
||||||
section.content = sectionData.content || '';
|
section.content = sectionData.content || '';
|
||||||
console.log(`[重载章节数据] 已加载主章节内容,长度:${section.content?.length || 0}`);
|
console.log(
|
||||||
message.success(`${section.number}、${section.name} 数据已重新加载`);
|
`[重载章节数据] 已加载主章节内容,长度:${
|
||||||
|
section.content?.length || 0
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
message.success(
|
||||||
|
`${section.number}、${section.name} 数据已重新加载`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1228,7 +1389,10 @@ const reloadSectionData = async (sectionIndex: number) => {
|
|||||||
/**
|
/**
|
||||||
* 重载单个小节的数据
|
* 重载单个小节的数据
|
||||||
*/
|
*/
|
||||||
const reloadChildContent = async (sectionIndex: number, childIndex: number) => {
|
const reloadChildContent = async (
|
||||||
|
sectionIndex: number,
|
||||||
|
childIndex: number
|
||||||
|
) => {
|
||||||
if (!form.id) {
|
if (!form.id) {
|
||||||
message.warning('无项目信息');
|
message.warning('无项目信息');
|
||||||
return;
|
return;
|
||||||
@@ -1251,9 +1415,15 @@ const reloadChildContent = async (sectionIndex: number, childIndex: number) => {
|
|||||||
|
|
||||||
if (reportContent.sections && Array.isArray(reportContent.sections)) {
|
if (reportContent.sections && Array.isArray(reportContent.sections)) {
|
||||||
const sectionData = reportContent.sections[0]; // 取第一个章节
|
const sectionData = reportContent.sections[0]; // 取第一个章节
|
||||||
if (sectionData && sectionData.records && Array.isArray(sectionData.records)) {
|
if (
|
||||||
|
sectionData &&
|
||||||
|
sectionData.records &&
|
||||||
|
Array.isArray(sectionData.records)
|
||||||
|
) {
|
||||||
// 找到对应的小节记录
|
// 找到对应的小节记录
|
||||||
const record = sectionData.records.find((r: any) => r.formCommit === child.formCommit);
|
const record = sectionData.records.find(
|
||||||
|
(r: any) => r.formCommit === child.formCommit
|
||||||
|
);
|
||||||
if (record) {
|
if (record) {
|
||||||
child.content = record.content || '';
|
child.content = record.content || '';
|
||||||
message.success(`${child.name} 数据已重新加载`);
|
message.success(`${child.name} 数据已重新加载`);
|
||||||
@@ -1276,7 +1446,7 @@ const buildExportData = () => {
|
|||||||
from00: form.code,
|
from00: form.code,
|
||||||
from10: navigationItems.value[0].content,
|
from10: navigationItems.value[0].content,
|
||||||
from20: navigationItems.value[1].content,
|
from20: navigationItems.value[1].content,
|
||||||
from30: navigationItems.value[2].content,
|
from30: navigationItems.value[2].content
|
||||||
};
|
};
|
||||||
|
|
||||||
// 被审计单位基本情况
|
// 被审计单位基本情况
|
||||||
@@ -1346,9 +1516,9 @@ const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
|||||||
if (childIndex === undefined && !section.formCommit && section.children) {
|
if (childIndex === undefined && !section.formCommit && section.children) {
|
||||||
section.generating = true;
|
section.generating = true;
|
||||||
try {
|
try {
|
||||||
await Promise.all(section.children.map((_, i) =>
|
await Promise.all(
|
||||||
generateContent(sectionIndex, i)
|
section.children.map((_, i) => generateContent(sectionIndex, i))
|
||||||
));
|
);
|
||||||
} finally {
|
} finally {
|
||||||
section.generating = false;
|
section.generating = false;
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1551,19 @@ const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
|||||||
formCommit: formCommit,
|
formCommit: formCommit,
|
||||||
chapterTitle: chapterTitle
|
chapterTitle: chapterTitle
|
||||||
});
|
});
|
||||||
item.content = result;
|
// const content = result;
|
||||||
|
|
||||||
|
item.content = await generateAuditReport({
|
||||||
|
kbId: form.kbId || '',
|
||||||
|
kbIds: combinedKbIds.value,
|
||||||
|
formCommit: formCommit,
|
||||||
|
history: result || '',
|
||||||
|
suggestion: item.suggestion || '',
|
||||||
|
// 新增:传递完整的上下文数据
|
||||||
|
...contextData
|
||||||
|
});
|
||||||
|
// item.content = auditReportRes;
|
||||||
|
// console.log('auditReportRes', auditReportRes);
|
||||||
} finally {
|
} finally {
|
||||||
item.generating = false;
|
item.generating = false;
|
||||||
}
|
}
|
||||||
@@ -1402,7 +1584,8 @@ const handleScroll = () => {
|
|||||||
const section = sections[i];
|
const section = sections[i];
|
||||||
if (section) {
|
if (section) {
|
||||||
const sectionTop = section.getBoundingClientRect().top - containerTop;
|
const sectionTop = section.getBoundingClientRect().top - containerTop;
|
||||||
if (sectionTop <= 100) { // 100px 的偏移量
|
if (sectionTop <= 100) {
|
||||||
|
// 100px 的偏移量
|
||||||
currentSection.value = i;
|
currentSection.value = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1599,11 @@ const handleKeydown = (event: KeyboardEvent) => {
|
|||||||
if (!props.visible) return;
|
if (!props.visible) return;
|
||||||
|
|
||||||
// Ctrl/Cmd + 数字键 1-9 快速跳转
|
// Ctrl/Cmd + 数字键 1-9 快速跳转
|
||||||
if ((event.ctrlKey || event.metaKey) && event.key >= '1' && event.key <= '9') {
|
if (
|
||||||
|
(event.ctrlKey || event.metaKey) &&
|
||||||
|
event.key >= '1' &&
|
||||||
|
event.key <= '9'
|
||||||
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const index = parseInt(event.key) - 1;
|
const index = parseInt(event.key) - 1;
|
||||||
if (index < navigationItems.value.length) {
|
if (index < navigationItems.value.length) {
|
||||||
@@ -1431,14 +1618,16 @@ const handleKeydown = (event: KeyboardEvent) => {
|
|||||||
scrollToSection(prevIndex);
|
scrollToSection(prevIndex);
|
||||||
} else if (event.key === 'ArrowDown' && event.ctrlKey) {
|
} else if (event.key === 'ArrowDown' && event.ctrlKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const nextIndex = Math.min(navigationItems.value.length - 1, currentSection.value + 1);
|
const nextIndex = Math.min(
|
||||||
|
navigationItems.value.length - 1,
|
||||||
|
currentSection.value + 1
|
||||||
|
);
|
||||||
scrollToSection(nextIndex);
|
scrollToSection(nextIndex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
const save = () => {
|
const save = () => {};
|
||||||
};
|
|
||||||
|
|
||||||
// 组件挂载时添加滚动监听和键盘监听
|
// 组件挂载时添加滚动监听和键盘监听
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -1469,8 +1658,12 @@ watch(
|
|||||||
// 获取知识库并拼接 kbIds
|
// 获取知识库并拼接 kbIds
|
||||||
if (props.data.libraryIds?.length > 0) {
|
if (props.data.libraryIds?.length > 0) {
|
||||||
try {
|
try {
|
||||||
const result = await getPwlProjectLibraryByIds(props.data.libraryIds);
|
const result = await getPwlProjectLibraryByIds(
|
||||||
const kbIds = result.map(lib => lib.kbId).filter(kbId => kbId);
|
props.data.libraryIds
|
||||||
|
);
|
||||||
|
const kbIds = result
|
||||||
|
.map((lib) => lib.kbId)
|
||||||
|
.filter((kbId) => kbId);
|
||||||
if (form.kbId) {
|
if (form.kbId) {
|
||||||
kbIds.unshift(form.kbId);
|
kbIds.unshift(form.kbId);
|
||||||
}
|
}
|
||||||
@@ -1596,7 +1789,8 @@ export default {
|
|||||||
border: 2px solid #ff4d4f !important;
|
border: 2px solid #ff4d4f !important;
|
||||||
border-radius: 20px !important;
|
border-radius: 20px !important;
|
||||||
|
|
||||||
&:hover, &:focus {
|
&:hover,
|
||||||
|
&:focus {
|
||||||
border-color: #ff7875 !important;
|
border-color: #ff7875 !important;
|
||||||
box-shadow: 0 0 8px rgba(255, 77, 79, 0.3);
|
box-shadow: 0 0 8px rgba(255, 77, 79, 0.3);
|
||||||
}
|
}
|
||||||
@@ -1858,5 +2052,4 @@ export default {
|
|||||||
right: 30px;
|
right: 30px;
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user