feat:项目管理-审计内容1-新增生成领导班子列表分析表
This commit is contained in:
@@ -2,6 +2,51 @@ import request from '@/utils/request';
|
|||||||
import type { ApiResult } from '@/api';
|
import type { ApiResult } from '@/api';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成领导班子列表分析表
|
||||||
|
*/
|
||||||
|
export async function generateLeaderListTable(data: {
|
||||||
|
kbIds?: string;
|
||||||
|
libraryIds?: string;
|
||||||
|
projectLibrary?: string;
|
||||||
|
history?: string;
|
||||||
|
suggestion?: string;
|
||||||
|
docList?: any[];
|
||||||
|
fileList?: any[];
|
||||||
|
}) {
|
||||||
|
const res = await request.post<ApiResult<any>>(
|
||||||
|
MODULES_API_URL + '/ai/auditContent1/generateLeaderListTable',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出领导班子列表分析表到Excel
|
||||||
|
*/
|
||||||
|
export async function exportLeaderListTable(data: {
|
||||||
|
data?: any[];
|
||||||
|
companyName?: string;
|
||||||
|
auditTime?: string;
|
||||||
|
}) {
|
||||||
|
const res = await request.post(
|
||||||
|
MODULES_API_URL + '/ai/auditContent1/exportLeaderListTable',
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
responseType: 'blob'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error('导出失败'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成八项规定对比分析表
|
* 生成八项规定对比分析表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -229,21 +229,24 @@ export const columns0 = [
|
|||||||
export const columns1 = [
|
export const columns1 = [
|
||||||
{
|
{
|
||||||
title: '单位',
|
title: '单位',
|
||||||
dataIndex: '',
|
dataIndex: 'unit',
|
||||||
key: '',
|
key: 'unit',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: '',
|
dataIndex: 'name',
|
||||||
key: '',
|
key: 'name',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '部门',
|
title: '部门',
|
||||||
dataIndex: '',
|
dataIndex: 'department',
|
||||||
key: '',
|
key: 'department',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '职务',
|
title: '职务',
|
||||||
@@ -251,49 +254,54 @@ export const columns1 = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: '党内',
|
title: '党内',
|
||||||
dataIndex: '',
|
dataIndex: 'partyPosition',
|
||||||
key: '',
|
key: 'partyPosition',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '行政',
|
title: '行政',
|
||||||
dataIndex: '',
|
dataIndex: 'adminPosition',
|
||||||
key: '',
|
key: 'adminPosition',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 120
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '任职期间',
|
title: '任职期间',
|
||||||
dataIndex: '',
|
dataIndex: 'tenurePeriod',
|
||||||
key: '',
|
key: 'tenurePeriod',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '主要工作责任',
|
title: '主要工作责任',
|
||||||
dataIndex: '',
|
dataIndex: 'mainResponsibilities',
|
||||||
key: '',
|
key: 'mainResponsibilities',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '备注',
|
title: '备注',
|
||||||
dataIndex: '',
|
dataIndex: 'remark',
|
||||||
key: '',
|
key: 'remark',
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '工作底稿索引',
|
title: '工作底稿索引',
|
||||||
dataIndex: 'workPaperIndex',
|
dataIndex: 'workPaperIndex',
|
||||||
key: 'workPaperIndex',
|
key: 'workPaperIndex',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 140,
|
width: 180,
|
||||||
ellipsis: true
|
ellipsis: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 140
|
width: 100
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,18 @@
|
|||||||
</template>
|
</template>
|
||||||
导出八项规定
|
导出八项规定
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<!-- 添加导出领导班子名单按钮 -->
|
||||||
|
<a-button
|
||||||
|
v-if="item.extra1 && table1Title === '领导班子名单'"
|
||||||
|
type="primary"
|
||||||
|
@click="handleExportLeaderListTable"
|
||||||
|
:loading="exportingLeaderList"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<DownloadOutlined />
|
||||||
|
</template>
|
||||||
|
导出领导班子名单
|
||||||
|
</a-button>
|
||||||
<!-- 添加导出重大经济决策调查表按钮 -->
|
<!-- 添加导出重大经济决策调查表按钮 -->
|
||||||
<a-button
|
<a-button
|
||||||
v-if="item.extra3 && table3Title === '重大经济决策调查表'"
|
v-if="item.extra3 && table3Title === '重大经济决策调查表'"
|
||||||
@@ -419,7 +431,9 @@
|
|||||||
exportTripleOneTable,
|
exportTripleOneTable,
|
||||||
exportDecisionTable,
|
exportDecisionTable,
|
||||||
generateEightRegTable,
|
generateEightRegTable,
|
||||||
exportEightRegTable
|
exportEightRegTable,
|
||||||
|
generateLeaderListTable,
|
||||||
|
exportLeaderListTable
|
||||||
} from '@/api/ai/auditContent';
|
} from '@/api/ai/auditContent';
|
||||||
|
|
||||||
import FileModal from '@/views/pwl/pwlProject/components/components/FileModal.vue';
|
import FileModal from '@/views/pwl/pwlProject/components/components/FileModal.vue';
|
||||||
@@ -464,6 +478,7 @@
|
|||||||
const tripleOneTableData = ref([]);
|
const tripleOneTableData = ref([]);
|
||||||
const decisionTableData = ref([]);
|
const decisionTableData = ref([]);
|
||||||
const eightRegTableData = ref([]);
|
const eightRegTableData = ref([]);
|
||||||
|
const leaderListData = ref([]);
|
||||||
|
|
||||||
// 文档选择相关变量
|
// 文档选择相关变量
|
||||||
const showDocSelect = ref(false);
|
const showDocSelect = ref(false);
|
||||||
@@ -500,6 +515,7 @@
|
|||||||
const exportingTripleOne = ref(false);
|
const exportingTripleOne = ref(false);
|
||||||
const exportingDecisionTable = ref(false);
|
const exportingDecisionTable = ref(false);
|
||||||
const exportingEightReg = ref(false);
|
const exportingEightReg = ref(false);
|
||||||
|
const exportingLeaderList = ref(false);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'done'): void;
|
(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 handleExportTripleOne = async () => {
|
||||||
const section = navigationItems.value[2];
|
const section = navigationItems.value[2];
|
||||||
@@ -830,6 +887,8 @@
|
|||||||
// 默认根据表格标题调用相应方法
|
// 默认根据表格标题调用相应方法
|
||||||
if (table1Title.value === '八项规定') {
|
if (table1Title.value === '八项规定') {
|
||||||
await generateContent1();
|
await generateContent1();
|
||||||
|
} else if (table1Title.value === '领导班子名单') {
|
||||||
|
await generateLeaderListContent();
|
||||||
} else {
|
} else {
|
||||||
// 其他表格类型调用默认方法
|
// 其他表格类型调用默认方法
|
||||||
await generateDefaultContent(sectionIndex, childIndex);
|
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 generateContent3 = async () => {
|
||||||
const section: any = navigationItems.value[2];
|
const section: any = navigationItems.value[2];
|
||||||
@@ -1141,8 +1264,8 @@
|
|||||||
section.generateMethod = generateContent3;
|
section.generateMethod = generateContent3;
|
||||||
} else if (title === '领导班子名单') {
|
} else if (title === '领导班子名单') {
|
||||||
section.columns = table1Columns.columns1;
|
section.columns = table1Columns.columns1;
|
||||||
section.data = tripleOneTableData.value || [];
|
section.data = leaderListData.value || [];
|
||||||
section.generateMethod = generateContent3;
|
section.generateMethod = generateLeaderListContent;
|
||||||
} else if (title === '八项规定') {
|
} else if (title === '八项规定') {
|
||||||
section.columns = table1Columns.columns3;
|
section.columns = table1Columns.columns3;
|
||||||
section.data = eightRegTableData.value || table1Columns.columns3Data || [];
|
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];
|
const section = navigationItems.value[sectionIndex];
|
||||||
|
|
||||||
if (dataType === 'tripleOne') {
|
if (dataType === 'tripleOne') {
|
||||||
@@ -1349,6 +1511,16 @@
|
|||||||
section.columns = table1Columns.columns3;
|
section.columns = table1Columns.columns3;
|
||||||
section.data = [...tableData];
|
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 (sectionIndex === 0) { // 审计内容1章节
|
||||||
if (table1Title.value === '八项规定') {
|
if (table1Title.value === '八项规定') {
|
||||||
currentInterfaceName.value = '/api/ai/auditContent1/generateEightRegTable';
|
currentInterfaceName.value = '/api/ai/auditContent1/generateEightRegTable';
|
||||||
|
} else if (table1Title.value === '领导班子名单') {
|
||||||
|
currentInterfaceName.value = '/api/ai/auditContent1/generateLeaderListTable';
|
||||||
}
|
}
|
||||||
} else if (sectionIndex === 2) { // 审计内容3章节
|
} else if (sectionIndex === 2) { // 审计内容3章节
|
||||||
if (table3Title.value === '三重一大') {
|
if (table3Title.value === '三重一大') {
|
||||||
@@ -1388,6 +1562,9 @@
|
|||||||
if (record.interfaceName === '/api/ai/auditContent1/generateEightRegTable') {
|
if (record.interfaceName === '/api/ai/auditContent1/generateEightRegTable') {
|
||||||
applyHistoryData(0, responseData.data, 'eightReg');
|
applyHistoryData(0, responseData.data, 'eightReg');
|
||||||
message.success('已应用选择的八项规定历史记录');
|
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') {
|
} else if (record.interfaceName === '/api/ai/auditContent3/generateTripleOneTable') {
|
||||||
applyHistoryData(2, responseData.data, 'tripleOne');
|
applyHistoryData(2, responseData.data, 'tripleOne');
|
||||||
message.success('已应用选择的三重一大历史记录');
|
message.success('已应用选择的三重一大历史记录');
|
||||||
|
|||||||
Reference in New Issue
Block a user