feat(pwl):优化生成审计内容3
This commit is contained in:
@@ -5,27 +5,20 @@ import { MODULES_API_URL } from '@/config/setting';
|
||||
/**
|
||||
* 生成重大经济决策调查表
|
||||
*/
|
||||
export async function generateDecisionTable(
|
||||
kbIds?: string,
|
||||
libraryIds?: string,
|
||||
projectLibrary?: string
|
||||
) {
|
||||
const params: Record<string, any> = {};
|
||||
|
||||
if (kbIds) params.kbIds = kbIds;
|
||||
if (libraryIds) params.libraryIds = libraryIds;
|
||||
if (projectLibrary) params.projectLibrary = projectLibrary;
|
||||
|
||||
export async function generateDecisionTable(data: {
|
||||
kbIds?: string;
|
||||
libraryIds?: string;
|
||||
projectLibrary?: string;
|
||||
history?: string;
|
||||
suggestion?: string;
|
||||
}) {
|
||||
const res = await request.post<ApiResult<any>>(
|
||||
MODULES_API_URL + '/ai/auditContent3/generateDecisionTable',
|
||||
null,
|
||||
{
|
||||
params
|
||||
}
|
||||
data
|
||||
);
|
||||
|
||||
if (res.data.code === 0) {
|
||||
return res.data; // 返回整个响应数据,包括data字段
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -404,29 +404,30 @@
|
||||
},
|
||||
{
|
||||
title: '会议时间',
|
||||
dataIndex: 'content', // 注意:这里映射的是content字段
|
||||
key: 'content',
|
||||
dataIndex: 'meetingTime',
|
||||
key: 'meetingTime',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '决策事项金额',
|
||||
dataIndex: 'amount',
|
||||
key: 'amount',
|
||||
dataIndex: 'decisionAmount',
|
||||
key: 'decisionAmount',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '程序程序',
|
||||
dataIndex: 'progress',
|
||||
key: 'progress',
|
||||
width: 150,
|
||||
ellipsis: true
|
||||
title: '程序',
|
||||
dataIndex: 'procedure',
|
||||
key: 'procedure',
|
||||
width: 180,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => text || '程序未记录'
|
||||
},
|
||||
{
|
||||
title: '执行情况(是/否)',
|
||||
dataIndex: 'done',
|
||||
key: 'done',
|
||||
dataIndex: 'executionStatus',
|
||||
key: 'executionStatus',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
},
|
||||
@@ -439,7 +440,7 @@
|
||||
key: 'goods',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => text ? '✅' : ''
|
||||
customRender: ({ text }) => text === '是' ? '✅' : ''
|
||||
},
|
||||
{
|
||||
title: '一般',
|
||||
@@ -447,7 +448,7 @@
|
||||
key: 'normal',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => text ? '✅' : ''
|
||||
customRender: ({ text }) => text === '是' ? '✅' : ''
|
||||
},
|
||||
{
|
||||
title: '差',
|
||||
@@ -455,7 +456,7 @@
|
||||
key: 'bad',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
customRender: ({ text }) => text ? '✅' : ''
|
||||
customRender: ({ text }) => text === '是' ? '✅' : ''
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -932,41 +933,53 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 更新审计内容3的生成方法
|
||||
const generateContent3 = 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
|
||||
projectLibrary: props.data?.projectLibrary,
|
||||
history: history ? `历史数据(${section.data.length}条)` : '无',
|
||||
suggestion: suggestion || '无'
|
||||
});
|
||||
|
||||
try {
|
||||
// 构建请求参数对象
|
||||
const requestData = {
|
||||
kbIds: props.data?.kbId || '',
|
||||
libraryIds: props.data?.libraryIds || '',
|
||||
projectLibrary: props.data?.projectLibrary || '',
|
||||
history: history,
|
||||
suggestion: suggestion
|
||||
};
|
||||
|
||||
// 调用决策表生成接口
|
||||
const result = await generateDecisionTable(
|
||||
props.data?.kbId,
|
||||
props.data?.libraryIds,
|
||||
props.data?.projectLibrary
|
||||
);
|
||||
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) => {
|
||||
// 确保数据转换正确
|
||||
const executionEffect = item.executionEffect || {};
|
||||
return {
|
||||
key: index, // 添加key属性用于表格渲染
|
||||
key: index,
|
||||
index: item.index || String(index + 1),
|
||||
name: item.name || '未知事项',
|
||||
content: item.meetingTime || '未知时间',
|
||||
amount: item.decisionAmount || '0',
|
||||
progress: item.procedure || '程序未记录',
|
||||
done: item.executionStatus || '否',
|
||||
meetingTime: item.meetingTime || '未知时间',
|
||||
decisionAmount: item.decisionAmount || '0',
|
||||
procedure: item.procedure || '程序未记录',
|
||||
executionStatus: item.executionStatus || '否',
|
||||
goods: executionEffect.good === '是' ? '是' : '',
|
||||
normal: executionEffect.normal === '是' ? '是' : '',
|
||||
bad: executionEffect.bad === '是' ? '是' : ''
|
||||
@@ -974,10 +987,12 @@
|
||||
});
|
||||
|
||||
section.data = tableData;
|
||||
|
||||
// 生成成功后清空建议输入框
|
||||
section.suggestion = '';
|
||||
|
||||
message.success(`成功生成 ${tableData.length} 条重大经济决策记录`);
|
||||
|
||||
// 调试信息
|
||||
console.log('转换后的表格数据:', tableData);
|
||||
} else {
|
||||
const errorMsg = result.data?.error || result.message || '生成失败';
|
||||
throw new Error(errorMsg);
|
||||
@@ -985,22 +1000,6 @@
|
||||
} catch (error) {
|
||||
console.error('生成重大经济决策调查表失败:', error);
|
||||
message.error('生成失败: ' + (error.message || '未知错误'));
|
||||
|
||||
// 在错误时显示一些示例数据用于调试
|
||||
section.data = [
|
||||
{
|
||||
key: 1,
|
||||
index: '1',
|
||||
name: '示例决策事项',
|
||||
content: '2024-01-01',
|
||||
amount: '100万元',
|
||||
progress: '集体决策程序完整',
|
||||
done: '是',
|
||||
goods: '是',
|
||||
normal: '',
|
||||
bad: ''
|
||||
}
|
||||
];
|
||||
} finally {
|
||||
section.generating = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user