fix(pl): 将统计展开内容约束到表格可视宽度并保持左对齐。

This commit is contained in:
wuzilong committed 2026-11-01 22:28:36 +08:00
1 parent b1a50b58e3
commit bd90d2099f
2 files changed
+44 -2

No files matched your search

@@ -67,7 +67,11 @@
>
<el-table-column type="expand"
><template #default="{ row }">
<div v-loading="details[row.id]?.loading" class="view-section">
<div
v-loading="details[row.id]?.loading"
class="view-section statistics-expansion"
:style="expansionStyle"
>
<el-alert
v-if="details[row.id]?.error"
title="详情加载失败"
@@ -138,6 +142,7 @@
</section>
</template>
<script setup lang="ts">
import { useElementSize } from '@vueuse/core'
import { Edit, Refresh, RefreshLeft } from '@element-plus/icons-vue'
import { fetchGetMenuCodes } from '@/api/auth'
import { useUserStore } from '@/store/modules/user'
@@ -345,6 +350,10 @@
const tableWrapRef = ref<HTMLElement | null>(null),
pagerRef = ref<HTMLElement | null>(null),
tableRef = ref()
const { width: tableViewportWidth } = useElementSize(tableWrapRef)
const expansionStyle = computed(() => ({
width: tableViewportWidth.value > 0 ? `${tableViewportWidth.value}px` : undefined
}))
const { tableHeight } = useListTableViewportHeight({
tableEl: tableWrapRef,
pagerEl: pagerRef,
@@ -352,3 +361,12 @@
enabled: computed(() => !props.embedded)
})
</script>
<style scoped>
.statistics-expansion {
box-sizing: border-box;
max-width: 100%;
padding: 16px;
text-align: left;
}
</style>