修改工作底稿可以直接预览

This commit is contained in:
2026-02-02 16:02:21 +08:00
parent 4ed51bb06a
commit 8cf26ca53a

View File

@@ -212,8 +212,12 @@
> >
<div class="flex justify-start items-center"> <div class="flex justify-start items-center">
<a-space> <a-space>
<a-button type="primary" @click.native="editRow(index)">编辑</a-button> <a-button type="primary" @click.native="editRow(index)"
<a-button type="primary" danger @click.native="deleteRow(index)">删除</a-button> >编辑</a-button
>
<a-button type="primary" danger @click.native="deleteRow(index)"
>删除</a-button
>
<a-button>导出</a-button> <a-button>导出</a-button>
<a-button @click="openEvidenceModal(index)" <a-button @click="openEvidenceModal(index)"
>导出取证单</a-button >导出取证单</a-button
@@ -332,32 +336,18 @@
/> />
<!-- 新格式支持 --> <!-- 新格式支持 -->
<a <span
v-if="fileItem.fileUrl" v-if="fileItem.fileUrl"
:href="fileItem.fileUrl" @click.stop="handleFilePreview(fileItem)"
target="_blank"
@click.stop="handleFileDownload(fileItem, $event)"
class="file-link cursor-pointer text-wrap" class="file-link cursor-pointer text-wrap"
style="color: #1890ff; text-decoration: none" style="color: #1890ff; text-decoration: none"
> >
{{ {{ fileItem.fileName || '未命名文件' }}
(data.caseIndex || '审计-[2026]-xxx') + </span>
'-' +
String(fileIndex + 1).padStart(3, '0') +
'-' +
(fileItem.fileName || '未命名文件')
}}
</a>
<!-- 旧格式兼容 --> <!-- 旧格式兼容 -->
<span v-else class="cursor-pointer text-wrap"> <span v-else class="cursor-pointer text-wrap">
{{ {{ fileItem.fileName || fileItem || '未命名文件' }}
(data.caseIndex || '审计-[2026]-xxx') +
'-' +
String(fileIndex + 1).padStart(3, '0') +
'-' +
(fileItem.fileName || fileItem || '未命名文件')
}}
</span> </span>
</div> </div>
</div> </div>
@@ -631,10 +621,7 @@
): TableProps['rowSelection'] => { ): TableProps['rowSelection'] => {
return { return {
selectedRowKeys: selectedRowKeysMap[sectionIndex] || [], selectedRowKeys: selectedRowKeysMap[sectionIndex] || [],
onChange: ( onChange: (selectedRowKeys: (string | number)[], selectedRows: any[]) => {
selectedRowKeys: (string | number)[],
selectedRows: any[]
) => {
selectedRowsMap[sectionIndex] = selectedRows; selectedRowsMap[sectionIndex] = selectedRows;
selectedRowKeysMap[sectionIndex] = selectedRowKeys; selectedRowKeysMap[sectionIndex] = selectedRowKeys;
} }
@@ -768,7 +755,8 @@
const section: any = navigationItems.value[sectionIndex]; const section: any = navigationItems.value[sectionIndex];
const tableInfo = getTableInfo(sectionIndex); const tableInfo = getTableInfo(sectionIndex);
evidenceBaseInfo.caseIndex = (form as any).caseIndex || props.data?.caseIndex || ''; evidenceBaseInfo.caseIndex =
(form as any).caseIndex || props.data?.caseIndex || '';
evidenceBaseInfo.projectName = form.name || props.data?.name || ''; evidenceBaseInfo.projectName = form.name || props.data?.name || '';
evidenceBaseInfo.auditedTarget = evidenceBaseInfo.auditedTarget =
(form as any).nickname || (props.data as any)?.nickname || ''; (form as any).nickname || (props.data as any)?.nickname || '';
@@ -844,27 +832,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) {
@@ -876,10 +864,10 @@
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
); );
// 使用对应的数据映射函数 // 使用对应的数据映射函数
@@ -918,14 +906,16 @@
} }
section.suggestion = ''; section.suggestion = '';
const recordCount = currentTable.value === 'personnel' const recordCount =
currentTable.value === 'personnel'
? mappedData.mainData.length ? mappedData.mainData.length
: mappedData.length; : mappedData.length;
message.success( message.success(
`成功生成 ${recordCount} 条${currentTable.title}记录` + `成功生成 ${recordCount} 条${currentTable.title}记录` +
(currentTable.value === 'personnel' && mappedData.extraData?.length > 0 (currentTable.value === 'personnel' &&
? `,以及 ${mappedData.extraData.length} 条福利费明细记录` 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 || '生成失败');
@@ -961,27 +951,36 @@
historyData = JSON.stringify(generationData.responseData, null, 2); historyData = JSON.stringify(generationData.responseData, null, 2);
} else if (section.data && section.data.length > 0) { } else if (section.data && section.data.length > 0) {
// 如果没有生成数据,使用当前表格数据 // 如果没有生成数据,使用当前表格数据
historyData = JSON.stringify({ historyData = JSON.stringify(
success: true, {
data: section.data, success: true,
data_source: currentTable.value data: section.data,
}, null, 2); data_source: currentTable.value
},
null,
2
);
} }
// 检查history是否为空 - 新增的验证逻辑 // 检查history是否为空 - 新增的验证逻辑
if (!historyData || historyData.trim() === '') { if (!historyData || historyData.trim() === '') {
message.error('无法生成取证单:没有找到相关的审计数据,请先生成表格内容'); message.error(
'无法生成取证单:没有找到相关的审计数据,请先生成表格内容'
);
return; return;
} }
// 调用generateAuditEvidence API // 调用generateAuditEvidence API
const projectCaseIndex = (form as any).caseIndex || props.data?.caseIndex || ''; const projectCaseIndex =
(form as any).caseIndex || props.data?.caseIndex || '';
const requestData = { const requestData = {
// 基础信息 // 基础信息
caseIndex: projectCaseIndex, caseIndex: projectCaseIndex,
projectName: form.name || props.data?.name || '', projectName: form.name || props.data?.name || '',
auditedTarget: (form as any).nickname || (props.data as any)?.nickname || '', auditedTarget:
auditMatter: currentTable.title || section?.title || section?.name || '', (form as any).nickname || (props.data as any)?.nickname || '',
auditMatter:
currentTable.title || section?.title || section?.name || '',
summaryTitle: section?.title || section?.name || '', summaryTitle: section?.title || section?.name || '',
auditRecord: '', auditRecord: '',
auditFinding: '', auditFinding: '',
@@ -1009,22 +1008,24 @@
// 重大经济决策调查表需要三重一大数据 // 重大经济决策调查表需要三重一大数据
...(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'] }
: {}), : {}),
// 用户信息(后端会自动设置,这里可以留空或传空字符串) // 用户信息(后端会自动设置,这里可以留空或传空字符串)
userName: '' userName: ''
}; };
const apiResult = await auditContentApi.generateAuditEvidence(requestData); const apiResult = await auditContentApi.generateAuditEvidence(
requestData
);
if (apiResult.code === 0 && apiResult.data?.success) { if (apiResult.code === 0 && apiResult.data?.success) {
message.success('取证单生成成功'); message.success('取证单生成成功');
@@ -1033,9 +1034,19 @@
// 自动打开取证单预览弹窗并填充数据 // 自动打开取证单预览弹窗并填充数据
evidenceBaseInfo.caseIndex = projectCaseIndex; evidenceBaseInfo.caseIndex = projectCaseIndex;
evidenceBaseInfo.projectName = apiResult.data.projectName || form.name || props.data?.name || ''; evidenceBaseInfo.projectName =
evidenceBaseInfo.auditedTarget = apiResult.data.auditedTarget || (form as any).nickname || (props.data as any)?.nickname || ''; apiResult.data.projectName || form.name || props.data?.name || '';
evidenceBaseInfo.auditMatter = apiResult.data.auditMatter || currentTable.title || section?.title || section?.name || ''; evidenceBaseInfo.auditedTarget =
apiResult.data.auditedTarget ||
(form as any).nickname ||
(props.data as any)?.nickname ||
'';
evidenceBaseInfo.auditMatter =
apiResult.data.auditMatter ||
currentTable.title ||
section?.title ||
section?.name ||
'';
// 将生成的取证单数据作为选中的行数据传入,包含所有字段 // 将生成的取证单数据作为选中的行数据传入,包含所有字段
const evidenceData = { const evidenceData = {
@@ -1075,7 +1086,9 @@
evidenceSelectedRows.value = [evidenceData]; evidenceSelectedRows.value = [evidenceData];
evidenceModalVisible.value = true; evidenceModalVisible.value = true;
} else { } else {
throw new Error(apiResult.data?.error || apiResult.message || '生成取证单失败'); throw new Error(
apiResult.data?.error || apiResult.message || '生成取证单失败'
);
} }
} catch (error: any) { } catch (error: any) {
console.error('生成取证单失败:', error); console.error('生成取证单失败:', error);
@@ -1266,11 +1279,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;
@@ -1280,7 +1293,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;
@@ -1500,19 +1513,16 @@
section.data.splice(uiIndex, 1, merged); section.data.splice(uiIndex, 1, merged);
} }
if ( if (editingTableKey.value && tableGenerationData[editingTableKey.value]) {
editingTableKey.value &&
tableGenerationData[editingTableKey.value]
) {
const responseData = const responseData =
tableGenerationData[editingTableKey.value].responseData; tableGenerationData[editingTableKey.value].responseData;
if (responseData && responseData.data && Array.isArray(responseData.data)) { if (
const rawIndex = findRawIndex( responseData &&
responseData.data, responseData.data &&
targetRow, Array.isArray(responseData.data)
uiIndex ) {
); const rawIndex = findRawIndex(responseData.data, targetRow, uiIndex);
if (rawIndex !== -1) { if (rawIndex !== -1) {
responseData.data[rawIndex] = { responseData.data[rawIndex] = {
@@ -1534,11 +1544,10 @@
} }
const currentSelections = selectedRowsMap[editingSectionIndex.value] || []; const currentSelections = selectedRowsMap[editingSectionIndex.value] || [];
selectedRowsMap[editingSectionIndex.value] = currentSelections selectedRowsMap[editingSectionIndex.value] = currentSelections.map(
.map( (row: any) =>
(row: any) => section.data.find((item: any) => item.key === row.key) || row
section.data.find((item: any) => item.key === row.key) || row );
);
if (!hasApplied) { if (!hasApplied) {
message.warning('没有可应用的字段'); message.warning('没有可应用的字段');
@@ -1583,7 +1592,9 @@
targetRow?.id !== null && targetRow?.id !== null &&
targetRow?.id !== ''; targetRow?.id !== '';
if (hasValidId) { if (hasValidId) {
const byId = responseList.findIndex((item: any) => item.id === targetRow.id); const byId = responseList.findIndex(
(item: any) => item.id === targetRow.id
);
if (byId !== -1) return byId; if (byId !== -1) return byId;
} }
@@ -1617,7 +1628,9 @@
const rawIndexesToDelete: number[] = []; const rawIndexesToDelete: number[] = [];
selectedRows.forEach((row: any) => { selectedRows.forEach((row: any) => {
const uiIndex = section.data.findIndex((item: any) => item.key === row.key); const uiIndex = section.data.findIndex(
(item: any) => item.key === row.key
);
if (uiIndex !== -1) uiIndexesToDelete.push(uiIndex); if (uiIndex !== -1) uiIndexesToDelete.push(uiIndex);
if (responseData) { if (responseData) {
@@ -1659,7 +1672,9 @@
selectedRowsMap[sectionIndex] = []; selectedRowsMap[sectionIndex] = [];
selectedRowKeysMap[sectionIndex] = []; selectedRowKeysMap[sectionIndex] = [];
message.success(`已删除${uniqueUiIndexes.length || selectedRows.length}条记录`); message.success(
`已删除${uniqueUiIndexes.length || selectedRows.length}条记录`
);
}; };
/* 保存当前表格到历史记录 */ /* 保存当前表格到历史记录 */
@@ -1950,6 +1965,20 @@
} }
} }
); );
const handleFilePreview = (file) => {
console.log(
file.fileUrl,
`https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
file.fileUrl
)}`
);
window.open(
`https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
file.fileUrl
)}`
);
};
</script> </script>
<script lang="ts"> <script lang="ts">