优化审计内容生成功能-可指定文件、目录
This commit is contained in:
@@ -231,6 +231,8 @@ export async function generateDefaultText(params: {
|
||||
formCommit: number;
|
||||
chapterTitle?: string;
|
||||
evidenceIds?: number[]; // 新增:选中的取证单 ID 列表
|
||||
docList?: any[]; // 新增:选中的目录ID列表
|
||||
fileList?: any[]; // 新增:选中的文件ID列表
|
||||
}) {
|
||||
const res = await request.post<ApiResult<string>>(
|
||||
MODULES_API_URL + '/ai/auditReport/generateDefaultText',
|
||||
@@ -238,7 +240,9 @@ export async function generateDefaultText(params: {
|
||||
projectId: params.projectId,
|
||||
formCommit: params.formCommit,
|
||||
chapterTitle: params.chapterTitle,
|
||||
evidenceIds: params.evidenceIds
|
||||
evidenceIds: params.evidenceIds,
|
||||
docList: params.docList,
|
||||
fileList: params.fileList
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -108,6 +108,10 @@
|
||||
currentCompanyId: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'confirm', data: { dirKeys: (string | number)[], fileKeys: (string | number)[] }): void;
|
||||
}>();
|
||||
|
||||
// 树形结构相关
|
||||
const expandedKeys = ref<(string | number)[]>([]);
|
||||
const selectedKeys = ref<(string | number)[]>([]);
|
||||
@@ -184,6 +188,12 @@
|
||||
lastSelectedDirKeys.value = [...checkedDirKeys.value];
|
||||
lastSelectedFileKeys.value = [...selectedFileKeys.value];
|
||||
|
||||
// 传递选择的数据给父组件
|
||||
emit('confirm', {
|
||||
dirKeys: lastSelectedDirKeys.value,
|
||||
fileKeys: lastSelectedFileKeys.value
|
||||
});
|
||||
|
||||
message.success(
|
||||
`已选择 ${checkedDirKeys.value.length} 个目录和 ${selectedFileKeys.value.length} 个文件`
|
||||
);
|
||||
|
||||
@@ -488,7 +488,11 @@
|
||||
|
||||
<!-- 返回顶部按钮 -->
|
||||
<a-back-top :target="getScrollContainer" />
|
||||
<FileModal ref="fileModal" :current-company-id="currentCompanyId" />
|
||||
<FileModal
|
||||
ref="fileModal"
|
||||
:current-company-id="currentCompanyId"
|
||||
@confirm="handleFileSelectConfirm"
|
||||
/>
|
||||
<HistoryModal
|
||||
v-model:visible="showHistory"
|
||||
:interface-name="currentInterfaceName"
|
||||
@@ -593,7 +597,6 @@
|
||||
|
||||
// ========== 文档选择相关 ==========
|
||||
const fileModal = ref();
|
||||
const showDocSelect = ref(false);
|
||||
const currentSectionIndex = ref(0);
|
||||
const selectedDocList = ref<string[]>([]);
|
||||
const selectedFileList = ref<string[]>([]);
|
||||
@@ -731,10 +734,19 @@
|
||||
message.success(`已切换到:${tableOption.title}`);
|
||||
};
|
||||
|
||||
/* 处理文件选择确认 */
|
||||
const handleFileSelectConfirm = (data: { dirKeys: (string | number)[], fileKeys: (string | number)[] }) => {
|
||||
checkedDirKeys.value = data.dirKeys;
|
||||
selectedFileKeys.value = data.fileKeys;
|
||||
lastSelectedDirKeys.value = [...data.dirKeys];
|
||||
lastSelectedFileKeys.value = [...data.fileKeys];
|
||||
selectedDocList.value = data.dirKeys.map((key) => key.toString());
|
||||
selectedFileList.value = data.fileKeys.map((key) => key.toString());
|
||||
};
|
||||
|
||||
/* 打开文档选择弹窗 */
|
||||
const openDocSelect = (sectionIndex: number) => {
|
||||
currentSectionIndex.value = sectionIndex;
|
||||
showDocSelect.value = true;
|
||||
|
||||
const tableInfo = getTableInfo(sectionIndex);
|
||||
if (!tableInfo) return;
|
||||
@@ -748,7 +760,7 @@
|
||||
key.toString()
|
||||
);
|
||||
|
||||
fileModal.value.open(tableInfo.tableKey);
|
||||
fileModal.value.open();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1268,14 +1280,16 @@
|
||||
section.generating = true;
|
||||
try {
|
||||
// 获取章节标题
|
||||
const chapterTitle = childIndex !== undefined && section.children
|
||||
? section.children[childIndex].title
|
||||
const chapterTitle = childIndex !== undefined && section.children
|
||||
? section.children[childIndex].title
|
||||
: section.title;
|
||||
|
||||
|
||||
section.content = await generateDefaultText({
|
||||
projectId: form.id,
|
||||
formCommit: section.formCommit || 0,
|
||||
chapterTitle: chapterTitle
|
||||
chapterTitle: chapterTitle,
|
||||
docList: checkedDirKeys.value,
|
||||
fileList: selectedFileKeys.value
|
||||
});
|
||||
} finally {
|
||||
section.generating = false;
|
||||
|
||||
Reference in New Issue
Block a user