fix(supply-chain): preserve new product overview entry
This commit is contained in:
parent
053a603308
commit
8cfd3f8292
@ -54,6 +54,11 @@ export const SUPPLY_CHAIN_MENU: SupplyChainMenuModule[] = [
|
||||
label: '新品管理',
|
||||
icon: 'PackagePlus',
|
||||
sections: [
|
||||
{
|
||||
items: [
|
||||
{ label: '新品经营总览', route: '/supply-chain/new-products/overview', targetKey: 'newProductOverview' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '公共数据源',
|
||||
items: [
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import NewProductManagementDashboard from '@/app/intake/new-product-management/NewProductManagementDashboard'
|
||||
import { requireSession } from '@/lib/server-session'
|
||||
import { OA_BOARD_DEFAULT_TRACKED_STATUSES } from '@/server/services/oa-board.constants'
|
||||
import {
|
||||
createEmptyOaBoardDashboard,
|
||||
oaBoardService,
|
||||
} from '@/server/services/oa-board.service'
|
||||
import { supplyChainPermissionSettingsService } from '@/server/services/supply-chain-permission-settings.service'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
export const metadata = { title: '新品经营总览 · 供应链中心' }
|
||||
|
||||
export default async function NewProductOverviewPage() {
|
||||
const { authUser } = await requireSession('/login')
|
||||
const access = await supplyChainPermissionSettingsService.getUserAccess(
|
||||
authUser,
|
||||
'newProductOverview',
|
||||
)
|
||||
if (!access.view) redirect('/supply-chain')
|
||||
|
||||
const result = await oaBoardService
|
||||
.getDashboard({
|
||||
overallStatus: [...OA_BOARD_DEFAULT_TRACKED_STATUSES],
|
||||
})
|
||||
.then((dashboard) => ({
|
||||
dashboard,
|
||||
loadErrorMessage: null as string | null,
|
||||
}))
|
||||
.catch((error) => {
|
||||
console.error('Failed to load supply chain new product overview', error)
|
||||
return {
|
||||
dashboard: createEmptyOaBoardDashboard(),
|
||||
loadErrorMessage:
|
||||
error instanceof Error
|
||||
? `新品管理数据读取失败:${error.message}`
|
||||
: '新品管理数据读取失败,请稍后重试。',
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-y-auto">
|
||||
<NewProductManagementDashboard
|
||||
dashboard={result.dashboard}
|
||||
loadErrorMessage={result.loadErrorMessage}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user