feat:项目管理-审计内容-新增三重一大、重大经济决策调查表导出功能
This commit is contained in:
@@ -48,3 +48,47 @@ export async function generateTripleOneTable(data: {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出三重一大制度对比分析表到Excel
|
||||
*/
|
||||
export async function exportTripleOneTable(data: {
|
||||
data?: any[];
|
||||
companyName?: string;
|
||||
auditTime?: string;
|
||||
}) {
|
||||
const res = await request.post(
|
||||
MODULES_API_URL + '/ai/auditContent3/exportTripleOneTable',
|
||||
data,
|
||||
{
|
||||
responseType: 'blob'
|
||||
}
|
||||
);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('导出失败'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出重大经济决策调查表到Excel
|
||||
*/
|
||||
export async function exportDecisionTable(data: {
|
||||
data?: any[];
|
||||
companyName?: string;
|
||||
auditTime?: string;
|
||||
}) {
|
||||
const res = await request.post(
|
||||
MODULES_API_URL + '/ai/auditContent3/exportDecisionTable',
|
||||
data,
|
||||
{
|
||||
responseType: 'blob'
|
||||
}
|
||||
);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('导出失败'));
|
||||
}
|
||||
@@ -159,6 +159,31 @@
|
||||
</span>
|
||||
</template>
|
||||
<template #extra>
|
||||
<a-space>
|
||||
<!-- 添加导出重大经济决策调查表按钮 -->
|
||||
<a-button
|
||||
v-if="item.extra3 && table3Title === '重大经济决策调查表'"
|
||||
type="primary"
|
||||
@click="handleExportDecisionTable"
|
||||
:loading="exportingDecisionTable"
|
||||
>
|
||||
<template #icon>
|
||||
<DownloadOutlined />
|
||||
</template>
|
||||
导出调查表
|
||||
</a-button>
|
||||
<!-- 添加导出三重一大按钮 -->
|
||||
<a-button
|
||||
v-if="item.extra3 && table3Title === '三重一大'"
|
||||
type="primary"
|
||||
@click="handleExportTripleOne"
|
||||
:loading="exportingTripleOne"
|
||||
>
|
||||
<template #icon>
|
||||
<DownloadOutlined />
|
||||
</template>
|
||||
导出三重一大
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="generateContent(index)"
|
||||
@@ -169,6 +194,7 @@
|
||||
</template>
|
||||
AI生成
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="item.extra3">
|
||||
<div class="mb-2">
|
||||
@@ -371,7 +397,7 @@ import {
|
||||
downloadAuditReport
|
||||
} from '@/api/ai/auditReport';
|
||||
import { getPwlProjectLibraryByIds } from '@/api/pwl/pwlProjectLibrary';
|
||||
import { generateTripleOneTable, generateDecisionTable } from '@/api/ai/auditContent';
|
||||
import { generateTripleOneTable, generateDecisionTable, exportTripleOneTable, exportDecisionTable } from '@/api/ai/auditContent';
|
||||
import { Empty } from 'ant-design-vue';
|
||||
import { listAiCloudDoc } from '@/api/ai/aiCloudDoc';
|
||||
import { listAiCloudFile } from '@/api/ai/aiCloudFile';
|
||||
@@ -805,6 +831,10 @@ const hasTripleOneData = computed(() => {
|
||||
// 存储三重一大数据
|
||||
const tripleOneData = ref(null);
|
||||
|
||||
// 添加导出状态
|
||||
const exportingTripleOne = ref(false);
|
||||
const exportingDecisionTable = ref(false);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
@@ -1075,6 +1105,82 @@ const handleExport = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
/* 导出三重一大表格 */
|
||||
const handleExportTripleOne = async () => {
|
||||
const section = navigationItems.value[2];
|
||||
if (!section.data || section.data.length === 0) {
|
||||
message.warning('没有可导出的三重一大数据');
|
||||
return;
|
||||
}
|
||||
|
||||
exportingTripleOne.value = true;
|
||||
try {
|
||||
// 构建导出数据
|
||||
const exportData = {
|
||||
data: section.data,
|
||||
companyName: form.name || '未知公司',
|
||||
auditTime: form.expirationTime || '未知时间'
|
||||
};
|
||||
|
||||
const blob = await exportTripleOneTable(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) {
|
||||
console.error('导出三重一大表格失败:', error);
|
||||
message.error('导出失败: ' + (error.message || '未知错误'));
|
||||
} finally {
|
||||
exportingTripleOne.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 导出重大经济决策调查表
|
||||
const handleExportDecisionTable = async () => {
|
||||
const section = navigationItems.value[2];
|
||||
if (!section.data || section.data.length === 0) {
|
||||
message.warning('没有可导出的重大经济决策调查表数据');
|
||||
return;
|
||||
}
|
||||
|
||||
exportingDecisionTable.value = true;
|
||||
try {
|
||||
// 构建导出数据
|
||||
const exportData = {
|
||||
data: section.data,
|
||||
companyName: form.name || '未知公司',
|
||||
auditTime: form.expirationTime || '未知时间'
|
||||
};
|
||||
|
||||
const blob = await exportDecisionTable(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) {
|
||||
console.error('导出重大经济决策调查表失败:', error);
|
||||
message.error('导出失败: ' + (error.message || '未知错误'));
|
||||
} finally {
|
||||
exportingDecisionTable.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/* AI生成内容 */
|
||||
const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
||||
// 特殊处理审计内容3(根据当前表格类型调用不同的生成方法)
|
||||
|
||||
Reference in New Issue
Block a user