fix(supply-chain): 将前置仓下单表调整为进销存子页面
This commit is contained in:
parent
ea76449f3c
commit
58d217cbc9
@ -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(<SupplyChainSidebar visibleTargetKeys={['frontWarehouseInventory']} />)
|
||||
|
||||
expect(
|
||||
screen.getByRole('link', { name: '前置仓下单表' }),
|
||||
).toHaveAttribute('aria-current', 'page')
|
||||
expect(screen.queryByRole('link', { name: '前置仓下单表' })).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@ -113,7 +113,6 @@ export const SUPPLY_CHAIN_ROUTE_TITLES: Record<string, string> = {
|
||||
'/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': '用户权限',
|
||||
|
||||
@ -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('前置仓下单表')
|
||||
})
|
||||
})
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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 (
|
||||
<main className={styles.page}>
|
||||
<nav className={styles.subpageTabs} aria-label="前置仓进销存管理子页面">
|
||||
<Link
|
||||
href="/supply-chain/management/front-warehouse-inventory"
|
||||
className={orderMode ? undefined : styles.subpageTabActive}
|
||||
aria-current={orderMode ? undefined : 'page'}
|
||||
>
|
||||
前置仓进销存
|
||||
</Link>
|
||||
<Link
|
||||
href="/supply-chain/management/front-warehouse-inventory?tab=order"
|
||||
className={orderMode ? styles.subpageTabActive : undefined}
|
||||
aria-current={orderMode ? 'page' : undefined}
|
||||
>
|
||||
前置仓下单表
|
||||
</Link>
|
||||
</nav>
|
||||
<header className={styles.header}>
|
||||
<div>
|
||||
<h1>{orderMode ? '前置仓下单表' : '前置仓进销存管理'}</h1>
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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 (
|
||||
<FrontWarehouseInventoryView
|
||||
key={orderMode ? 'order' : 'inventory'}
|
||||
initialData={initialData}
|
||||
canEdit={access.edit}
|
||||
canDownload={access.download}
|
||||
mode={orderMode ? 'order' : 'inventory'}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -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 (
|
||||
<FrontWarehouseInventoryView
|
||||
initialData={initialData}
|
||||
canEdit={access.edit}
|
||||
canDownload={access.download}
|
||||
mode="order"
|
||||
/>
|
||||
)
|
||||
export default function FrontWarehouseOrderPage() {
|
||||
redirect('/supply-chain/management/front-warehouse-inventory?tab=order')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user