fix: 修复分页组件传值问题及面包屑导航更新

This commit is contained in:
2026-05-20 14:05:18 +08:00
parent 567b9d0519
commit 5f739fae13
9 changed files with 82 additions and 44 deletions

View File

@ -80,34 +80,16 @@ const pageSize = computed({
set: (val: number) => emit('update:pageSizeValue', val), set: (val: number) => emit('update:pageSizeValue', val),
}) })
// //
watch(
() => currentPage,
(newVal) => {
emit('update:modelValue', newVal)
emit('pagination-change', { currentPage: newVal, pageSize })
},
)
//
watch(
() => pageSize,
(newVal) => {
emit('update:pageSizeValue', newVal)
emit('pagination-change', { currentPage, pageSize: newVal })
},
)
// Element Plus
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {
emit('update:pageSizeValue', val) emit('update:pageSizeValue', val)
emit('pagination-change', { currentPage, pageSize: val }) emit('pagination-change', { currentPage: currentPage.value, pageSize: val })
} }
// Element Plus //
const handleCurrentChange = (val: number) => { const handleCurrentChange = (val: number) => {
emit('update:modelValue', val) emit('update:modelValue', val)
emit('pagination-change', { currentPage: val, pageSize }) emit('pagination-change', { currentPage: val, pageSize: pageSize.value })
} }
</script> </script>

View File

@ -13,17 +13,68 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useTabsStore } from '@/stores/modules/tabs' import { useUserStore } from '@/stores/modules/user'
import type { BreadcrumbItem } from '@/stores/modules/tabs'
interface BreadcrumbItem { const route = useRoute()
title: string const userStore = useUserStore()
path: string
//
const breadcrumbList = computed<BreadcrumbItem[]>(() => {
const path = route.path
const list: BreadcrumbItem[] = []
//
if (path === '/dashboard') {
list.push({ title: '首页', path: '/dashboard' })
return list
} }
const tabsStore = useTabsStore() //
const findMenuPath = (menus: any[], targetPath: string, parentMenu: any = null): any => {
for (const menu of menus) {
const menuPath = menu.path || menu.api || `/menu-${menu.id}`
// tabs store if (menuPath === targetPath) {
const breadcrumbList = computed<BreadcrumbItem[]>(() => tabsStore.currentBreadcrumbs) return { current: menu, parent: parentMenu }
}
const subMenus = menu.children || menu.son
if (subMenus && subMenus.length > 0) {
const result = findMenuPath(subMenus, targetPath, menu)
if (result) return result
}
}
return null
}
const menuResult = findMenuPath(userStore.sideMenu, path)
if (menuResult) {
const { current, parent } = menuResult
if (parent) {
const firstChildMenus = parent.children || parent.son
const firstChildPath = firstChildMenus && firstChildMenus.length > 0
? (firstChildMenus[0].path || firstChildMenus[0].api || `/menu-${firstChildMenus[0].id}`)
: parent.path || parent.api || `/menu-${parent.id}`
list.push({ title: parent.label, path: firstChildPath })
}
list.push({
title: current.label,
path: current.path || current.api || `/menu-${current.id}`
})
}
//
if (list.length === 0) {
list.push({ title: '首页', path: '/dashboard' })
}
return list
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -46,7 +46,7 @@
</button> </button>
<!-- 当前页面下拉菜单 --> <!-- 当前页面下拉菜单 -->
<el-dropdown trigger="click" @command="handleDropdownCommand" placement="bottom-end" ref="pageDropdownRef"> <!-- <el-dropdown trigger="click" @command="handleDropdownCommand" placement="bottom-end" ref="pageDropdownRef">
<button class="current-page-btn" @click.stop="togglePageDropdown"> <button class="current-page-btn" @click.stop="togglePageDropdown">
<el-icon><MoreFilled /></el-icon> <el-icon><MoreFilled /></el-icon>
</button> </button>
@ -70,7 +70,7 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown> -->
<!-- 右键菜单 --> <!-- 右键菜单 -->
<teleport to="body"> <teleport to="body">
@ -448,7 +448,7 @@ const closeContextMenu = () => {
} }
&.scroll-btn-right { &.scroll-btn-right {
right: 66px; right: 6px;
} }
} }

View File

@ -485,8 +485,9 @@ const handleGetSubList = async (row: any) => {
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = (page: { currentPage: number; size: number }) => { const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage currentPage.value = page.currentPage
pageSize.value = page.pageSize
getCustomerList(userId.value) getCustomerList(userId.value)
} }

View File

@ -120,8 +120,8 @@ const handleReset = () => {
searchForm.value = { searchForm.value = {
username: '', username: '',
subAccountId: '', subAccountId: '',
startTime: '', startTime: initTime.start,
endTime: '', endTime: initTime.end,
} }
getFundDetailList() getFundDetailList()
} }

View File

@ -12,12 +12,12 @@
<el-button type="primary" size="small" @click.stop="handleWithdraw(row)">取款</el-button> <el-button type="primary" size="small" @click.stop="handleWithdraw(row)">取款</el-button>
</template> </template>
</Table> </Table>
<Pagination <!-- <Pagination
v-model:page="queryParams.page" v-model="queryParams.page"
v-model:limit="queryParams.limit" v-model:pageSizeValue="queryParams.limit"
:total="total" :total="total"
@pagination="getList" @pagination-change="getList"
/> /> -->
<WithdrawDialog <WithdrawDialog
:visible="withdrawDialogVisible" :visible="withdrawDialogVisible"
:channel-id="currentChannelId" :channel-id="currentChannelId"

View File

@ -168,8 +168,9 @@ const handleReset = () => {
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = (page: { currentPage: number, size: number }) => { const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage currentPage.value = page.currentPage
pageSize.value = page.pageSize
getCustomerTradeOrderList() getCustomerTradeOrderList()
} }
</script> </script>

View File

@ -144,7 +144,9 @@ const handleExport = async () => {
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = async () => { const handlePaginationChange = async (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
getTransferDetailList() getTransferDetailList()
} }
</script> </script>

View File

@ -428,8 +428,9 @@ const handleGetSubList = async (row: any) => {
/** /**
* @description: 定义分页方法 * @description: 定义分页方法
*/ */
const handlePaginationChange = (page: { currentPage: number; size: number }) => { const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage currentPage.value = page.currentPage
pageSize.value = page.pageSize
getCustomerList() getCustomerList()
} }