feat:项目管理-审计内容-优化工作底稿索引
This commit is contained in:
@@ -158,31 +158,75 @@ export function findTableConfigByInterface(interfaceName: string) {
|
|||||||
return null;
|
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) {
|
export function createDataMapper(type: string) {
|
||||||
const mappers = {
|
const mappers = {
|
||||||
default1: (data) => data.map((item, index) => ({ key: index, index: index + 1, ...item })),
|
default1: (data) => data.map((item, index) => ({
|
||||||
leaderList: (data) => data.map((item, index) => ({ key: index, ...item })),
|
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) => ({
|
expense: (data) => data.map((item, index) => ({
|
||||||
key: index,
|
key: index,
|
||||||
...item,
|
...item,
|
||||||
finalStatementAmount: formatAmount(item.finalStatementAmount),
|
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) => ({
|
strategyAudit: (data) => data.map((item, index) => ({
|
||||||
key: index,
|
key: index,
|
||||||
index: index + 1,
|
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) => ({
|
decisionTable: (data) => data.map((item, index) => ({
|
||||||
key: index,
|
key: index,
|
||||||
index: index + 1,
|
index: index + 1,
|
||||||
goods: item.executionEffect?.good || item.goods || '否',
|
goods: item.executionEffect?.good || item.goods || '否',
|
||||||
normal: item.executionEffect?.normal || item.normal || '否',
|
normal: item.executionEffect?.normal || item.normal || '否',
|
||||||
bad: item.executionEffect?.bad || item.bad || '否',
|
bad: item.executionEffect?.bad || item.bad || '否',
|
||||||
...item
|
...item,
|
||||||
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex)
|
||||||
})),
|
})),
|
||||||
budgetManage: (data) => data.map((item, index) => ({
|
budgetManage: (data) => data.map((item, index) => ({
|
||||||
key: index,
|
key: index,
|
||||||
@@ -202,7 +246,7 @@ export function createDataMapper(type: string) {
|
|||||||
govProcurement: formatAmount(item.indicatorUseGovProcurement), // 指标运用-政府采购
|
govProcurement: formatAmount(item.indicatorUseGovProcurement), // 指标运用-政府采购
|
||||||
// 其他字段
|
// 其他字段
|
||||||
indicatorBalance: formatAmount(item.indicatorBalance), // 指标结余
|
indicatorBalance: formatAmount(item.indicatorBalance), // 指标结余
|
||||||
workPaperIndex: Array.isArray(item.workPaperIndex) ? item.workPaperIndex : [], // 工作底稿索引
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex), // 工作底稿索引
|
||||||
})),
|
})),
|
||||||
investmentSituation: (data) => data.map((item, index) => ({
|
investmentSituation: (data) => data.map((item, index) => ({
|
||||||
key: index,
|
key: index,
|
||||||
@@ -211,11 +255,16 @@ export function createDataMapper(type: string) {
|
|||||||
auditContent: item.auditContent || item.content || '',
|
auditContent: item.auditContent || item.content || '',
|
||||||
checkEvidence: item.checkEvidence || item.evidence || '',
|
checkEvidence: item.checkEvidence || item.evidence || '',
|
||||||
testResult: item.testResult || '待检查',
|
testResult: item.testResult || '待检查',
|
||||||
workPaperIndex: Array.isArray(item.workPaperIndex) ? item.workPaperIndex : [],
|
workPaperIndex: parseWorkPaperIndex(item.workPaperIndex),
|
||||||
...item
|
...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;
|
return mappers[type] || mappers.default;
|
||||||
|
|||||||
@@ -250,13 +250,28 @@
|
|||||||
<div
|
<div
|
||||||
v-for="(fileItem, fileIndex) in record.workPaperIndex"
|
v-for="(fileItem, fileIndex) in record.workPaperIndex"
|
||||||
:key="fileIndex"
|
:key="fileIndex"
|
||||||
|
class="file-item"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src="@/assets/word.png"
|
src="@/assets/word.png"
|
||||||
style="width: 20px; height: 20px"
|
style="width: 20px; height: 20px; vertical-align: middle; margin-right: 4px;"
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
<span class="cursor-pointer text-wrap">{{ fileItem }}</span>
|
<!-- 新格式支持 -->
|
||||||
|
<a
|
||||||
|
v-if="fileItem.fileUrl"
|
||||||
|
:href="fileItem.fileUrl"
|
||||||
|
target="_blank"
|
||||||
|
@click.stop="handleFileDownload(fileItem, $event)"
|
||||||
|
class="file-link"
|
||||||
|
style="color: #1890ff; text-decoration: none; cursor: pointer;"
|
||||||
|
>
|
||||||
|
{{ fileItem.fileName || '未命名文件' }}
|
||||||
|
</a>
|
||||||
|
<!-- 旧格式兼容 -->
|
||||||
|
<span v-else class="file-name">
|
||||||
|
{{ fileItem.fileName || fileItem || '未命名文件' }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user