feat(pwl):优化生成审计内容3
This commit is contained in:
@@ -5,27 +5,20 @@ import { MODULES_API_URL } from '@/config/setting';
|
|||||||
/**
|
/**
|
||||||
* 生成重大经济决策调查表
|
* 生成重大经济决策调查表
|
||||||
*/
|
*/
|
||||||
export async function generateDecisionTable(
|
export async function generateDecisionTable(data: {
|
||||||
kbIds?: string,
|
kbIds?: string;
|
||||||
libraryIds?: string,
|
libraryIds?: string;
|
||||||
projectLibrary?: string
|
projectLibrary?: string;
|
||||||
) {
|
history?: string;
|
||||||
const params: Record<string, any> = {};
|
suggestion?: string;
|
||||||
|
}) {
|
||||||
if (kbIds) params.kbIds = kbIds;
|
|
||||||
if (libraryIds) params.libraryIds = libraryIds;
|
|
||||||
if (projectLibrary) params.projectLibrary = projectLibrary;
|
|
||||||
|
|
||||||
const res = await request.post<ApiResult<any>>(
|
const res = await request.post<ApiResult<any>>(
|
||||||
MODULES_API_URL + '/ai/auditContent3/generateDecisionTable',
|
MODULES_API_URL + '/ai/auditContent3/generateDecisionTable',
|
||||||
null,
|
data
|
||||||
{
|
|
||||||
params
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data; // 返回整个响应数据,包括data字段
|
return res.data;
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!-- 用户编辑弹窗 -->
|
<!-- 用户编辑弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
:width="`70%`"
|
:width="`70%`"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
@@ -259,9 +259,9 @@
|
|||||||
<!-- 返回顶部按钮 -->
|
<!-- 返回顶部按钮 -->
|
||||||
<a-back-top :target="getScrollContainer" />
|
<a-back-top :target="getScrollContainer" />
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, watch, onMounted, onUnmounted } from 'vue';
|
import { ref, reactive, watch, onMounted, onUnmounted } from 'vue';
|
||||||
import { Form, message } from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject } from 'ele-admin-pro';
|
import { assignObject } from 'ele-admin-pro';
|
||||||
@@ -404,29 +404,30 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '会议时间',
|
title: '会议时间',
|
||||||
dataIndex: 'content', // 注意:这里映射的是content字段
|
dataIndex: 'meetingTime',
|
||||||
key: 'content',
|
key: 'meetingTime',
|
||||||
width: 120,
|
width: 120,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '决策事项金额',
|
title: '决策事项金额',
|
||||||
dataIndex: 'amount',
|
dataIndex: 'decisionAmount',
|
||||||
key: 'amount',
|
key: 'decisionAmount',
|
||||||
width: 120,
|
width: 120,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '程序程序',
|
title: '程序',
|
||||||
dataIndex: 'progress',
|
dataIndex: 'procedure',
|
||||||
key: 'progress',
|
key: 'procedure',
|
||||||
width: 150,
|
width: 180,
|
||||||
ellipsis: true
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => text || '程序未记录'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '执行情况(是/否)',
|
title: '执行情况(是/否)',
|
||||||
dataIndex: 'done',
|
dataIndex: 'executionStatus',
|
||||||
key: 'done',
|
key: 'executionStatus',
|
||||||
width: 100,
|
width: 100,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
@@ -439,7 +440,7 @@
|
|||||||
key: 'goods',
|
key: 'goods',
|
||||||
width: 60,
|
width: 60,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text }) => text ? '✅' : ''
|
customRender: ({ text }) => text === '是' ? '✅' : ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '一般',
|
title: '一般',
|
||||||
@@ -447,7 +448,7 @@
|
|||||||
key: 'normal',
|
key: 'normal',
|
||||||
width: 60,
|
width: 60,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text }) => text ? '✅' : ''
|
customRender: ({ text }) => text === '是' ? '✅' : ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '差',
|
title: '差',
|
||||||
@@ -455,7 +456,7 @@
|
|||||||
key: 'bad',
|
key: 'bad',
|
||||||
width: 60,
|
width: 60,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text }) => text ? '✅' : ''
|
customRender: ({ text }) => text === '是' ? '✅' : ''
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -932,41 +933,53 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 更新审计内容3的生成方法
|
// 更新审计内容3的生成方法
|
||||||
const generateContent3 = async () => {
|
const generateContent3 = async () => {
|
||||||
const section = navigationItems.value[2];
|
const section = navigationItems.value[2];
|
||||||
section.generating = true;
|
section.generating = true;
|
||||||
|
|
||||||
|
// 构建history - 将当前已有的数据作为历史记录
|
||||||
|
const history = section.data && section.data.length > 0
|
||||||
|
? JSON.stringify(section.data, null, 2)
|
||||||
|
: '';
|
||||||
|
|
||||||
|
// 获取用户输入的建议
|
||||||
|
const suggestion = section.suggestion || '';
|
||||||
|
|
||||||
console.log('生成参数:', {
|
console.log('生成参数:', {
|
||||||
kbIds: props.data?.kbId,
|
kbIds: props.data?.kbId,
|
||||||
libraryIds: props.data?.libraryIds,
|
libraryIds: props.data?.libraryIds,
|
||||||
projectLibrary: props.data?.projectLibrary
|
projectLibrary: props.data?.projectLibrary,
|
||||||
|
history: history ? `历史数据(${section.data.length}条)` : '无',
|
||||||
|
suggestion: suggestion || '无'
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 构建请求参数对象
|
||||||
|
const requestData = {
|
||||||
|
kbIds: props.data?.kbId || '',
|
||||||
|
libraryIds: props.data?.libraryIds || '',
|
||||||
|
projectLibrary: props.data?.projectLibrary || '',
|
||||||
|
history: history,
|
||||||
|
suggestion: suggestion
|
||||||
|
};
|
||||||
|
|
||||||
// 调用决策表生成接口
|
// 调用决策表生成接口
|
||||||
const result = await generateDecisionTable(
|
const result = await generateDecisionTable(requestData);
|
||||||
props.data?.kbId,
|
|
||||||
props.data?.libraryIds,
|
|
||||||
props.data?.projectLibrary
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log('接口返回结果:', result);
|
console.log('接口返回结果:', result);
|
||||||
|
|
||||||
// 修正数据访问路径
|
|
||||||
if (result.code === 0 && result.data && result.data.success) {
|
if (result.code === 0 && result.data && result.data.success) {
|
||||||
const tableData = result.data.data.map((item, index) => {
|
const tableData = result.data.data.map((item, index) => {
|
||||||
// 确保数据转换正确
|
|
||||||
const executionEffect = item.executionEffect || {};
|
const executionEffect = item.executionEffect || {};
|
||||||
return {
|
return {
|
||||||
key: index, // 添加key属性用于表格渲染
|
key: index,
|
||||||
index: item.index || String(index + 1),
|
index: item.index || String(index + 1),
|
||||||
name: item.name || '未知事项',
|
name: item.name || '未知事项',
|
||||||
content: item.meetingTime || '未知时间',
|
meetingTime: item.meetingTime || '未知时间',
|
||||||
amount: item.decisionAmount || '0',
|
decisionAmount: item.decisionAmount || '0',
|
||||||
progress: item.procedure || '程序未记录',
|
procedure: item.procedure || '程序未记录',
|
||||||
done: item.executionStatus || '否',
|
executionStatus: item.executionStatus || '否',
|
||||||
goods: executionEffect.good === '是' ? '是' : '',
|
goods: executionEffect.good === '是' ? '是' : '',
|
||||||
normal: executionEffect.normal === '是' ? '是' : '',
|
normal: executionEffect.normal === '是' ? '是' : '',
|
||||||
bad: executionEffect.bad === '是' ? '是' : ''
|
bad: executionEffect.bad === '是' ? '是' : ''
|
||||||
@@ -974,10 +987,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
section.data = tableData;
|
section.data = tableData;
|
||||||
|
|
||||||
|
// 生成成功后清空建议输入框
|
||||||
|
section.suggestion = '';
|
||||||
|
|
||||||
message.success(`成功生成 ${tableData.length} 条重大经济决策记录`);
|
message.success(`成功生成 ${tableData.length} 条重大经济决策记录`);
|
||||||
|
|
||||||
// 调试信息
|
|
||||||
console.log('转换后的表格数据:', tableData);
|
|
||||||
} else {
|
} else {
|
||||||
const errorMsg = result.data?.error || result.message || '生成失败';
|
const errorMsg = result.data?.error || result.message || '生成失败';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
@@ -985,22 +1000,6 @@
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('生成重大经济决策调查表失败:', error);
|
console.error('生成重大经济决策调查表失败:', error);
|
||||||
message.error('生成失败: ' + (error.message || '未知错误'));
|
message.error('生成失败: ' + (error.message || '未知错误'));
|
||||||
|
|
||||||
// 在错误时显示一些示例数据用于调试
|
|
||||||
section.data = [
|
|
||||||
{
|
|
||||||
key: 1,
|
|
||||||
index: '1',
|
|
||||||
name: '示例决策事项',
|
|
||||||
content: '2024-01-01',
|
|
||||||
amount: '100万元',
|
|
||||||
progress: '集体决策程序完整',
|
|
||||||
done: '是',
|
|
||||||
goods: '是',
|
|
||||||
normal: '',
|
|
||||||
bad: ''
|
|
||||||
}
|
|
||||||
];
|
|
||||||
} finally {
|
} finally {
|
||||||
section.generating = false;
|
section.generating = false;
|
||||||
}
|
}
|
||||||
@@ -1122,18 +1121,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as MenuIcons from '@/layout/menu-icons';
|
import * as MenuIcons from '@/layout/menu-icons';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PwlProjectInfo',
|
name: 'PwlProjectInfo',
|
||||||
components: MenuIcons
|
components: MenuIcons
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.audit-content {
|
.audit-content {
|
||||||
.audit-section {
|
.audit-section {
|
||||||
.child-title {
|
.child-title {
|
||||||
@@ -1395,4 +1394,4 @@
|
|||||||
right: 30px;
|
right: 30px;
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user