diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index e26194d1355..4d02ce11072 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -102,7 +102,13 @@ }); const { getLoading, setLoading } = useLoading(getProps); - const { getPaginationInfo, getPagination, setPagination } = usePagination(getProps); + const { + getPaginationInfo, + getPagination, + setPagination, + setShowPagination, + getShowPagination, + } = usePagination(getProps); const { getRowSelection, @@ -229,6 +235,8 @@ getCacheColumns, emit, updateTableData, + setShowPagination, + getShowPagination, getSize: () => { return unref(getBindValues).size as SizeType; }, diff --git a/src/components/Table/src/components/settings/ColumnSetting.vue b/src/components/Table/src/components/settings/ColumnSetting.vue index 09c44fc4747..f83f5d5b03d 100644 --- a/src/components/Table/src/components/settings/ColumnSetting.vue +++ b/src/components/Table/src/components/settings/ColumnSetting.vue @@ -211,18 +211,17 @@ cachePlainOptions.value = columns; state.defaultCheckList = checkList; } else { - const fixedColumns = columns.filter((item) => - Reflect.has(item, 'fixed') - ) as BasicColumn[]; + // const fixedColumns = columns.filter((item) => + // Reflect.has(item, 'fixed') + // ) as BasicColumn[]; unref(plainOptions).forEach((item: BasicColumn) => { - const findItem = fixedColumns.find((fCol) => fCol.dataIndex === item.dataIndex); + const findItem = columns.find((col: BasicColumn) => col.dataIndex === item.dataIndex); if (findItem) { item.fixed = findItem.fixed; } }); } - state.checkedList = checkList; } diff --git a/src/components/Table/src/hooks/usePagination.tsx b/src/components/Table/src/hooks/usePagination.tsx index db0c521b6ca..7e73fb12823 100644 --- a/src/components/Table/src/hooks/usePagination.tsx +++ b/src/components/Table/src/hooks/usePagination.tsx @@ -27,13 +27,16 @@ function itemRender({ page, type, originalElement }: ItemRender) { export function usePagination(refProps: ComputedRef) { const configRef = ref({}); + const show = ref(true); + const { t } = useI18n(); const getPaginationInfo = computed((): PaginationProps | boolean => { const { pagination } = unref(refProps); - if (isBoolean(pagination) && !pagination) { + if (!unref(show) || (isBoolean(pagination) && !pagination)) { return false; } + return { current: 1, pageSize: PAGE_SIZE, @@ -60,5 +63,14 @@ export function usePagination(refProps: ComputedRef) { function getPagination() { return unref(getPaginationInfo); } - return { getPagination, getPaginationInfo, setPagination }; + + function getShowPagination() { + return unref(show); + } + + async function setShowPagination(flag: boolean) { + show.value = flag; + } + + return { getPagination, getPaginationInfo, setShowPagination, getShowPagination, setPagination }; } diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts index cbf175a9901..6dac61aaf9e 100644 --- a/src/components/Table/src/hooks/useTable.ts +++ b/src/components/Table/src/hooks/useTable.ts @@ -121,6 +121,12 @@ export function useTable( getForm: () => { return unref(formRef) as FormActionType; }, + setShowPagination: async (show: boolean) => { + getTableInstance().setShowPagination(show); + }, + getShowPagination: () => { + return getTableInstance().getShowPagination(); + }, }; return [register, methods]; diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index ef7c7b93075..99dbaf77ee6 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -102,6 +102,8 @@ export interface TableActionType { getCacheColumns: () => BasicColumn[]; emit?: EmitType; updateTableData: (index: number, key: string, value: any) => Recordable; + setShowPagination: (show: boolean) => Promise; + getShowPagination: () => boolean; } export interface FetchSetting {