导出列参数

This commit is contained in:
chenlin
2026-01-27 01:20:14 +08:00
parent 9ad7330d78
commit 0f55f4098a

View File

@@ -1988,15 +1988,34 @@ const expandChanges = (row, expendList) => {
} }
} }
// 计算需要导出的列字段(英文字段名)
const exportFields = computed(() => {
if (!tableOption.value.column) return []
const fields: string[] = []
Object.keys(tableOption.value.column).forEach(prop => {
const column = tableOption.value.column[prop]
// 如果 isExport 为 'Y' 或者未设置(默认导出),则添加到导出列表
if (column.isExport === 'Y' || (column.isExport === undefined && !column.hide)) {
fields.push(prop)
}
})
return fields
})
const exportTableData = async () => { const exportTableData = async () => {
const exportBtn = buttonObj.value.header.exportBtn const exportBtn = buttonObj.value.header.exportBtn
const isSelect = tableSelect.value.length const isSelect = tableSelect.value.length
await message.confirm(isSelect ? t('Avue.crud.exportTip') : t('Avue.crud.exportAllTip')) await message.confirm(isSelect ? t('Avue.crud.exportTip') : t('Avue.crud.exportAllTip'))
exportBtn.params.loading = true exportBtn.params.loading = true
const searchObj = isSelect const searchObj: any = isSelect
? { jeeLowCode_export_ids: selectIds.value } ? { jeeLowCode_export_ids: selectIds.value }
: await getSearchData('search') : await getSearchData('search')
TableApi.exportExcelData(props.tableId, searchObj) TableApi.exportExcelData(props.tableId, {
...searchObj,
jeeLowCode_export_fields: exportFields.value
})
.then((data) => download.excel(data, tableInfo.value.tableDescribe, 'xlsx')) .then((data) => download.excel(data, tableInfo.value.tableDescribe, 'xlsx'))
.finally(() => (exportBtn.params.loading = false)) .finally(() => (exportBtn.params.loading = false))
} }