导出列参数
This commit is contained in:
@@ -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 exportBtn = buttonObj.value.header.exportBtn
|
||||
const isSelect = tableSelect.value.length
|
||||
await message.confirm(isSelect ? t('Avue.crud.exportTip') : t('Avue.crud.exportAllTip'))
|
||||
exportBtn.params.loading = true
|
||||
const searchObj = isSelect
|
||||
const searchObj: any = isSelect
|
||||
? { jeeLowCode_export_ids: selectIds.value }
|
||||
: 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'))
|
||||
.finally(() => (exportBtn.params.loading = false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user