diff --git a/furniture-3d-system/src/app/supply-chain/components/SupplyChainSidebar.test.tsx b/furniture-3d-system/src/app/supply-chain/components/SupplyChainSidebar.test.tsx index 252778ea..5e3f82b0 100644 --- a/furniture-3d-system/src/app/supply-chain/components/SupplyChainSidebar.test.tsx +++ b/furniture-3d-system/src/app/supply-chain/components/SupplyChainSidebar.test.tsx @@ -99,20 +99,6 @@ describe('SupplyChainSidebar', () => { expect( screen.getByRole('link', { name: '前置仓进销存管理' }), ).toHaveAttribute('aria-current', 'page') - expect( - screen.getByRole('link', { name: '前置仓下单表' }), - ).toBeInTheDocument() - }) - - it('shows the front warehouse order table with the same inventory permission', () => { - usePathnameMock.mockReturnValue( - '/supply-chain/management/front-warehouse-order', - ) - - render() - - expect( - screen.getByRole('link', { name: '前置仓下单表' }), - ).toHaveAttribute('aria-current', 'page') + expect(screen.queryByRole('link', { name: '前置仓下单表' })).not.toBeInTheDocument() }) }) diff --git a/furniture-3d-system/src/app/supply-chain/components/supply-chain-tabs.tsx b/furniture-3d-system/src/app/supply-chain/components/supply-chain-tabs.tsx index 32bfe247..53b0ded1 100644 --- a/furniture-3d-system/src/app/supply-chain/components/supply-chain-tabs.tsx +++ b/furniture-3d-system/src/app/supply-chain/components/supply-chain-tabs.tsx @@ -113,7 +113,6 @@ export const SUPPLY_CHAIN_ROUTE_TITLES: Record = { '/supply-chain/management/logistics-arrival-signing-duration': '物流到货签收时长看板', '/supply-chain/management/production-stop-demands': '停产需求管理', '/supply-chain/management/front-warehouse-inventory': '前置仓进销存管理', - '/supply-chain/management/front-warehouse-order': '前置仓下单表', '/supply-chain/script-monitor': '脚本监控', '/supply-chain/operation-logs': '操作日志', '/supply-chain/user-permissions': '用户权限', diff --git a/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.test.ts b/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.test.ts index 72ec5701..ffc4f16c 100644 --- a/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.test.ts +++ b/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.test.ts @@ -168,11 +168,9 @@ describe('supply chain menu', () => { label: '前置仓进销存管理', module: '经营管理', route: '/supply-chain/management/front-warehouse-inventory', - }), expect.objectContaining({ - label: '前置仓下单表', - module: '经营管理', - route: '/supply-chain/management/front-warehouse-order', })]), ) + expect(flattenSupplyChainMenu(filterSupplyChainMenu(['frontWarehouseInventory'])) + .map((item) => item.label)).not.toContain('前置仓下单表') }) }) diff --git a/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.ts b/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.ts index d131478d..abd3b361 100644 --- a/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.ts +++ b/furniture-3d-system/src/app/supply-chain/config/supply-chain-menu.ts @@ -122,11 +122,6 @@ export const SUPPLY_CHAIN_MENU: SupplyChainMenuModule[] = [ route: '/supply-chain/management/front-warehouse-inventory', targetKey: 'frontWarehouseInventory', }, - { - label: '前置仓下单表', - route: '/supply-chain/management/front-warehouse-order', - targetKey: 'frontWarehouseInventory', - }, ...MANAGEMENT_BLANK_PAGES.map((page) => ({ label: page.label, route: page.route, diff --git a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.test.tsx b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.test.tsx index c15ed68d..d8de649d 100644 --- a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.test.tsx +++ b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.test.tsx @@ -66,6 +66,11 @@ describe('FrontWarehouseInventoryView', () => { expect(screen.getByRole('button', { name: '重置' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '导出' })).toBeInTheDocument() expect(screen.getByRole('button', { name: '推送到下单表' })).toBeInTheDocument() + const subpageTabs = screen.getByRole('navigation', { name: '前置仓进销存管理子页面' }) + expect(within(subpageTabs).getByRole('link', { name: '前置仓进销存' })) + .toHaveAttribute('aria-current', 'page') + expect(within(subpageTabs).getByRole('link', { name: '前置仓下单表' })) + .toHaveAttribute('href', '/supply-chain/management/front-warehouse-inventory?tab=order') fireEvent.click(screen.getByRole('button', { name: /导入/ })) expect(screen.getByRole('menuitem', { name: '采购模板' })).toBeInTheDocument() expect(screen.getByRole('menuitem', { name: '承运模板' })).toBeInTheDocument() @@ -250,6 +255,8 @@ describe('FrontWarehouseInventoryView', () => { expect(screen.getByRole('heading', { name: '前置仓下单表' })).toBeInTheDocument() expect(screen.queryByRole('button', { name: '推送到下单表' })).not.toBeInTheDocument() expect(screen.getByText(/推送 10\/24 11:00/)).toBeInTheDocument() + expect(screen.getByRole('link', { name: '前置仓下单表' })) + .toHaveAttribute('aria-current', 'page') fireEvent.click(screen.getByRole('button', { name: '刷新数据' })) await waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(1)) diff --git a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.tsx b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.tsx index 059fb002..ba605beb 100644 --- a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.tsx +++ b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/FrontWarehouseInventoryView.tsx @@ -1,6 +1,7 @@ 'use client' import { ChevronLeft, ChevronRight, RefreshCw, Send } from 'lucide-react' +import Link from 'next/link' import type { FrontWarehouseInventoryPage } from '@/lib/front-warehouse-inventory' import { FrontWarehouseBatchToolbar } from './FrontWarehouseBatchToolbar' import { FrontWarehouseImportReport } from './FrontWarehouseImportReport' @@ -30,6 +31,22 @@ export function FrontWarehouseInventoryView({ return (
+

{orderMode ? '前置仓下单表' : '前置仓进销存管理'}

diff --git a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/front-warehouse-inventory.module.css b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/front-warehouse-inventory.module.css index 0c396bff..b52c8feb 100644 --- a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/front-warehouse-inventory.module.css +++ b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/front-warehouse-inventory.module.css @@ -16,6 +16,44 @@ flex-shrink: 0; } +.subpageTabs { + display: flex; + min-height: 36px; + flex: 0 0 auto; + align-items: flex-end; + gap: 4px; + overflow-x: auto; + border-bottom: 1px solid var(--sc-border); +} + +.subpageTabs a { + display: inline-flex; + height: 34px; + flex: none; + align-items: center; + box-sizing: border-box; + border: 1px solid transparent; + border-bottom: 0; + border-radius: 7px 7px 0 0; + padding: 0 15px; + color: #71717a; + font-size: 12px; + font-weight: 500; + text-decoration: none; +} + +.subpageTabs a:hover { + background: #f8fafc; + color: #3f3f46; +} + +.subpageTabs .subpageTabActive { + border-color: var(--sc-border); + background: #fff; + color: #18181b; + font-weight: 600; +} + .header { display: flex; min-height: 52px; @@ -1005,6 +1043,12 @@ tbody .stickyColumn { flex-direction: column; } + .subpageTabs { + margin-right: calc(var(--wb-panel-inset, 12px) * -1); + margin-left: calc(var(--wb-panel-inset, 12px) * -1); + padding: 0 var(--wb-panel-inset, 12px); + } + .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } diff --git a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/page.tsx b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/page.tsx index e62c9597..08ab1a51 100644 --- a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/page.tsx +++ b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-inventory/page.tsx @@ -1,6 +1,7 @@ import { redirect } from 'next/navigation' import { isFrontWarehousePurchaser } from '@/lib/front-warehouse-inventory' import { requireSession } from '@/lib/server-session' +import { frontWarehouseOrderService } from '@/server/services/front-warehouse-order.service' import { supplyChainPermissionSettingsService } from '@/server/services/supply-chain-permission-settings.service' import { frontWarehouseInventoryService } from '@/server/services/front-warehouse-inventory.service' import { FrontWarehouseInventoryView } from './FrontWarehouseInventoryView' @@ -8,7 +9,11 @@ import { FrontWarehouseInventoryView } from './FrontWarehouseInventoryView' export const metadata = { title: '前置仓进销存管理 · 供应链中心' } export const dynamic = 'force-dynamic' -export default async function FrontWarehouseInventoryPage() { +export default async function FrontWarehouseInventoryPage({ + searchParams, +}: { + searchParams: Promise<{ tab?: string | string[] }> +}) { const { authUser } = await requireSession('/login') const access = await supplyChainPermissionSettingsService.getUserAccess( authUser, @@ -17,7 +22,9 @@ export default async function FrontWarehouseInventoryPage() { if (!access.view) redirect('/supply-chain') const purchaserOnly = isFrontWarehousePurchaser(authUser) - const initialData = await frontWarehouseInventoryService.getPage({ + const tab = (await searchParams).tab + const orderMode = tab === 'order' + const query = { page: 1, pageSize: 100, sku: '', @@ -27,12 +34,23 @@ export default async function FrontWarehouseInventoryPage() { purchaseOwner: '', purchaseType: [], qualifies: ['yes'], - }, { purchaserOnly }) + } + const initialData = orderMode + ? await frontWarehouseOrderService.getPage( + { ...query, qualifies: ['yes'], refresh: false }, + { purchaserOnly }, + ) + : await frontWarehouseInventoryService.getPage( + { ...query, qualifies: ['yes'] }, + { purchaserOnly }, + ) return ( ) } diff --git a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-order/page.tsx b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-order/page.tsx index 1bab90de..d5905505 100644 --- a/furniture-3d-system/src/app/supply-chain/management/front-warehouse-order/page.tsx +++ b/furniture-3d-system/src/app/supply-chain/management/front-warehouse-order/page.tsx @@ -1,40 +1,5 @@ import { redirect } from 'next/navigation' -import { isFrontWarehousePurchaser } from '@/lib/front-warehouse-inventory' -import { requireSession } from '@/lib/server-session' -import { frontWarehouseOrderService } from '@/server/services/front-warehouse-order.service' -import { supplyChainPermissionSettingsService } from '@/server/services/supply-chain-permission-settings.service' -import { FrontWarehouseInventoryView } from '../front-warehouse-inventory/FrontWarehouseInventoryView' -export const metadata = { title: '前置仓下单表 · 供应链中心' } -export const dynamic = 'force-dynamic' - -export default async function FrontWarehouseOrderPage() { - const { authUser } = await requireSession('/login') - const access = await supplyChainPermissionSettingsService.getUserAccess( - authUser, - 'frontWarehouseInventory', - ) - if (!access.view) redirect('/supply-chain') - - const initialData = await frontWarehouseOrderService.getPage({ - page: 1, - pageSize: 100, - sku: '', - barcode: '', - supplier: '', - rating: [], - purchaseOwner: '', - purchaseType: [], - qualifies: ['yes'], - refresh: false, - }, { purchaserOnly: isFrontWarehousePurchaser(authUser) }) - - return ( - - ) +export default function FrontWarehouseOrderPage() { + redirect('/supply-chain/management/front-warehouse-inventory?tab=order') }