483 lines
14 KiB
TypeScript
483 lines
14 KiB
TypeScript
import table9ExtraColumns from './table9ExtraColumns';
|
|
|
|
export const tableConfigs = {
|
|
// 审计内容1表格配置
|
|
auditContent1: {
|
|
type: 'auditContent1',
|
|
title: '贯彻决策部署情况',
|
|
options: [
|
|
// { title: '贯彻决策部署', value: 'default1', columns: () => import('./table1Columns').then(m => m.default1Columns) },
|
|
{
|
|
title: '领导班子名单',
|
|
value: 'leaderList',
|
|
columns: () =>
|
|
import('./table1Columns').then((m) => m.leaderListColumns)
|
|
},
|
|
{
|
|
title: '决策支出表',
|
|
value: 'expense',
|
|
columns: () => import('./table1Columns').then((m) => m.expenseColumns)
|
|
},
|
|
{
|
|
title: '八项规定',
|
|
value: 'eightReg',
|
|
columns: () => import('./table1Columns').then((m) => m.eightRegColumns)
|
|
}
|
|
],
|
|
// 接口映射
|
|
interfaceMap: {
|
|
default1: '/api/ai/auditContent1/generateDefault1Table',
|
|
leaderList: '/api/ai/auditContent1/generateLeaderListTable',
|
|
expense: '/api/ai/auditContent1/generateExpenseTable',
|
|
eightReg: '/api/ai/auditContent1/generateEightRegTable'
|
|
}
|
|
},
|
|
// 审计内容2表格配置
|
|
auditContent2: {
|
|
type: 'auditContent2',
|
|
title: '单位发展战略执行',
|
|
options: [
|
|
{
|
|
title: '单位发展战略执行',
|
|
value: 'strategyAudit',
|
|
columns: () =>
|
|
import('./table2Columns').then((m) => m.strategyAuditColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
strategyAudit: '/api/ai/auditContent2/generateStrategyAuditTable'
|
|
}
|
|
},
|
|
// 审计内容3表格配置
|
|
auditContent3: {
|
|
type: 'auditContent3',
|
|
title: '重大经济决策调查',
|
|
options: [
|
|
{
|
|
title: '重大经济决策调查表',
|
|
value: 'decisionTable',
|
|
columns: () =>
|
|
import('./table3Columns').then((m) => m.decisionTableColumns)
|
|
},
|
|
{
|
|
title: '三重一大',
|
|
value: 'tripleOne',
|
|
columns: () => import('./table3Columns').then((m) => m.tripleOneColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
tripleOne: '/api/ai/auditContent3/generateTripleOneTable',
|
|
decisionTable: '/api/ai/auditContent3/generateDecisionTable'
|
|
}
|
|
},
|
|
// 审计内容4表格配置
|
|
auditContent4: {
|
|
type: 'auditContent4',
|
|
title: '目标完成情况',
|
|
options: [
|
|
{
|
|
title: '目标责任完成情况表',
|
|
value: 'target',
|
|
columns: () => import('./table4Columns').then((m) => m.columns0)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
target: '/api/ai/auditContent4/generateTargetTable'
|
|
}
|
|
},
|
|
// 审计内容5表格配置
|
|
auditContent5: {
|
|
type: 'auditContent5',
|
|
title: '财务管理情况',
|
|
options: [
|
|
{
|
|
title: '预算管理审计',
|
|
value: 'budgetManage',
|
|
columns: () =>
|
|
import('./table5Columns').then((m) => m.budgetManageColumns)
|
|
},
|
|
{
|
|
title: '预算执行情况审计',
|
|
value: 'budgetExecution',
|
|
columns: () =>
|
|
import('./table5Columns').then((m) => m.budgetExecutionColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
budgetManage: '/api/ai/auditContent5/generateBudgetManageTable',
|
|
budgetExecution: '/api/ai/auditContent5/generateBudgetExecutionTable'
|
|
}
|
|
},
|
|
// 审计内容6表格配置
|
|
auditContent6: {
|
|
type: 'auditContent6',
|
|
title: '国资管理情况',
|
|
options: [
|
|
{
|
|
title: '国有资产管理审计',
|
|
value: 'assets',
|
|
columns: () =>
|
|
import('./table6Columns').then((m) => m.stateAssetsManageColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
assets: '/api/ai/auditContent6/generateAssetsTable'
|
|
}
|
|
},
|
|
auditContent7: {
|
|
type: 'auditContent7',
|
|
title: '重大投资情况',
|
|
options: [
|
|
{
|
|
title: '重大投资情况审计',
|
|
value: 'investmentSituation',
|
|
columns: () =>
|
|
import('./table7Columns').then((m) => m.investmentSituationColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
investmentSituation:
|
|
'/api/ai/auditContent7/generateInvestmentSituationTable'
|
|
}
|
|
},
|
|
auditContent8: {
|
|
type: 'auditContent8',
|
|
title: '治理结构与内部控制',
|
|
options: [
|
|
{
|
|
title: '内部控制测试',
|
|
value: 'internalControl',
|
|
columns: () =>
|
|
import('./table8Columns').then((m) => m.internalControlTestColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
internalControl: '/api/ai/auditContent8/generateInternalControlTable'
|
|
}
|
|
},
|
|
auditContent9: {
|
|
type: 'auditContent9',
|
|
title: '人员编制管理',
|
|
options: [
|
|
{
|
|
title: '人员编制管理审计',
|
|
value: 'personnel',
|
|
columns: () =>
|
|
import('./table9Columns').then((m) => m.personnelEstablishmentColumns)
|
|
}
|
|
],
|
|
extraTableTitle: '福利费超范围支出明细清单',
|
|
extraColumns: table9ExtraColumns,
|
|
interfaceMap: {
|
|
personnel: '/api/ai/auditContent9/generatePersonnelTable'
|
|
}
|
|
},
|
|
auditContent10: {
|
|
type: 'auditContent10',
|
|
title: '廉政情况',
|
|
options: [
|
|
{
|
|
title: '党风廉政建设责任制审计',
|
|
value: 'partyConduct',
|
|
columns: () =>
|
|
import('./table10Columns').then((m) => m.partyConductColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
partyConduct: '/api/ai/auditContent10/generatePartyConductTable'
|
|
}
|
|
},
|
|
auditContent11: {
|
|
type: 'auditContent11',
|
|
title: '历史审计问题整改',
|
|
options: [
|
|
{
|
|
title: '历史审计问题整改',
|
|
value: 'history',
|
|
columns: () =>
|
|
import('./table11Columns').then((m) => m.auditHistoryColumns)
|
|
}
|
|
],
|
|
interfaceMap: {
|
|
history: '/api/ai/auditContent11/generateHistoryTable'
|
|
}
|
|
}
|
|
};
|
|
|
|
// 获取表格配置
|
|
export function getTableConfig(sectionIndex: number) {
|
|
const configKeys = Object.keys(tableConfigs);
|
|
if (sectionIndex >= 0 && sectionIndex < configKeys.length) {
|
|
return tableConfigs[configKeys[sectionIndex]];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// 获取所有表格配置
|
|
export function getAllTableConfigs() {
|
|
return tableConfigs;
|
|
}
|
|
|
|
// 通过接口名称查找表格配置
|
|
export function findTableConfigByInterface(interfaceName: string) {
|
|
for (const [key, config] of Object.entries(tableConfigs)) {
|
|
for (const [tableValue, tableInterface] of Object.entries(
|
|
config.interfaceMap || {}
|
|
)) {
|
|
if (tableInterface === interfaceName) {
|
|
return {
|
|
sectionType: key,
|
|
tableValue,
|
|
config
|
|
};
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// 解析workPaperIndex字符串为对象数组
|
|
function parseWorkPaperIndex(workPaperIndex) {
|
|
if (!workPaperIndex || !Array.isArray(workPaperIndex)) return [];
|
|
|
|
return workPaperIndex.map((item) => {
|
|
if (item && typeof item === 'object') {
|
|
return {
|
|
fileId: item.fileId || item.file_id || '',
|
|
fileName: item.fileName || item.file_name || '',
|
|
fileUrl: item.fileUrl || item.url || ''
|
|
};
|
|
}
|
|
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,
|
|
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),
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
eightReg: (data) =>
|
|
data.map((item, index) => ({
|
|
key: index,
|
|
...item,
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
strategyAudit: (data) =>
|
|
data.map((item, index) => ({
|
|
key: index,
|
|
index: index + 1,
|
|
...item,
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
tripleOne: (data) =>
|
|
data.map((item, index) => ({
|
|
key: index,
|
|
...item,
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
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,
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
budgetManage: (data) =>
|
|
data.map((item, index) => ({
|
|
key: index,
|
|
index: index + 1,
|
|
...item,
|
|
budgetSubject: item.budgetSubject || '-',
|
|
indicatorSource: item.indicatorSource,
|
|
total: formatAmount(item.indicatorSourceTotal),
|
|
lastYearBalance: formatAmount(item.indicatorSourceLastYearBalance),
|
|
initialBudget: formatAmount(item.indicatorSourceInitialBudget),
|
|
additionalBudget: formatAmount(item.indicatorSourceAdditionalBudget),
|
|
indicatorUseTotal: formatAmount(item.indicatorUseTotal),
|
|
appropriationSubtotal: formatAmount(
|
|
item.indicatorUseAppropriationSubtotal
|
|
),
|
|
appropriation: formatAmount(item.indicatorUseAppropriation),
|
|
salaryPayment: formatAmount(item.indicatorUseSalaryPayment),
|
|
govProcurement: formatAmount(item.indicatorUseGovProcurement),
|
|
indicatorBalance: formatAmount(item.indicatorBalance),
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
investmentSituation: (data) =>
|
|
data.map((item, index) => ({
|
|
key: index,
|
|
index: index + 1,
|
|
category: item.category || '未分类',
|
|
auditContent: item.auditContent || item.content || '',
|
|
checkEvidence: item.checkEvidence || item.evidence || '',
|
|
testResult: item.testResult || '待检查',
|
|
...item,
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
})),
|
|
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) =>
|
|
data.map((item, index) => ({
|
|
key: index,
|
|
index: index + 1,
|
|
...item,
|
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
|
}))
|
|
};
|
|
|
|
return mappers[type] || mappers.default;
|
|
}
|
|
|
|
// 格式化金额
|
|
function formatAmount(amount) {
|
|
if (!amount) return '0.00';
|
|
if (typeof amount === 'string' && amount.includes(',')) return amount;
|
|
const num = parseFloat(amount);
|
|
return isNaN(num)
|
|
? '0.00'
|
|
: num.toLocaleString('zh-CN', {
|
|
minimumFractionDigits: 2,
|
|
maximumFractionDigits: 2
|
|
});
|
|
}
|
|
|
|
// 生成接口映射
|
|
export const apiMethodMap = {
|
|
// 审计内容1
|
|
default1: {
|
|
generate: 'generateDefault1Table',
|
|
export: 'exportDefault1Table'
|
|
},
|
|
leaderList: {
|
|
generate: 'generateLeaderListTable',
|
|
export: 'exportLeaderListTable'
|
|
},
|
|
expense: { generate: 'generateExpenseTable', export: 'exportExpenseTable' },
|
|
eightReg: {
|
|
generate: 'generateEightRegTable',
|
|
export: 'exportEightRegTable'
|
|
},
|
|
// 审计内容2
|
|
strategyAudit: {
|
|
generate: 'generateStrategyAuditTable',
|
|
export: 'exportStrategyAuditTable'
|
|
},
|
|
// 审计内容3
|
|
tripleOne: {
|
|
generate: 'generateTripleOneTable',
|
|
export: 'exportTripleOneTable'
|
|
},
|
|
decisionTable: {
|
|
generate: 'generateDecisionTable',
|
|
export: 'exportDecisionTable'
|
|
},
|
|
// 审计内容4
|
|
target: { generate: 'generateTargetTable', export: 'exportTargetTable' },
|
|
// 审计内容5
|
|
budgetManage: {
|
|
generate: 'generateBudgetManageTable',
|
|
export: 'exportBudgetManageTable'
|
|
},
|
|
budgetExecution: {
|
|
generate: 'generateBudgetExecutionTable',
|
|
export: 'exportBudgetExecutionTable'
|
|
},
|
|
// 审计内容6
|
|
assets: { generate: 'generateAssetsTable', export: 'exportAssetsTable' },
|
|
// 审计内容7
|
|
investmentSituation: {
|
|
generate: 'generateInvestmentSituationTable',
|
|
export: 'exportInvestmentSituationTable'
|
|
},
|
|
// 审计内容8
|
|
internalControl: {
|
|
generate: 'generateInternalControlTable',
|
|
export: 'exportInternalControlTable'
|
|
},
|
|
// 审计内容9
|
|
personnel: {
|
|
generate: 'generatePersonnelTable',
|
|
export: 'exportPersonnelTable'
|
|
},
|
|
// 审计内容10
|
|
partyConduct: {
|
|
generate: 'generatePartyConductTable',
|
|
export: 'exportPartyConductTable'
|
|
},
|
|
// 审计内容11
|
|
history: { generate: 'generateHistoryTable', export: 'exportHistoryTable' },
|
|
// 默认
|
|
default: { generate: 'generateDefaultTable', export: 'exportDefaultTable' }
|
|
};
|
|
|
|
export default {
|
|
tableConfigs,
|
|
getTableConfig,
|
|
getAllTableConfigs,
|
|
findTableConfigByInterface,
|
|
createDataMapper,
|
|
apiMethodMap
|
|
};
|