diff --git a/src/views/fileManagement/sheep_file/index.vue b/src/views/fileManagement/sheep_file/index.vue index 1f88030..5cf289f 100644 --- a/src/views/fileManagement/sheep_file/index.vue +++ b/src/views/fileManagement/sheep_file/index.vue @@ -1271,16 +1271,31 @@ function handleDelete(row) { }).catch(() => {}) } -// 8. 修改 handleExport 函数,导出时也包含自定义筛选条件 +// 8. 修复:精确读取表格实际显示的列进行导出 function handleExport() { const exportParams = { ...queryParams.value } - // 如果有自定义筛选条件,合并到导出参数中 + // 1. 处理勾选的行 + if (ids.value.length > 0) { + exportParams.exportIds = ids.value.join(',') + } + + // 2. 【核心修复】直接遍历 columns,只有 visible 为 true 的才允许导出!绝对防漏 + const actualVisibleCols = Object.keys(columns).filter(key => columns[key].visible); + if (actualVisibleCols.length > 0) { + exportParams.visibleColumns = actualVisibleCols.join(',') + } + + // 3. 合并自定义筛选 if (isCustomFilterActive.value && Object.keys(customFilterParams.value).length > 0) { Object.assign(exportParams, customFilterParams.value) } - proxy.download('sheep_file/sheep_file/export', exportParams, `sheep_file_${new Date().getTime()}.xlsx`) + const tipMsg = ids.value.length > 0 ? "是否确认导出选中的数据项?" : "未勾选具体行,是否确认导出当前条件下的所有数据?"; + + proxy.$modal.confirm(tipMsg).then(function() { + proxy.download('sheep_file/sheep_file/export', exportParams, `sheep_file_${new Date().getTime()}.xlsx`) + }).catch(() => {}) } // 打开列设置对话框