feat:项目管理-审计内容1-新增八项规定相关内容
This commit is contained in:
@@ -179,6 +179,18 @@
|
||||
</template>
|
||||
<template #extra>
|
||||
<a-space>
|
||||
<!-- 添加导出八项规定按钮 -->
|
||||
<a-button
|
||||
v-if="item.extra1 && table1Title === '八项规定'"
|
||||
type="primary"
|
||||
@click="handleExportEightRegTable"
|
||||
:loading="exportingEightReg"
|
||||
>
|
||||
<template #icon>
|
||||
<DownloadOutlined />
|
||||
</template>
|
||||
导出八项规定
|
||||
</a-button>
|
||||
<!-- 添加导出重大经济决策调查表按钮 -->
|
||||
<a-button
|
||||
v-if="item.extra3 && table3Title === '重大经济决策调查表'"
|
||||
@@ -405,7 +417,9 @@
|
||||
generateTripleOneTable,
|
||||
generateDecisionTable,
|
||||
exportTripleOneTable,
|
||||
exportDecisionTable
|
||||
exportDecisionTable,
|
||||
generateEightRegTable,
|
||||
exportEightRegTable
|
||||
} from '@/api/ai/auditContent';
|
||||
|
||||
import FileModal from '@/views/pwl/pwlProject/components/components/FileModal.vue';
|
||||
@@ -418,7 +432,6 @@
|
||||
import {
|
||||
scrollToSection,
|
||||
getScrollContainer,
|
||||
handleKeydown,
|
||||
handleScroll,
|
||||
buildExportData,
|
||||
hasContent
|
||||
@@ -450,6 +463,7 @@
|
||||
// 存储两种表格的数据状态
|
||||
const tripleOneTableData = ref([]);
|
||||
const decisionTableData = ref([]);
|
||||
const eightRegTableData = ref([]);
|
||||
|
||||
// 文档选择相关变量
|
||||
const showDocSelect = ref(false);
|
||||
@@ -485,6 +499,7 @@
|
||||
// 添加导出状态
|
||||
const exportingTripleOne = ref(false);
|
||||
const exportingDecisionTable = ref(false);
|
||||
const exportingEightReg = ref(false);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
@@ -681,6 +696,47 @@
|
||||
}
|
||||
};
|
||||
|
||||
/* 导出八项规定表格 */
|
||||
const handleExportEightRegTable = async () => {
|
||||
const section = navigationItems.value[0];
|
||||
if (!section.data || section.data.length === 0) {
|
||||
message.warning('没有可导出的八项规定数据');
|
||||
return;
|
||||
}
|
||||
|
||||
exportingEightReg.value = true;
|
||||
try {
|
||||
// 构建导出数据
|
||||
const exportData = {
|
||||
data: section.data,
|
||||
companyName: form.name || '未知公司',
|
||||
auditTime: form.expirationTime || '未知时间'
|
||||
};
|
||||
|
||||
const blob = await exportEightRegTable(exportData);
|
||||
|
||||
// 创建下载链接
|
||||
const url = window.URL.createObjectURL(new Blob([blob]));
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute(
|
||||
'download',
|
||||
`八项规定对比分析表_${form.name || '未知公司'}.xlsx`
|
||||
);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
message.success('八项规定表格导出成功');
|
||||
} catch (error: any) {
|
||||
console.error('导出八项规定表格失败:', error);
|
||||
message.error('导出失败: ' + (error.message || '未知错误'));
|
||||
} finally {
|
||||
exportingEightReg.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/* 导出三重一大表格 */
|
||||
const handleExportTripleOne = async () => {
|
||||
const section = navigationItems.value[2];
|
||||
@@ -765,6 +821,23 @@
|
||||
|
||||
/* AI生成内容 */
|
||||
const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
||||
// 特殊处理审计内容1(根据当前表格类型调用不同的生成方法)
|
||||
if (sectionIndex === 0) {
|
||||
const section: any = navigationItems.value[sectionIndex];
|
||||
if (section.generateMethod) {
|
||||
await section.generateMethod();
|
||||
} else {
|
||||
// 默认根据表格标题调用相应方法
|
||||
if (table1Title.value === '八项规定') {
|
||||
await generateContent1();
|
||||
} else {
|
||||
// 其他表格类型调用默认方法
|
||||
await generateDefaultContent(sectionIndex, childIndex);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 特殊处理审计内容3(根据当前表格类型调用不同的生成方法)
|
||||
if (sectionIndex === 2) {
|
||||
const section: any = navigationItems.value[sectionIndex];
|
||||
@@ -781,6 +854,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 其他章节的默认生成逻辑
|
||||
await generateDefaultContent(sectionIndex, childIndex);
|
||||
};
|
||||
|
||||
// 默认内容生成方法
|
||||
const generateDefaultContent = async (sectionIndex: number, childIndex?: number) => {
|
||||
const section: any = navigationItems.value[sectionIndex];
|
||||
|
||||
// 处理主项生成(当主项没有formCommit时)
|
||||
@@ -828,6 +907,70 @@
|
||||
}
|
||||
};
|
||||
|
||||
// 八项规定生成方法
|
||||
const generateContent1 = async () => {
|
||||
const section: any = navigationItems.value[0];
|
||||
section.generating = true;
|
||||
|
||||
// 构建history - 将当前已有的数据作为历史记录
|
||||
const history =
|
||||
section.data && section.data.length > 0
|
||||
? JSON.stringify(section.data, null, 2)
|
||||
: '';
|
||||
|
||||
// 获取用户输入的建议
|
||||
const suggestion = section.suggestion || '';
|
||||
|
||||
console.log('生成八项规定参数:', {
|
||||
kbIds: props.data?.kbId,
|
||||
libraryIds: props.data?.libraryIds,
|
||||
projectLibrary: props.data?.projectLibrary,
|
||||
history: history ? `历史数据(${section.data.length}条)` : '无',
|
||||
suggestion: suggestion || '无',
|
||||
docList: checkedDirKeys.value,
|
||||
fileList: selectedFileKeys.value
|
||||
});
|
||||
|
||||
try {
|
||||
// 构建请求参数对象
|
||||
const requestData = {
|
||||
kbIds: props.data?.kbId || '',
|
||||
libraryIds: props.data?.libraryIds || '',
|
||||
projectLibrary: props.data?.projectLibrary || '',
|
||||
history: history,
|
||||
suggestion: suggestion,
|
||||
docList: checkedDirKeys.value,
|
||||
fileList: selectedFileKeys.value
|
||||
};
|
||||
|
||||
// 调用八项规定生成接口
|
||||
const result = await generateEightRegTable(requestData);
|
||||
|
||||
console.log('八项规定接口返回结果:', result);
|
||||
|
||||
if (result.code === 0 && result.data && result.data.success) {
|
||||
const tableData = mapEightRegData(result.data.data);
|
||||
|
||||
// 保存到八项规定数据
|
||||
eightRegTableData.value = tableData;
|
||||
section.data = tableData;
|
||||
|
||||
// 生成成功后清空建议输入框
|
||||
section.suggestion = '';
|
||||
|
||||
message.success(`成功生成 ${tableData.length} 条八项规定对比记录`);
|
||||
} else {
|
||||
const errorMsg = result.data?.error || result.message || '生成失败';
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('生成八项规定对比分析表失败:', error);
|
||||
message.error('生成失败: ' + (error.message || '未知错误'));
|
||||
} finally {
|
||||
section.generating = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 三重一大生成方法
|
||||
const generateContent3 = async () => {
|
||||
const section: any = navigationItems.value[2];
|
||||
@@ -1002,8 +1145,8 @@
|
||||
section.generateMethod = generateContent3;
|
||||
} else if (title === '八项规定') {
|
||||
section.columns = table1Columns.columns3;
|
||||
section.data = table1Columns.columns3Data || [];
|
||||
section.generateMethod = generateContent3;
|
||||
section.data = eightRegTableData.value || table1Columns.columns3Data || [];
|
||||
section.generateMethod = generateContent1;
|
||||
} else {
|
||||
section.columns = table1Columns.columns2;
|
||||
section.data = decisionTableData.value || [];
|
||||
@@ -1159,21 +1302,34 @@
|
||||
}));
|
||||
};
|
||||
|
||||
// 八项规定数据映射函数
|
||||
const mapEightRegData = (data: any[]) => {
|
||||
return data.map((item, index) => ({
|
||||
key: index,
|
||||
title: item.title || '',
|
||||
content: item.content || '',
|
||||
testContent: item.testContent || '',
|
||||
result: item.result || '待检查',
|
||||
workPaperIndex: item.workPaperIndex || []
|
||||
}));
|
||||
};
|
||||
|
||||
// 应用历史记录数据到指定章节
|
||||
const applyHistoryData = (sectionIndex: number, data: any[], dataType: 'tripleOne' | 'decisionTable') => {
|
||||
const applyHistoryData = (sectionIndex: number, data: any[], dataType: 'tripleOne' | 'decisionTable' | 'eightReg') => {
|
||||
const section = navigationItems.value[sectionIndex];
|
||||
|
||||
if (dataType === 'tripleOne') {
|
||||
const tableData = mapTripleOneData(data);
|
||||
section.data = tableData;
|
||||
tripleOneTableData.value = tableData;
|
||||
tripleOneData.value = data;
|
||||
|
||||
// 强制刷新当前显示的表格
|
||||
if (table3Title.value === '三重一大') {
|
||||
section.columns = table3Columns.columns0;
|
||||
section.data = [...tableData];
|
||||
}
|
||||
} else {
|
||||
} else if (dataType === 'decisionTable') {
|
||||
const tableData = mapDecisionTableData(data);
|
||||
section.data = tableData;
|
||||
decisionTableData.value = tableData;
|
||||
@@ -1183,6 +1339,16 @@
|
||||
section.columns = table3Columns.columns1;
|
||||
section.data = [...tableData];
|
||||
}
|
||||
} else if (dataType === 'eightReg') {
|
||||
const tableData = mapEightRegData(data);
|
||||
section.data = tableData;
|
||||
eightRegTableData.value = tableData;
|
||||
|
||||
// 强制刷新当前显示的表格
|
||||
if (table1Title.value === '八项规定') {
|
||||
section.columns = table1Columns.columns3;
|
||||
section.data = [...tableData];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1192,7 +1358,11 @@
|
||||
currentInterfaceName.value = '';
|
||||
|
||||
// 根据当前章节和表格类型确定接口名称
|
||||
if (sectionIndex === 2) { // 审计内容3章节
|
||||
if (sectionIndex === 0) { // 审计内容1章节
|
||||
if (table1Title.value === '八项规定') {
|
||||
currentInterfaceName.value = '/api/ai/auditContent1/generateEightRegTable';
|
||||
}
|
||||
} else if (sectionIndex === 2) { // 审计内容3章节
|
||||
if (table3Title.value === '三重一大') {
|
||||
currentInterfaceName.value = '/api/ai/auditContent3/generateTripleOneTable';
|
||||
} else if (table3Title.value === '重大经济决策调查表') {
|
||||
@@ -1215,7 +1385,10 @@
|
||||
}
|
||||
|
||||
// 根据接口名称确定数据类型
|
||||
if (record.interfaceName === '/api/ai/auditContent3/generateTripleOneTable') {
|
||||
if (record.interfaceName === '/api/ai/auditContent1/generateEightRegTable') {
|
||||
applyHistoryData(0, responseData.data, 'eightReg');
|
||||
message.success('已应用选择的八项规定历史记录');
|
||||
} else if (record.interfaceName === '/api/ai/auditContent3/generateTripleOneTable') {
|
||||
applyHistoryData(2, responseData.data, 'tripleOne');
|
||||
message.success('已应用选择的三重一大历史记录');
|
||||
} else if (record.interfaceName === '/api/ai/auditContent3/generateDecisionTable') {
|
||||
|
||||
Reference in New Issue
Block a user