Commit ac5e1408 authored by pengxianhe's avatar pengxianhe

去掉机构管理分页

parent ea45b1cd
......@@ -34,7 +34,7 @@
</ArtTableHeader>
<ElTable
:data="pagedTreeData"
:data="filteredTree"
row-key="id"
border
default-expand-all
......@@ -137,19 +137,6 @@
</ElTableColumn>
</ElTable>
<!-- 分页 -->
<div class="pagination-wrapper">
<ElPagination
v-model:current-page="pagination.current"
v-model:page-size="pagination.size"
:total="pagination.total"
:page-sizes="[10, 20, 30, 50, 100]"
:background="true"
layout="total, prev, pager, next, sizes, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</ElCard>
<ElDialog
......@@ -572,45 +559,7 @@ const statsCards = computed(() => [
}
])
// 分页状态
const pagination = ref({
current: 1,
size: 20,
total: 0
})
// 分页后的树形数据(仅在表格展示层处理分页,不修改原始树结构)
const pagedTreeData = computed(() => {
const allData = flattenInstitutions(filteredTree.value)
pagination.value.total = allData.length
const start = (pagination.value.current - 1) * pagination.value.size
const end = start + pagination.value.size
const pagedIds = new Set(allData.slice(start, end).map((item) => item.id))
// 递归保留命中的节点及其祖先节点
const filterTree = (nodes: InstitutionItem[]): InstitutionItem[] => {
return nodes
.map((node) => {
const children = node.children ? filterTree(node.children) : []
const selfMatched = pagedIds.has(node.id)
if (selfMatched || children.length) {
return { ...node, children: children.length ? children : undefined }
}
return null
})
.filter(Boolean) as InstitutionItem[]
}
return filterTree(institutionTree.value)
})
function handleSizeChange() {
pagination.value.current = 1
}
function handleCurrentChange() {
// 页码变化后由 computed 自动处理
}
function flattenInstitutions(list: InstitutionItem[]): InstitutionItem[] {
return list.flatMap((item) => [item, ...(item.children ? flattenInstitutions(item.children) : [])])
......@@ -720,7 +669,6 @@ function handleReset() {
}
function handleRefresh() {
pagination.value.current = 1
ElMessage.success('机构列表已刷新')
}
......@@ -1002,11 +950,7 @@ function formatNow() {
}
}
.pagination-wrapper {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
.default-password-tip {
display: flex;
......
......@@ -280,7 +280,7 @@
// @ts-nocheck
import { ElMessage } from 'element-plus'
import ArtStatsCard from '@/components/core/cards/art-stats-card/index.vue'
import ArtButtonTable from '@/components/core/tables/art-button-table/index.vue'
import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue'
defineOptions({ name: 'Order' })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment