feat:项目管理-审计内容9-福利费超范围支出明细清单

This commit is contained in:
2026-01-14 18:28:53 +08:00
parent c3c3a8c3d1
commit 29f6579c8c
2 changed files with 94 additions and 24 deletions

View File

@@ -352,6 +352,31 @@ export function createDataMapper(type: string) {
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex), workPaperIndex: parseWorkPaperIndex(item.workPaperIndex),
...item ...item
})), })),
personnel: (data) => {
const mainData = data.map((item, index) => {
const { ext, ...rest } = item;
return {
key: index,
index: item.index || index + 1,
...rest,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
};
});
const extraData = data.reduce((acc, item) => {
if (item.ext && Array.isArray(item.ext)) {
return [...acc, ...item.ext];
}
return acc;
}, []);
return {
mainData: mainData,
extraData: extraData.map((item, idx) => ({
key: idx,
...item,
index: item.index || idx + 1
}))
};
},
// 其他类型的映射... // 其他类型的映射...
default: (data) => default: (data) =>
data.map((item, index) => ({ data.map((item, index) => ({

View File

@@ -821,27 +821,27 @@
libraryIds: props.data?.libraryIds || '', libraryIds: props.data?.libraryIds || '',
projectLibrary: props.data?.projectLibrary || '', projectLibrary: props.data?.projectLibrary || '',
history: history:
section.data?.length > 0 ? JSON.stringify(section.data, null, 2) : '', section.data?.length > 0 ? JSON.stringify(section.data, null, 2) : '',
suggestion: section.suggestion || '', suggestion: section.suggestion || '',
docList: checkedDirKeys.value, docList: checkedDirKeys.value,
fileList: selectedFileKeys.value, fileList: selectedFileKeys.value,
// 重大经济决策调查表需要三重一大数据 // 重大经济决策调查表需要三重一大数据
...(currentTable.value === 'decisionTable' ...(currentTable.value === 'decisionTable'
? { data: tripleOneData.value } ? { data: tripleOneData.value }
: {}), : {}),
// 预算管理审计表需要国资管理数据 // 预算管理审计表需要国资管理数据
...(currentTable.value === 'budgetManage' ...(currentTable.value === 'budgetManage'
? { data: stateAssetsData.value } ? { data: stateAssetsData.value }
: {}), : {}),
// 预算执行情况审计表需要预算管理审计的数据 // 预算执行情况审计表需要预算管理审计的数据
...(currentTable.value === 'budgetExecution' ...(currentTable.value === 'budgetExecution'
? { data: tableData['auditContent5_budgetManage'] } ? { data: tableData['auditContent5_budgetManage'] }
: {}) : {})
}; };
// 获取对应的生成方法 // 获取对应的生成方法
const apiMethod = const apiMethod =
apiMethodMap[currentTable.value] || apiMethodMap.default; apiMethodMap[currentTable.value] || apiMethodMap.default;
const generateMethod = auditContentApi[apiMethod.generate]; const generateMethod = auditContentApi[apiMethod.generate];
if (!generateMethod) { if (!generateMethod) {
@@ -853,18 +853,38 @@
if (result.code === 0 && result.data?.success) { if (result.code === 0 && result.data?.success) {
// 保存表格生成数据 // 保存表格生成数据
saveTableGenerationData( saveTableGenerationData(
tableKey, tableKey,
requestData, requestData,
result.data, result.data,
currentTable.value currentTable.value
); );
// 使用对应的数据映射函数 // 使用对应的数据映射函数
const dataMapper = createDataMapper(currentTable.value); const dataMapper = createDataMapper(currentTable.value);
const mappedData = dataMapper(result.data.data); const mappedData = dataMapper(result.data.data);
// 保存数据 // 处理不同类型的表格数据
tableData[tableKey] = mappedData; if (currentTable.value === 'personnel') {
// 对于人员编制管理审计,需要分别处理主表格和额外表格数据
tableData[tableKey] = mappedData.mainData;
section.data = mappedData.mainData;
section.extraData = mappedData.extraData || []; // 设置额外表格数据
// 如果有额外数据确保extraColumns存在
if (mappedData.extraData && mappedData.extraData.length > 0) {
if (!section.extraColumns) {
// 从配置中获取extraColumns
const tableConfig = getTableConfig(sectionIndex);
if (tableConfig && tableConfig.extraColumns) {
section.extraColumns = tableConfig.extraColumns;
}
}
}
} else {
// 其他表格的正常处理
tableData[tableKey] = mappedData;
section.data = mappedData;
}
// 特殊处理数据存储 // 特殊处理数据存储
if (currentTable.value === 'tripleOne') { if (currentTable.value === 'tripleOne') {
@@ -874,10 +894,15 @@
stateAssetsData.value = result.data.data; stateAssetsData.value = result.data.data;
} }
section.data = mappedData;
section.suggestion = ''; section.suggestion = '';
const recordCount = currentTable.value === 'personnel'
? mappedData.mainData.length
: mappedData.length;
message.success( message.success(
`成功生成 ${mappedData.length} 条${currentTable.title}记录` `成功生成 ${recordCount} 条${currentTable.title}记录` +
(currentTable.value === 'personnel' && mappedData.extraData?.length > 0
? `,以及 ${mappedData.extraData.length} 条福利费明细记录`
: '')
); );
} else { } else {
throw new Error(result.data?.error || result.message || '生成失败'); throw new Error(result.data?.error || result.message || '生成失败');
@@ -1071,11 +1096,11 @@
/* 应用历史数据 */ /* 应用历史数据 */
const applyHistoryData = async ( const applyHistoryData = async (
sectionIndex: number, sectionIndex: number,
data: any[], data: any[],
tableValue: string, tableValue: string,
requestDataStr?: string, requestDataStr?: string,
interfaceName?: string interfaceName?: string
) => { ) => {
const section: any = navigationItems.value[sectionIndex]; const section: any = navigationItems.value[sectionIndex];
if (!section) return; if (!section) return;
@@ -1085,7 +1110,7 @@
// 找到对应的表格选项索引 // 找到对应的表格选项索引
const tableOptionIndex = section.tableOptions.findIndex( const tableOptionIndex = section.tableOptions.findIndex(
(option) => option.value === tableValue (option) => option.value === tableValue
); );
if (tableOptionIndex === -1) return; if (tableOptionIndex === -1) return;
@@ -1113,14 +1138,30 @@
const mappedData = dataMapper(data); const mappedData = dataMapper(data);
// 保存数据 // 保存数据
tableData[tableKey] = mappedData; if (tableValue === 'personnel') {
tableData[tableKey] = mappedData.mainData;
section.extraData = mappedData.extraData || []; // 设置额外表格数据
// 如果有额外数据确保extraColumns存在
if (mappedData.extraData && mappedData.extraData.length > 0) {
if (!section.extraColumns) {
section.extraColumns = tableConfig.extraColumns || [];
}
}
} else {
tableData[tableKey] = mappedData;
}
// 切换表格(如果当前不是这个表格) // 切换表格(如果当前不是这个表格)
if (section.currentTableIndex !== tableOptionIndex) { if (section.currentTableIndex !== tableOptionIndex) {
await handleTableChange(sectionIndex, tableOptionIndex); await handleTableChange(sectionIndex, tableOptionIndex);
} else { } else {
// 如果已经是当前表格,直接更新数据 // 如果已经是当前表格,直接更新数据
section.data = mappedData; if (tableValue === 'personnel') {
section.data = mappedData.mainData;
} else {
section.data = mappedData;
}
} }
// 特殊处理数据存储 // 特殊处理数据存储
@@ -1130,6 +1171,10 @@
// 存储国资管理数据,供预算管理审计表使用 // 存储国资管理数据,供预算管理审计表使用
stateAssetsData.value = data; stateAssetsData.value = data;
} }
// 清空选中行
selectedRowsMap[sectionIndex] = [];
selectedRowKeysMap[sectionIndex] = [];
}; };
/* 编辑行 */ /* 编辑行 */