Commit c3560a52e2baaf82a20b716a5db138b266da93dd
1 parent
782eb846
fix: vxe 导出全部功能
Showing
1 changed file
with
4 additions
and
3 deletions
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts
| ... | ... | @@ -15,6 +15,7 @@ interface UseVxeGridConfig<T = any> { |
| 15 | 15 | treeConfig?: VxeTablePropTypes.TreeConfig // 树形表单配置 |
| 16 | 16 | isList?: boolean // 是否不带分页的list |
| 17 | 17 | getListApi: (option: any) => Promise<T> // 获取列表接口 |
| 18 | + getAllListApi?: (option: any) => Promise<T> // 获取全部数据接口 用于VXE导出 | |
| 18 | 19 | deleteApi?: (option: any) => Promise<T> // 删除接口 |
| 19 | 20 | exportListApi?: (option: any) => Promise<T> // 导出接口 |
| 20 | 21 | exportName?: string // 导出文件夹名称 |
| ... | ... | @@ -99,8 +100,8 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 99 | 100 | queryAll: ({ form }) => { |
| 100 | 101 | const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form))) |
| 101 | 102 | return new Promise(async (resolve) => { |
| 102 | - if (config?.exportListApi) { | |
| 103 | - resolve(await config?.exportListApi(queryParams)) | |
| 103 | + if (config?.getAllListApi) { | |
| 104 | + resolve(await config?.getAllListApi(queryParams)) | |
| 104 | 105 | } else { |
| 105 | 106 | resolve(await config?.getListApi(queryParams)) |
| 106 | 107 | } |
| ... | ... | @@ -113,7 +114,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 113 | 114 | // 默认选中类型 |
| 114 | 115 | type: 'csv', |
| 115 | 116 | // 自定义数据量列表 |
| 116 | - modes: config?.exportListApi ? ['current', 'all'] : ['current'], | |
| 117 | + modes: config?.getAllListApi ? ['current', 'all'] : ['current'], | |
| 117 | 118 | columns: config?.allSchemas.printSchema |
| 118 | 119 | } |
| 119 | 120 | }) | ... | ... |