feat:项目管理-审计内容1-新增生成领导班子列表分析表

This commit is contained in:
2025-11-24 09:55:22 +08:00
parent 96ae9709cd
commit c8eb5bbd2d
3 changed files with 260 additions and 30 deletions

View File

@@ -229,21 +229,24 @@ export const columns0 = [
export const columns1 = [
{
title: '单位',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'unit',
key: 'unit',
align: 'center',
width: 120
},
{
title: '姓名',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'name',
key: 'name',
align: 'center',
width: 100
},
{
title: '部门',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'department',
key: 'department',
align: 'center',
width: 120
},
{
title: '职务',
@@ -251,49 +254,54 @@ export const columns1 = [
children: [
{
title: '党内',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'partyPosition',
key: 'partyPosition',
align: 'center',
width: 100
},
{
title: '行政',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'adminPosition',
key: 'adminPosition',
align: 'center',
width: 120
}
]
},
{
title: '任职期间',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'tenurePeriod',
key: 'tenurePeriod',
align: 'center',
width: 150
},
{
title: '主要工作责任',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'mainResponsibilities',
key: 'mainResponsibilities',
align: 'center',
width: 200
},
{
title: '备注',
dataIndex: '',
key: '',
align: 'center'
dataIndex: 'remark',
key: 'remark',
align: 'center',
width: 120
},
{
title: '工作底稿索引',
dataIndex: 'workPaperIndex',
key: 'workPaperIndex',
align: 'center',
width: 140,
width: 180,
ellipsis: true
},
{
title: '操作',
key: 'action',
align: 'center',
width: 140
width: 100
}
];

View File

@@ -191,6 +191,18 @@
</template>
导出八项规定
</a-button>
<!-- 添加导出领导班子名单按钮 -->
<a-button
v-if="item.extra1 && table1Title === '领导班子名单'"
type="primary"
@click="handleExportLeaderListTable"
:loading="exportingLeaderList"
>
<template #icon>
<DownloadOutlined />
</template>
导出领导班子名单
</a-button>
<!-- 添加导出重大经济决策调查表按钮 -->
<a-button
v-if="item.extra3 && table3Title === '重大经济决策调查表'"
@@ -419,7 +431,9 @@
exportTripleOneTable,
exportDecisionTable,
generateEightRegTable,
exportEightRegTable
exportEightRegTable,
generateLeaderListTable,
exportLeaderListTable
} from '@/api/ai/auditContent';
import FileModal from '@/views/pwl/pwlProject/components/components/FileModal.vue';
@@ -464,6 +478,7 @@
const tripleOneTableData = ref([]);
const decisionTableData = ref([]);
const eightRegTableData = ref([]);
const leaderListData = ref([]);
// 文档选择相关变量
const showDocSelect = ref(false);
@@ -500,6 +515,7 @@
const exportingTripleOne = ref(false);
const exportingDecisionTable = ref(false);
const exportingEightReg = ref(false);
const exportingLeaderList = ref(false);
const emit = defineEmits<{
(e: 'done'): void;
@@ -737,6 +753,47 @@
}
};
/* 导出领导班子名单表格 */
const handleExportLeaderListTable = async () => {
const section = navigationItems.value[0];
if (!section.data || section.data.length === 0) {
message.warning('没有可导出的领导班子名单数据');
return;
}
exportingLeaderList.value = true;
try {
// 构建导出数据
const exportData = {
data: section.data,
companyName: form.name || '未知公司',
auditTime: form.expirationTime || '未知时间'
};
const blob = await exportLeaderListTable(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 {
exportingLeaderList.value = false;
}
};
/* 导出三重一大表格 */
const handleExportTripleOne = async () => {
const section = navigationItems.value[2];
@@ -830,6 +887,8 @@
// 默认根据表格标题调用相应方法
if (table1Title.value === '八项规定') {
await generateContent1();
} else if (table1Title.value === '领导班子名单') {
await generateLeaderListContent();
} else {
// 其他表格类型调用默认方法
await generateDefaultContent(sectionIndex, childIndex);
@@ -971,6 +1030,70 @@
}
};
// 领导班子名单生成方法
const generateLeaderListContent = 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 generateLeaderListTable(requestData);
console.log('领导班子名单接口返回结果:', result);
if (result.code === 0 && result.data && result.data.success) {
const tableData = mapLeaderListData(result.data.data);
// 保存到领导班子名单数据
leaderListData.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];
@@ -1141,8 +1264,8 @@
section.generateMethod = generateContent3;
} else if (title === '领导班子名单') {
section.columns = table1Columns.columns1;
section.data = tripleOneTableData.value || [];
section.generateMethod = generateContent3;
section.data = leaderListData.value || [];
section.generateMethod = generateLeaderListContent;
} else if (title === '八项规定') {
section.columns = table1Columns.columns3;
section.data = eightRegTableData.value || table1Columns.columns3Data || [];
@@ -1314,8 +1437,47 @@
}));
};
// 领导班子名单数据映射函数
const mapLeaderListData = (data: any[]) => {
console.log('原始领导班子数据:', data);
if (!data || !Array.isArray(data)) {
console.warn('领导班子数据为空或不是数组');
return [];
}
const mappedData = data.map((item, index) => {
console.log(`处理第${index}条记录:`, item);
// 确保workPaperIndex是数组格式
let workPaperIndex = item.workPaperIndex || [];
if (!Array.isArray(workPaperIndex)) {
workPaperIndex = [workPaperIndex];
}
const mappedItem = {
key: index,
unit: item.unit || '',
name: item.name || '',
department: item.department || '',
partyPosition: item.partyPosition || '',
adminPosition: item.adminPosition || '',
tenurePeriod: item.tenurePeriod || '',
mainResponsibilities: item.mainResponsibilities || '',
remark: item.remark || '',
workPaperIndex: workPaperIndex
};
console.log(`映射后的第${index}条记录:`, mappedItem);
return mappedItem;
});
console.log('最终映射的领导班子数据:', mappedData);
return mappedData;
};
// 应用历史记录数据到指定章节
const applyHistoryData = (sectionIndex: number, data: any[], dataType: 'tripleOne' | 'decisionTable' | 'eightReg') => {
const applyHistoryData = (sectionIndex: number, data: any[], dataType: 'tripleOne' | 'decisionTable' | 'eightReg' | 'leaderList') => {
const section = navigationItems.value[sectionIndex];
if (dataType === 'tripleOne') {
@@ -1349,6 +1511,16 @@
section.columns = table1Columns.columns3;
section.data = [...tableData];
}
} else if (dataType === 'leaderList') {
const tableData = mapLeaderListData(data);
section.data = tableData;
leaderListData.value = tableData;
// 强制刷新当前显示的表格
if (table1Title.value === '领导班子名单') {
section.columns = table1Columns.columns1;
section.data = [...tableData];
}
}
};
@@ -1361,6 +1533,8 @@
if (sectionIndex === 0) { // 审计内容1章节
if (table1Title.value === '八项规定') {
currentInterfaceName.value = '/api/ai/auditContent1/generateEightRegTable';
} else if (table1Title.value === '领导班子名单') {
currentInterfaceName.value = '/api/ai/auditContent1/generateLeaderListTable';
}
} else if (sectionIndex === 2) { // 审计内容3章节
if (table3Title.value === '三重一大') {
@@ -1388,6 +1562,9 @@
if (record.interfaceName === '/api/ai/auditContent1/generateEightRegTable') {
applyHistoryData(0, responseData.data, 'eightReg');
message.success('已应用选择的八项规定历史记录');
} else if (record.interfaceName === '/api/ai/auditContent1/generateLeaderListTable') {
applyHistoryData(0, responseData.data, 'leaderList');
message.success('已应用选择的领导班子名单历史记录');
} else if (record.interfaceName === '/api/ai/auditContent3/generateTripleOneTable') {
applyHistoryData(2, responseData.data, 'tripleOne');
message.success('已应用选择的三重一大历史记录');