|
|
@@ -6,9 +6,10 @@ import { ColEx } from '/@/components/Form/src/types';
|
|
|
import { FormActionType } from '/@/components/Form';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { useMethods } from '/@/hooks/system/useMethods';
|
|
|
+import { FETCH_SETTING, PAGE_SIZE } from '/@/components/Table/src/const';
|
|
|
import { useDesign } from '/@/hooks/web/useDesign';
|
|
|
import { filterObj } from '/@/utils/common/compUtils';
|
|
|
-import { isFunction } from '@/utils/is';
|
|
|
+import { isBoolean, isFunction } from '@/utils/is';
|
|
|
|
|
|
// 定义 useListPage 方法所需参数
|
|
|
interface ListPageOptions {
|
|
|
@@ -59,7 +60,7 @@ export function useListPage(options: ListPageOptions) {
|
|
|
|
|
|
const tableContext = useListTable(options.tableProps);
|
|
|
|
|
|
- const [, { getForm, reload, setLoading, getColumns }, { selectedRowKeys }] = tableContext;
|
|
|
+ const [, { getForm, reload, setLoading, getColumns, getPaginationRef }, { selectedRowKeys }] = tableContext;
|
|
|
|
|
|
// 导出 excel
|
|
|
async function onExportXls() {
|
|
|
@@ -108,6 +109,16 @@ export function useListPage(options: ListPageOptions) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //根据表格分页配置决定是否追加分页参数
|
|
|
+ const paginationRef = getPaginationRef();
|
|
|
+ if (!isBoolean(paginationRef)) {
|
|
|
+ // paginationRef 为 PaginationProps 对象,分页已启用
|
|
|
+ Object.assign(paramsForm, {
|
|
|
+ [FETCH_SETTING.pageField]: paginationRef?.current || 1,
|
|
|
+ [FETCH_SETTING.sizeField]: paginationRef?.pageSize || PAGE_SIZE,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return handleExportXls(title as string, realUrl, filterObj(paramsForm));
|
|
|
} else {
|
|
|
$message.createMessage.warn('没有传递 exportConfig.url 参数');
|