feat(pwl):重大经济决策调查表数据生成优化
This commit is contained in:
@@ -11,6 +11,9 @@ export async function generateDecisionTable(data: {
|
||||
projectLibrary?: string;
|
||||
history?: string;
|
||||
suggestion?: string;
|
||||
data?: any;
|
||||
docList?: any[];
|
||||
fileList?: any[];
|
||||
}) {
|
||||
const res = await request.post<ApiResult<any>>(
|
||||
MODULES_API_URL + '/ai/auditContent3/generateDecisionTable',
|
||||
@@ -32,6 +35,8 @@ export async function generateTripleOneTable(data: {
|
||||
projectLibrary?: string;
|
||||
history?: string;
|
||||
suggestion?: string;
|
||||
docList?: any[];
|
||||
fileList?: any[];
|
||||
}) {
|
||||
const res = await request.post<ApiResult<any>>(
|
||||
MODULES_API_URL + '/ai/auditContent3/generateTripleOneTable',
|
||||
|
||||
@@ -46,11 +46,15 @@
|
||||
@click="handleGenerateAll"
|
||||
:loading="generatingAll"
|
||||
class="generate-all-button"
|
||||
:disabled="!hasTripleOneData"
|
||||
>
|
||||
<template #icon>
|
||||
<UngroupOutlined />
|
||||
</template>
|
||||
生成全部方案
|
||||
<a-tooltip v-if="!hasTripleOneData" title="请先生成三重一大制度对比分析表">
|
||||
<QuestionCircleOutlined style="margin-left: 5px;" />
|
||||
</a-tooltip>
|
||||
</a-button>
|
||||
<a-button size="large">
|
||||
<template #icon>
|
||||
@@ -212,6 +216,18 @@
|
||||
<span class="cursor-pointer text-wrap">{{ fileItem }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'goods'">
|
||||
<span v-if="record.goods === '是'">✅</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
<template v-if="column.key === 'normal'">
|
||||
<span v-if="record.normal === '是'">✅</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
<template v-if="column.key === 'bad'">
|
||||
<span v-if="record.bad === '是'">✅</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
@@ -355,7 +371,7 @@ import {
|
||||
downloadAuditReport
|
||||
} from '@/api/ai/auditReport';
|
||||
import { getPwlProjectLibraryByIds } from '@/api/pwl/pwlProjectLibrary';
|
||||
import { generateTripleOneTable } from '@/api/ai/auditContent';
|
||||
import { generateTripleOneTable, generateDecisionTable } from '@/api/ai/auditContent';
|
||||
import { Empty } from 'ant-design-vue';
|
||||
import { listAiCloudDoc } from '@/api/ai/aiCloudDoc';
|
||||
import { listAiCloudFile } from '@/api/ai/aiCloudFile';
|
||||
@@ -438,6 +454,10 @@ const combinedKbIds = ref('');
|
||||
|
||||
// 九大审计项目导航配置
|
||||
const table3Title = ref('重大经济决策调查表');
|
||||
// 存储两种表格的数据状态
|
||||
const tripleOneTableData = ref([]);
|
||||
const decisionTableData = ref([]);
|
||||
|
||||
const navigationItems = ref([
|
||||
{
|
||||
number: '一',
|
||||
@@ -473,6 +493,7 @@ const navigationItems = ref([
|
||||
generating: false,
|
||||
extra3: true,
|
||||
file3: true,
|
||||
generateMethod: null,
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -507,7 +528,6 @@ const navigationItems = ref([
|
||||
dataIndex: 'procedure',
|
||||
key: 'procedure',
|
||||
align: 'center',
|
||||
customRender: ({ text }) => text || '程序未记录'
|
||||
},
|
||||
{
|
||||
title: '执行情况(是/否)',
|
||||
@@ -525,7 +545,6 @@ const navigationItems = ref([
|
||||
key: 'goods',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === '是' ? '✅' : '')
|
||||
},
|
||||
{
|
||||
title: '一般',
|
||||
@@ -533,7 +552,6 @@ const navigationItems = ref([
|
||||
key: 'normal',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === '是' ? '✅' : '')
|
||||
},
|
||||
{
|
||||
title: '差',
|
||||
@@ -541,7 +559,6 @@ const navigationItems = ref([
|
||||
key: 'bad',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === '是' ? '✅' : '')
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -779,6 +796,15 @@ const treeData = computed(() => {
|
||||
return buildTree(0);
|
||||
});
|
||||
|
||||
// 添加计算属性检查是否已生成三重一大数据
|
||||
const hasTripleOneData = computed(() => {
|
||||
const section = navigationItems.value[2];
|
||||
return section.data && section.data.length > 0 && table3Title.value === '三重一大';
|
||||
});
|
||||
|
||||
// 存储三重一大数据
|
||||
const tripleOneData = ref(null);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
@@ -1051,9 +1077,19 @@ const handleExport = async () => {
|
||||
|
||||
/* AI生成内容 */
|
||||
const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
||||
// 特殊处理审计内容3(重大经济决策调查表)
|
||||
// 特殊处理审计内容3(根据当前表格类型调用不同的生成方法)
|
||||
if (sectionIndex === 2) {
|
||||
await generateContent3();
|
||||
const section = navigationItems.value[sectionIndex];
|
||||
if (section.generateMethod) {
|
||||
await section.generateMethod();
|
||||
} else {
|
||||
// 默认根据表格标题调用相应方法
|
||||
if (table3Title.value === '三重一大') {
|
||||
await generateContent3();
|
||||
} else {
|
||||
await generateDecisionContent();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1157,8 +1193,13 @@ const generateContent3 = async () => {
|
||||
workPaperIndex: item.workPaperIndex || []
|
||||
}));
|
||||
|
||||
// 保存到三重一大数据
|
||||
tripleOneTableData.value = tableData;
|
||||
section.data = tableData;
|
||||
|
||||
// 保存三重一大数据用于Sheet1生成
|
||||
tripleOneData.value = result.data.data;
|
||||
|
||||
// 生成成功后清空建议输入框
|
||||
section.suggestion = '';
|
||||
|
||||
@@ -1175,6 +1216,84 @@ const generateContent3 = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 添加生成重大经济决策调查表的方法
|
||||
const generateDecisionContent = async () => {
|
||||
const section = navigationItems.value[2];
|
||||
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 || '无',
|
||||
data: tripleOneData.value ? `三重一大数据(${tripleOneData.value.length}条)` : '无',
|
||||
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,
|
||||
data: tripleOneData.value, // 传入三重一大数据
|
||||
docList: checkedDirKeys.value,
|
||||
fileList: selectedFileKeys.value
|
||||
};
|
||||
|
||||
// 调用重大经济决策调查表生成接口
|
||||
const result = await generateDecisionTable(requestData);
|
||||
|
||||
console.log('重大经济决策调查表接口返回结果:', result);
|
||||
|
||||
if (result.code === 0 && result.data && result.data.success) {
|
||||
const tableData = result.data.data.map((item, index) => ({
|
||||
key: index,
|
||||
index: index + 1,
|
||||
name: item.decisionItem || '',
|
||||
meetingTime: item.meetingTime || '',
|
||||
decisionAmount: item.decisionAmount || '',
|
||||
procedure: item.procedure || '',
|
||||
executionStatus: item.executionStatus || '否',
|
||||
goods: item.executionEffect?.good || '否',
|
||||
normal: item.executionEffect?.normal || '否',
|
||||
bad: item.executionEffect?.bad || '否',
|
||||
}));
|
||||
|
||||
console.log('生成的表格数据:', tableData);
|
||||
|
||||
// 保存到重大经济决策调查表数据
|
||||
decisionTableData.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) {
|
||||
console.error('生成重大经济决策调查表失败:', error);
|
||||
message.error('生成失败: ' + (error.message || '未知错误'));
|
||||
} finally {
|
||||
section.generating = false;
|
||||
}
|
||||
};
|
||||
|
||||
/* 监听滚动位置更新当前章节 */
|
||||
const handleScroll = () => {
|
||||
const sections = navigationItems.value.map((_, index) =>
|
||||
@@ -1392,9 +1511,12 @@ const formatFileSize = (size: number) => {
|
||||
|
||||
const file3List = ref([])
|
||||
const changeTable3 = (title) => {
|
||||
table3Title.value = title;
|
||||
const section = navigationItems.value[2];
|
||||
|
||||
if (title === '三重一大') {
|
||||
navigationItems.value[2].columns = [
|
||||
// 切换到三重一大表格
|
||||
table3Title.value = title;
|
||||
section.columns = [
|
||||
{
|
||||
title: '',
|
||||
dataIndex: 'category',
|
||||
@@ -1452,10 +1574,14 @@ const changeTable3 = (title) => {
|
||||
width: 100,
|
||||
}
|
||||
];
|
||||
// 清空数据,准备生成新的三重一大数据
|
||||
navigationItems.value[2].data = [];
|
||||
// 恢复三重一大数据,如果没有生成过则为空数组
|
||||
section.data = tripleOneTableData.value || [];
|
||||
// 更新生成方法
|
||||
section.generateMethod = generateContent3;
|
||||
} else {
|
||||
navigationItems.value[2].columns = [
|
||||
// 切换到重大经济决策调查表
|
||||
table3Title.value = title;
|
||||
section.columns = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
@@ -1489,7 +1615,6 @@ const changeTable3 = (title) => {
|
||||
dataIndex: 'procedure',
|
||||
key: 'procedure',
|
||||
align: 'center',
|
||||
customRender: ({ text }) => text || '程序未记录'
|
||||
},
|
||||
{
|
||||
title: '执行情况(是/否)',
|
||||
@@ -1507,7 +1632,6 @@ const changeTable3 = (title) => {
|
||||
key: 'goods',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === '是' ? '✅' : '')
|
||||
},
|
||||
{
|
||||
title: '一般',
|
||||
@@ -1515,7 +1639,6 @@ const changeTable3 = (title) => {
|
||||
key: 'normal',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === '是' ? '✅' : '')
|
||||
},
|
||||
{
|
||||
title: '差',
|
||||
@@ -1523,7 +1646,6 @@ const changeTable3 = (title) => {
|
||||
key: 'bad',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => (text === '是' ? '✅' : '')
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1534,19 +1656,10 @@ const changeTable3 = (title) => {
|
||||
width: 140
|
||||
}
|
||||
];
|
||||
// 恢复重大经济决策调查表的默认数据
|
||||
navigationItems.value[2].data = [
|
||||
{
|
||||
index: 1,
|
||||
name: '千汇公司废水处理站扩容升级改造项目',
|
||||
meetingTime: '2024-01-03',
|
||||
decisionAmount: '190万元',
|
||||
procedure:
|
||||
'经专题会议研究并组织外部专家二次评勖审(《2023年第九次总办会会议材料汇总》),形成方案后提交总经理办公会审鈀还户,以记名投票方式全票通过。议案履行了可行性论证、专家咨询、集体讨论和会议决策程序,符台《广西千汇食品有限公司总经理办公会议事规则(试行)》第十条、第十八条关于重大项目投资业务决策程序的要求。',
|
||||
executionStatus: '是',
|
||||
goods: '是'
|
||||
}
|
||||
];
|
||||
// 恢复重大经济决策调查表数据,如果没有生成过则为空数组
|
||||
section.data = decisionTableData.value || [];
|
||||
// 更新生成方法
|
||||
section.generateMethod = generateDecisionContent;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user