diff --git a/src/components/RePureTableBar/src/bar.tsx b/src/components/RePureTableBar/src/bar.tsx index 30aa6d3b2..092f42759 100644 --- a/src/components/RePureTableBar/src/bar.tsx +++ b/src/components/RePureTableBar/src/bar.tsx @@ -1,6 +1,12 @@ import { useEpThemeStoreHook } from "@/store/modules/epTheme"; -import { delay, getKeyList, cloneDeep } from "@pureadmin/utils"; import { defineComponent, ref, computed, type PropType, nextTick } from "vue"; +import { + delay, + cloneDeep, + isBoolean, + isFunction, + getKeyList +} from "@pureadmin/utils"; import Sortable from "sortablejs"; import DragIcon from "./svg/drag.svg?component"; @@ -37,8 +43,13 @@ export default defineComponent({ const loading = ref(false); const checkAll = ref(true); const isIndeterminate = ref(false); + const filterColumns = cloneDeep(props?.columns).filter(column => + isBoolean(column?.hide) + ? !column.hide + : !(isFunction(column?.hide) && column?.hide()) + ); let checkColumnList = getKeyList(cloneDeep(props?.columns), "label"); - const checkedColumns = ref(checkColumnList); + const checkedColumns = ref(getKeyList(cloneDeep(filterColumns), "label")); const dynamicColumns = ref(cloneDeep(props?.columns)); const getDropdownItemStyle = computed(() => { @@ -120,7 +131,7 @@ export default defineComponent({ dynamicColumns.value = cloneDeep(props?.columns); checkColumnList = []; checkColumnList = await getKeyList(cloneDeep(props?.columns), "label"); - checkedColumns.value = checkColumnList; + checkedColumns.value = getKeyList(cloneDeep(filterColumns), "label"); } const dropdown = {