diff --git a/package.json b/package.json index f29f8fd..6cfc1e6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue": "^3.5.29", "vue-i18n": "^11.4.2", "vue-router": "^5.0.3", + "vuedraggable": "^4.1.0", "xlsx": "^0.18.5" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 72d8224..71ab7f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,6 +65,9 @@ importers: vue-router: specifier: ^5.0.3 version: 5.0.3(@vue/compiler-sfc@3.5.29)(pinia@3.0.4(typescript@5.9.3)(vue@3.5.29(typescript@5.9.3)))(vue@3.5.29(typescript@5.9.3)) + vuedraggable: + specifier: ^4.1.0 + version: 4.1.0(vue@3.5.29(typescript@5.9.3)) xlsx: specifier: ^0.18.5 version: 0.18.5 @@ -2398,6 +2401,9 @@ packages: resolution: {integrity: sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + sortablejs@1.14.0: + resolution: {integrity: sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==} + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -2666,6 +2672,11 @@ packages: typescript: optional: true + vuedraggable@4.1.0: + resolution: {integrity: sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==} + peerDependencies: + vue: ^3.0.1 + webpack-virtual-modules@0.6.2: resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==} @@ -4957,6 +4968,8 @@ snapshots: ip-address: 10.2.0 smart-buffer: 4.2.0 + sortablejs@1.14.0: {} + source-map-js@1.2.1: {} speakingurl@14.0.1: {} @@ -5243,6 +5256,11 @@ snapshots: optionalDependencies: typescript: 5.9.3 + vuedraggable@4.1.0(vue@3.5.29(typescript@5.9.3)): + dependencies: + sortablejs: 1.14.0 + vue: 3.5.29(typescript@5.9.3) + webpack-virtual-modules@0.6.2: {} which-module@2.0.1: {} diff --git a/src/components/common/Pagination.vue b/src/components/common/Pagination.vue index f03bf38..147df07 100644 --- a/src/components/common/Pagination.vue +++ b/src/components/common/Pagination.vue @@ -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 }) } diff --git a/src/components/layout/Breadcrumb.vue b/src/components/layout/Breadcrumb.vue index 2b37086..60f1cd7 100644 --- a/src/components/layout/Breadcrumb.vue +++ b/src/components/layout/Breadcrumb.vue @@ -13,31 +13,83 @@ diff --git a/src/stores/modules/tabs.ts b/src/stores/modules/tabs.ts index d00b28c..e1395cf 100644 --- a/src/stores/modules/tabs.ts +++ b/src/stores/modules/tabs.ts @@ -41,35 +41,35 @@ export const useTabsStore = defineStore('tabs', () => { /** * 从菜单中查找当前路由的面包屑路径 + * 逻辑: + * - 第一个永远是一级菜单的名字 + * - 点击一级菜单会跳转到第一个二级菜单 */ const findBreadcrumbPath = (path: string): BreadcrumbItem[] => { const list: BreadcrumbItem[] = [] - // 添加首页 - list.push({ - title: '首页', - path: '/dashboard' - }) - - // 如果是首页,直接返回 + // 如果是首页,直接返回首页 if (path === '/dashboard') { + list.push({ + title: '首页', + path: '/dashboard' + }) return list } // 从菜单中查找当前路由的层级信息 - const findMenuPath = (menus: any[], targetPath: string, currentPath: any[] = []): any[] | null => { + const findMenuPath = (menus: any[], targetPath: string, parentMenu: any = null): any => { for (const menu of menus) { const menuPath = menu.path || menu.api || `/menu-${menu.id}` - const newPath = [...currentPath, menu] if (menuPath === targetPath) { - return newPath + return { current: menu, parent: parentMenu } } // 兼容 children 和 son 两种子菜单字段名 const subMenus = menu.children || menu.son if (subMenus && subMenus.length > 0) { - const result = findMenuPath(subMenus, targetPath, newPath) + const result = findMenuPath(subMenus, targetPath, menu) if (result) { return result } @@ -78,23 +78,41 @@ export const useTabsStore = defineStore('tabs', () => { return null } - const menuPath = findMenuPath(userStore.sideMenu, path) - console.log('menuPath:', menuPath); + const menuResult = findMenuPath(userStore.sideMenu, path) - if (menuPath) { - console.log('list:', menuPath) - menuPath.forEach((menu: any, index: number) => { - // 跳过第一个(首页已添加) - if (index === 0 && menu.label === '首页') { - return - } + 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: menu.label, - path: menu.path || menu.api || `/menu-${menu.id}` + 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 } @@ -104,7 +122,6 @@ export const useTabsStore = defineStore('tabs', () => { const existIndex = tabs.value.findIndex(item => item.path === tab.path) // 计算面包屑路径 const breadcrumbs = findBreadcrumbPath(tab.path) - console.log('aaaaaaaaaaaaa:', breadcrumbs); if (existIndex === -1) { // 新标签页,添加到列表 diff --git a/src/views/agent/user/index.vue b/src/views/agent/user/index.vue index 8a55d31..b2617f5 100644 --- a/src/views/agent/user/index.vue +++ b/src/views/agent/user/index.vue @@ -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) } diff --git a/src/views/capital/fundFlow/index.vue b/src/views/capital/fundFlow/index.vue index 6fe80b4..8b9d705 100644 --- a/src/views/capital/fundFlow/index.vue +++ b/src/views/capital/fundFlow/index.vue @@ -120,8 +120,8 @@ const handleReset = () => { searchForm.value = { username: '', subAccountId: '', - startTime: '', - endTime: '', + startTime: initTime.start, + endTime: initTime.end, } getFundDetailList() } diff --git a/src/views/capital/withdraw/index.vue b/src/views/capital/withdraw/index.vue index ed1b0da..d4dd634 100644 --- a/src/views/capital/withdraw/index.vue +++ b/src/views/capital/withdraw/index.vue @@ -12,12 +12,12 @@ 取款 - + @pagination-change="getList" + /> --> { /** * @description: 定义分页方法 */ -const handlePaginationChange = (page: { currentPage: number, size: number }) => { +const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => { currentPage.value = page.currentPage + pageSize.value = page.pageSize getCustomerTradeOrderList() } diff --git a/src/views/order/transfer/index.vue b/src/views/order/transfer/index.vue index 47c0dfc..123ba45 100644 --- a/src/views/order/transfer/index.vue +++ b/src/views/order/transfer/index.vue @@ -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() } diff --git a/src/views/profile/agent/index.vue b/src/views/profile/agent/index.vue index e998f3f..c224a6c 100644 --- a/src/views/profile/agent/index.vue +++ b/src/views/profile/agent/index.vue @@ -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() }