feat(supply-chain): 下线快递维护前端入口
This commit is contained in:
parent
d313e81dd2
commit
bdfdbe14bd
@ -121,6 +121,5 @@ export const SUPPLY_CHAIN_ROUTE_TITLES: Record<string, string> = {
|
||||
'/supply-chain/management/owner-config': '人员信息',
|
||||
'/supply-chain/management/custom-table': '限价管理',
|
||||
'/supply-chain/management/discontinuation': '停产下架管理',
|
||||
'/supply-chain/management/freight-maintenance': '快递维护',
|
||||
...Object.fromEntries(MANAGEMENT_BLANK_PAGES.map((page) => [page.route, page.label])),
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ describe('supply chain menu', () => {
|
||||
.map((item) => item.route)).toEqual(['/supply-chain/new-products/dropship-issues'])
|
||||
})
|
||||
|
||||
it('shows freight maintenance only with its dedicated permission', () => {
|
||||
expect(flattenSupplyChainMenu(filterSupplyChainMenu(['freightMaintenance']))
|
||||
.map((item) => item.route)).toEqual(['/supply-chain/management/freight-maintenance'])
|
||||
it('does not expose freight maintenance in the frontend menu', () => {
|
||||
expect(flattenSupplyChainMenu(filterSupplyChainMenu(['freightMaintenance'])))
|
||||
.toEqual([])
|
||||
expect(flattenSupplyChainMenu(filterSupplyChainMenu(['limitManagement'])))
|
||||
.not.toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ route: '/supply-chain/management/freight-maintenance' }),
|
||||
@ -137,11 +137,6 @@ describe('supply chain menu', () => {
|
||||
module: '经营管理',
|
||||
route: '/supply-chain/management/custom-table',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
label: '快递维护',
|
||||
module: '经营管理',
|
||||
route: '/supply-chain/management/freight-maintenance',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
label: '员工工时统计',
|
||||
module: '经营管理',
|
||||
|
||||
@ -113,11 +113,6 @@ export const SUPPLY_CHAIN_MENU: SupplyChainMenuModule[] = [
|
||||
route: '/supply-chain/management/custom-table',
|
||||
targetKey: 'limitManagement',
|
||||
},
|
||||
{
|
||||
label: '快递维护',
|
||||
route: '/supply-chain/management/freight-maintenance',
|
||||
targetKey: 'freightMaintenance',
|
||||
},
|
||||
{
|
||||
label: '停产下架管理',
|
||||
route: '/supply-chain/management/discontinuation',
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import FreightMaintenancePage from './page'
|
||||
|
||||
jest.mock('next/navigation', () => ({
|
||||
redirect: jest.fn(),
|
||||
}))
|
||||
|
||||
describe('freight maintenance page', () => {
|
||||
it('redirects the hidden legacy route to the supply-chain dashboard', () => {
|
||||
FreightMaintenancePage()
|
||||
expect(redirect).toHaveBeenCalledWith('/supply-chain/dashboard')
|
||||
})
|
||||
})
|
||||
@ -1,22 +1,5 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import { requireSession } from '@/lib/server-session'
|
||||
import { supplyChainPermissionSettingsService } from '@/server/services/supply-chain-permission-settings.service'
|
||||
import { FreightMaintenanceView } from './FreightMaintenanceView'
|
||||
|
||||
export const metadata = { title: '快递维护 · 供应链中心' }
|
||||
|
||||
export default async function FreightMaintenancePage() {
|
||||
const { authUser } = await requireSession('/login')
|
||||
const access = await supplyChainPermissionSettingsService.getUserAccess(
|
||||
authUser,
|
||||
'freightMaintenance',
|
||||
)
|
||||
if (!access.view) redirect('/supply-chain')
|
||||
|
||||
return (
|
||||
<FreightMaintenanceView
|
||||
canOperate={access.edit}
|
||||
canDownload={access.download}
|
||||
/>
|
||||
)
|
||||
redirect('/supply-chain/dashboard')
|
||||
}
|
||||
|
||||
@ -126,6 +126,7 @@ describe('permission matrix navigation sources', () => {
|
||||
expectedTargetKeys.delete('operationLogs')
|
||||
expectedTargetKeys.delete('modularProcessingRulesColumnsEdit')
|
||||
expectedTargetKeys.delete('modularProcessingRulesImport')
|
||||
expectedTargetKeys.delete('freightMaintenance')
|
||||
|
||||
expect(targetKeys).toHaveLength(new Set(targetKeys).size)
|
||||
expect(new Set(targetKeys)).toEqual(expectedTargetKeys)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user