fix: 修复分页组件传值问题及面包屑导航更新
This commit is contained in:
parent
567b9d0519
commit
5f739fae13
|
|
@ -80,34 +80,16 @@ const pageSize = computed({
|
|||
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) => {
|
||||
emit('update:pageSizeValue', val)
|
||||
emit('pagination-change', { currentPage, pageSize: val })
|
||||
emit('pagination-change', { currentPage: currentPage.value, pageSize: val })
|
||||
}
|
||||
|
||||
// 当前页变更处理(兼容Element Plus原生事件)
|
||||
// 当前页变更处理
|
||||
const handleCurrentChange = (val: number) => {
|
||||
emit('update:modelValue', val)
|
||||
emit('pagination-change', { currentPage: val, pageSize })
|
||||
emit('pagination-change', { currentPage: val, pageSize: pageSize.value })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,68 @@
|
|||
</template>
|
||||
|
||||
<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 {
|
||||
title: string
|
||||
path: string
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 监听路由变化,直接计算面包屑
|
||||
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 获取当前激活标签页的面包屑
|
||||
const breadcrumbList = computed<BreadcrumbItem[]>(() => tabsStore.currentBreadcrumbs)
|
||||
if (menuPath === targetPath) {
|
||||
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>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
</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">
|
||||
<el-icon><MoreFilled /></el-icon>
|
||||
</button>
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-dropdown> -->
|
||||
|
||||
<!-- 右键菜单 -->
|
||||
<teleport to="body">
|
||||
|
|
@ -448,7 +448,7 @@ const closeContextMenu = () => {
|
|||
}
|
||||
|
||||
&.scroll-btn-right {
|
||||
right: 66px;
|
||||
right: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -485,8 +485,9 @@ const handleGetSubList = async (row: any) => {
|
|||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = (page: { currentPage: number; size: number }) => {
|
||||
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
|
||||
currentPage.value = page.currentPage
|
||||
pageSize.value = page.pageSize
|
||||
getCustomerList(userId.value)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ const handleReset = () => {
|
|||
searchForm.value = {
|
||||
username: '',
|
||||
subAccountId: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
startTime: initTime.start,
|
||||
endTime: initTime.end,
|
||||
}
|
||||
getFundDetailList()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
<el-button type="primary" size="small" @click.stop="handleWithdraw(row)">取款</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
<Pagination
|
||||
v-model:page="queryParams.page"
|
||||
v-model:limit="queryParams.limit"
|
||||
<!-- <Pagination
|
||||
v-model="queryParams.page"
|
||||
v-model:pageSizeValue="queryParams.limit"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
@pagination-change="getList"
|
||||
/> -->
|
||||
<WithdrawDialog
|
||||
:visible="withdrawDialogVisible"
|
||||
:channel-id="currentChannelId"
|
||||
|
|
|
|||
|
|
@ -168,8 +168,9 @@ const handleReset = () => {
|
|||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = (page: { currentPage: number, size: number }) => {
|
||||
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
|
||||
currentPage.value = page.currentPage
|
||||
pageSize.value = page.pageSize
|
||||
getCustomerTradeOrderList()
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -144,7 +144,9 @@ const handleExport = async () => {
|
|||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = async () => {
|
||||
const handlePaginationChange = async (page: { currentPage: number; pageSize: number }) => {
|
||||
currentPage.value = page.currentPage
|
||||
pageSize.value = page.pageSize
|
||||
getTransferDetailList()
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -428,8 +428,9 @@ const handleGetSubList = async (row: any) => {
|
|||
/**
|
||||
* @description: 定义分页方法
|
||||
*/
|
||||
const handlePaginationChange = (page: { currentPage: number; size: number }) => {
|
||||
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
|
||||
currentPage.value = page.currentPage
|
||||
pageSize.value = page.pageSize
|
||||
getCustomerList()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue