feat:项目管理-审计内容-优化工作底稿索引

This commit is contained in:
2026-01-07 17:28:03 +08:00
parent d2ad31bb34
commit 392e51701d
2 changed files with 76 additions and 12 deletions

View File

@@ -158,31 +158,75 @@ export function findTableConfigByInterface(interfaceName: string) {
return null;
}
// 解析workPaperIndex字符串为对象数组
function parseWorkPaperIndex(workPaperIndex) {
if (!workPaperIndex || !Array.isArray(workPaperIndex)) return [];
return workPaperIndex.map(item => {
if (typeof item === 'string') {
const parts = item.split('||');
if (parts.length >= 3) {
return {
fileId: parts[0] || '',
fileName: parts[1] || '',
fileUrl: parts[2] || ''
};
}
}
// 兼容旧格式
return {
fileId: '',
fileName: typeof item === 'string' ? item : '',
fileUrl: ''
};
});
}
// 通用数据映射函数
export function createDataMapper(type: string) {
const mappers = {
default1: (data) => data.map((item, index) => ({ key: index, index: index + 1, ...item })),
leaderList: (data) => data.map((item, index) => ({ key: index, ...item })),
default1: (data) => data.map((item, index) => ({
key: index,
index: index + 1,
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
leaderList: (data) => data.map((item, index) => ({
key: index,
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
expense: (data) => data.map((item, index) => ({
key: index,
...item,
finalStatementAmount: formatAmount(item.finalStatementAmount),
initialBudgetAmount: formatAmount(item.initialBudgetAmount)
initialBudgetAmount: formatAmount(item.initialBudgetAmount),
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
eightReg: (data) => data.map((item, index) => ({
key: index,
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
eightReg: (data) => data.map((item, index) => ({ key: index, ...item })),
strategyAudit: (data) => data.map((item, index) => ({
key: index,
index: index + 1,
...item
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
tripleOne: (data) => data.map((item, index) => ({
key: index,
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
tripleOne: (data) => data.map((item, index) => ({ key: index, ...item })),
decisionTable: (data) => data.map((item, index) => ({
key: index,
index: index + 1,
goods: item.executionEffect?.good || item.goods || '否',
normal: item.executionEffect?.normal || item.normal || '否',
bad: item.executionEffect?.bad || item.bad || '否',
...item
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
})),
budgetManage: (data) => data.map((item, index) => ({
key: index,
@@ -202,7 +246,7 @@ export function createDataMapper(type: string) {
govProcurement: formatAmount(item.indicatorUseGovProcurement), // 指标运用-政府采购
// 其他字段
indicatorBalance: formatAmount(item.indicatorBalance), // 指标结余
workPaperIndex: Array.isArray(item.workPaperIndex) ? item.workPaperIndex : [], // 工作底稿索引
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex), // 工作底稿索引
})),
investmentSituation: (data) => data.map((item, index) => ({
key: index,
@@ -211,11 +255,16 @@ export function createDataMapper(type: string) {
auditContent: item.auditContent || item.content || '',
checkEvidence: item.checkEvidence || item.evidence || '',
testResult: item.testResult || '待检查',
workPaperIndex: Array.isArray(item.workPaperIndex) ? item.workPaperIndex : [],
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex),
...item
})),
// 其他类型的映射...
default: (data) => data.map((item, index) => ({ key: index, index: index + 1, ...item }))
default: (data) => data.map((item, index) => ({
key: index,
index: index + 1,
...item,
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
}))
};
return mappers[type] || mappers.default;