Commit c3560a52e2baaf82a20b716a5db138b266da93dd

Authored by xingyu4j
1 parent 782eb846

fix: vxe 导出全部功能

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