diff --git a/src/views/infra/apiAccessLog/index.vue b/src/views/infra/apiAccessLog/index.vue index c0935e2c..9c1e047d 100644 --- a/src/views/infra/apiAccessLog/index.vue +++ b/src/views/infra/apiAccessLog/index.vue @@ -89,7 +89,7 @@ - + @@ -159,6 +159,18 @@ const message = useMessage() // 消息弹窗 const loading = ref(true) // 列表的加载中 const total = ref(0) // 列表的总页数 const list = ref([]) // 列表的数据 +const tableRef = ref() +const planTableMaxHeight = ref(520) +const planPaginationRef = ref() + +const updatePlanTableMaxHeight = async () => { + await nextTick() + const tableTop = tableRef.value?.$el?.getBoundingClientRect().top ?? 0 + const paginationHeight = planPaginationRef.value?.getBoundingClientRect().height ?? 72 + const pageBottomGap = 56 + const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap + planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight))) +} const queryParams = reactive({ pageNo: 1, pageSize: 10, @@ -182,6 +194,7 @@ const getList = async () => { total.value = data.total } finally { loading.value = false + updatePlanTableMaxHeight() } } @@ -221,5 +234,11 @@ const handleExport = async () => { /** 初始化 **/ onMounted(() => { getList() + updatePlanTableMaxHeight() + window.addEventListener("resize", updatePlanTableMaxHeight) +}) + +onBeforeUnmount(() => { + window.removeEventListener("resize", updatePlanTableMaxHeight) }) diff --git a/src/views/infra/apiErrorLog/index.vue b/src/views/infra/apiErrorLog/index.vue index 37a9da38..9cb4269e 100644 --- a/src/views/infra/apiErrorLog/index.vue +++ b/src/views/infra/apiErrorLog/index.vue @@ -86,7 +86,7 @@ - + @@ -172,6 +172,18 @@ const message = useMessage() // 消息弹窗 const loading = ref(true) // 列表的加载中 const total = ref(0) // 列表的总页数 const list = ref([]) // 列表的数据 +const tableRef = ref() +const planTableMaxHeight = ref(520) +const planPaginationRef = ref() + +const updatePlanTableMaxHeight = async () => { + await nextTick() + const tableTop = tableRef.value?.$el?.getBoundingClientRect().top ?? 0 + const paginationHeight = planPaginationRef.value?.getBoundingClientRect().height ?? 72 + const pageBottomGap = 56 + const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap + planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight))) +} const queryParams = reactive({ pageNo: 1, pageSize: 10, @@ -194,6 +206,7 @@ const getList = async () => { total.value = data.total } finally { loading.value = false + updatePlanTableMaxHeight() } } @@ -247,5 +260,11 @@ const handleExport = async () => { /** 初始化 **/ onMounted(() => { getList() + updatePlanTableMaxHeight() + window.addEventListener("resize", updatePlanTableMaxHeight) +}) + +onBeforeUnmount(() => { + window.removeEventListener("resize", updatePlanTableMaxHeight) }) diff --git a/src/views/infra/codegen/index.vue b/src/views/infra/codegen/index.vue index 1e4d3d2a..176a370d 100644 --- a/src/views/infra/codegen/index.vue +++ b/src/views/infra/codegen/index.vue @@ -56,7 +56,7 @@ - +