diff --git a/src/views/pwl/pwlProject/components/reportContent.vue b/src/views/pwl/pwlProject/components/reportContent.vue index 66d908c..d325d7c 100644 --- a/src/views/pwl/pwlProject/components/reportContent.vue +++ b/src/views/pwl/pwlProject/components/reportContent.vue @@ -212,8 +212,12 @@ >
- 编辑 - 删除 + 编辑 + 删除 导出 导出取证单 - - {{ - (data.caseIndex || '审计-[2026]-xxx') + - '-' + - String(fileIndex + 1).padStart(3, '0') + - '-' + - (fileItem.fileName || '未命名文件') - }} - + {{ fileItem.fileName || '未命名文件' }} + - {{ - (data.caseIndex || '审计-[2026]-xxx') + - '-' + - String(fileIndex + 1).padStart(3, '0') + - '-' + - (fileItem.fileName || fileItem || '未命名文件') - }} + {{ fileItem.fileName || fileItem || '未命名文件' }}
@@ -631,10 +621,7 @@ ): TableProps['rowSelection'] => { return { selectedRowKeys: selectedRowKeysMap[sectionIndex] || [], - onChange: ( - selectedRowKeys: (string | number)[], - selectedRows: any[] - ) => { + onChange: (selectedRowKeys: (string | number)[], selectedRows: any[]) => { selectedRowsMap[sectionIndex] = selectedRows; selectedRowKeysMap[sectionIndex] = selectedRowKeys; } @@ -768,7 +755,8 @@ const section: any = navigationItems.value[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.auditedTarget = (form as any).nickname || (props.data as any)?.nickname || ''; @@ -844,27 +832,27 @@ libraryIds: props.data?.libraryIds || '', projectLibrary: props.data?.projectLibrary || '', history: - section.data?.length > 0 ? JSON.stringify(section.data, null, 2) : '', + section.data?.length > 0 ? JSON.stringify(section.data, null, 2) : '', suggestion: section.suggestion || '', docList: checkedDirKeys.value, fileList: selectedFileKeys.value, // 重大经济决策调查表需要三重一大数据 ...(currentTable.value === 'decisionTable' - ? { data: tripleOneData.value } - : {}), + ? { data: tripleOneData.value } + : {}), // 预算管理审计表需要国资管理数据 ...(currentTable.value === 'budgetManage' - ? { data: stateAssetsData.value } - : {}), + ? { data: stateAssetsData.value } + : {}), // 预算执行情况审计表需要预算管理审计的数据 ...(currentTable.value === 'budgetExecution' - ? { data: tableData['auditContent5_budgetManage'] } - : {}) + ? { data: tableData['auditContent5_budgetManage'] } + : {}) }; // 获取对应的生成方法 const apiMethod = - apiMethodMap[currentTable.value] || apiMethodMap.default; + apiMethodMap[currentTable.value] || apiMethodMap.default; const generateMethod = auditContentApi[apiMethod.generate]; if (!generateMethod) { @@ -876,10 +864,10 @@ if (result.code === 0 && result.data?.success) { // 保存表格生成数据 saveTableGenerationData( - tableKey, - requestData, - result.data, - currentTable.value + tableKey, + requestData, + result.data, + currentTable.value ); // 使用对应的数据映射函数 @@ -918,14 +906,16 @@ } section.suggestion = ''; - const recordCount = currentTable.value === 'personnel' + const recordCount = + currentTable.value === 'personnel' ? mappedData.mainData.length : mappedData.length; message.success( - `成功生成 ${recordCount} 条${currentTable.title}记录` + - (currentTable.value === 'personnel' && mappedData.extraData?.length > 0 - ? `,以及 ${mappedData.extraData.length} 条福利费明细记录` - : '') + `成功生成 ${recordCount} 条${currentTable.title}记录` + + (currentTable.value === 'personnel' && + mappedData.extraData?.length > 0 + ? `,以及 ${mappedData.extraData.length} 条福利费明细记录` + : '') ); } else { throw new Error(result.data?.error || result.message || '生成失败'); @@ -961,27 +951,36 @@ historyData = JSON.stringify(generationData.responseData, null, 2); } else if (section.data && section.data.length > 0) { // 如果没有生成数据,使用当前表格数据 - historyData = JSON.stringify({ - success: true, - data: section.data, - data_source: currentTable.value - }, null, 2); + historyData = JSON.stringify( + { + success: true, + data: section.data, + data_source: currentTable.value + }, + null, + 2 + ); } // 检查history是否为空 - 新增的验证逻辑 if (!historyData || historyData.trim() === '') { - message.error('无法生成取证单:没有找到相关的审计数据,请先生成表格内容'); + message.error( + '无法生成取证单:没有找到相关的审计数据,请先生成表格内容' + ); return; } // 调用generateAuditEvidence API - const projectCaseIndex = (form as any).caseIndex || props.data?.caseIndex || ''; + const projectCaseIndex = + (form as any).caseIndex || props.data?.caseIndex || ''; const requestData = { // 基础信息 caseIndex: projectCaseIndex, projectName: form.name || props.data?.name || '', - auditedTarget: (form as any).nickname || (props.data as any)?.nickname || '', - auditMatter: currentTable.title || section?.title || section?.name || '', + auditedTarget: + (form as any).nickname || (props.data as any)?.nickname || '', + auditMatter: + currentTable.title || section?.title || section?.name || '', summaryTitle: section?.title || section?.name || '', auditRecord: '', auditFinding: '', @@ -1009,22 +1008,24 @@ // 重大经济决策调查表需要三重一大数据 ...(currentTable.value === 'decisionTable' - ? { data: tripleOneData.value } - : {}), + ? { data: tripleOneData.value } + : {}), // 预算管理审计表需要国资管理数据 ...(currentTable.value === 'budgetManage' - ? { data: stateAssetsData.value } - : {}), + ? { data: stateAssetsData.value } + : {}), // 预算执行情况审计表需要预算管理审计的数据 ...(currentTable.value === 'budgetExecution' - ? { data: tableData['auditContent5_budgetManage'] } - : {}), + ? { data: tableData['auditContent5_budgetManage'] } + : {}), // 用户信息(后端会自动设置,这里可以留空或传空字符串) userName: '' }; - const apiResult = await auditContentApi.generateAuditEvidence(requestData); + const apiResult = await auditContentApi.generateAuditEvidence( + requestData + ); if (apiResult.code === 0 && apiResult.data?.success) { message.success('取证单生成成功'); @@ -1033,9 +1034,19 @@ // 自动打开取证单预览弹窗并填充数据 evidenceBaseInfo.caseIndex = projectCaseIndex; - evidenceBaseInfo.projectName = apiResult.data.projectName || form.name || props.data?.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 || ''; + evidenceBaseInfo.projectName = + apiResult.data.projectName || form.name || props.data?.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 = { @@ -1075,7 +1086,9 @@ evidenceSelectedRows.value = [evidenceData]; evidenceModalVisible.value = true; } else { - throw new Error(apiResult.data?.error || apiResult.message || '生成取证单失败'); + throw new Error( + apiResult.data?.error || apiResult.message || '生成取证单失败' + ); } } catch (error: any) { console.error('生成取证单失败:', error); @@ -1266,11 +1279,11 @@ /* 应用历史数据 */ const applyHistoryData = async ( - sectionIndex: number, - data: any[], - tableValue: string, - requestDataStr?: string, - interfaceName?: string + sectionIndex: number, + data: any[], + tableValue: string, + requestDataStr?: string, + interfaceName?: string ) => { const section: any = navigationItems.value[sectionIndex]; if (!section) return; @@ -1280,7 +1293,7 @@ // 找到对应的表格选项索引 const tableOptionIndex = section.tableOptions.findIndex( - (option) => option.value === tableValue + (option) => option.value === tableValue ); if (tableOptionIndex === -1) return; @@ -1500,19 +1513,16 @@ section.data.splice(uiIndex, 1, merged); } - if ( - editingTableKey.value && - tableGenerationData[editingTableKey.value] - ) { + if (editingTableKey.value && tableGenerationData[editingTableKey.value]) { const responseData = tableGenerationData[editingTableKey.value].responseData; - if (responseData && responseData.data && Array.isArray(responseData.data)) { - const rawIndex = findRawIndex( - responseData.data, - targetRow, - uiIndex - ); + if ( + responseData && + responseData.data && + Array.isArray(responseData.data) + ) { + const rawIndex = findRawIndex(responseData.data, targetRow, uiIndex); if (rawIndex !== -1) { responseData.data[rawIndex] = { @@ -1534,11 +1544,10 @@ } const currentSelections = selectedRowsMap[editingSectionIndex.value] || []; - selectedRowsMap[editingSectionIndex.value] = currentSelections - .map( - (row: any) => - section.data.find((item: any) => item.key === row.key) || row - ); + selectedRowsMap[editingSectionIndex.value] = currentSelections.map( + (row: any) => + section.data.find((item: any) => item.key === row.key) || row + ); if (!hasApplied) { message.warning('没有可应用的字段'); @@ -1583,7 +1592,9 @@ targetRow?.id !== null && targetRow?.id !== ''; 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; } @@ -1617,7 +1628,9 @@ const rawIndexesToDelete: number[] = []; 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 (responseData) { @@ -1659,7 +1672,9 @@ selectedRowsMap[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 + )}` + ); + };