fix(intake): preserve existing new product dashboard

This commit is contained in:
jingchuan 2026-08-17 18:53:46 +08:00
parent 5ac98a6b82
commit 156b431dda
2 changed files with 39 additions and 5 deletions

View File

@ -1,5 +1,39 @@
import { redirect } from 'next/navigation'
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 NewProductManagementDashboard from "./NewProductManagementDashboard";
export const dynamic = "force-dynamic";
export default async function NewProductManagementPage() {
redirect('/supply-chain/new-products/overview')
await requireSession("/login");
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 new product management dashboard", error);
return {
dashboard: createEmptyOaBoardDashboard(),
loadErrorMessage:
error instanceof Error
? `新品管理数据读取失败:${error.message}`
: "新品管理数据读取失败,请稍后重试。",
};
});
return (
<NewProductManagementDashboard
dashboard={result.dashboard}
loadErrorMessage={result.loadErrorMessage}
/>
);
}

View File

@ -35,7 +35,7 @@ const WORKBENCH_NAV_ITEMS = [
{ href: '/draft-groups', icon: PackageOpen, label: '草稿组' },
{ href: '/intake', icon: ArrowDownToLine, label: '产品资料' },
{ href: '/bom-costing', icon: Calculator, label: 'BOM核算' },
{ href: '/supply-chain/new-products/overview', icon: ClipboardList, label: '新品管理' },
{ href: '/intake/new-product-management', icon: ClipboardList, label: '新品管理' },
{ href: '/warehouse', icon: Warehouse, label: '仓库管理' },
{ href: '/warehouse-quality', icon: ClipboardCheck, label: '仓库质检' },
{ href: '/ai-render-workbench', icon: Sparkles, label: 'AI出图' },
@ -49,8 +49,8 @@ function matchesWorkbenchHref(pathname: string, href: string) {
if (href === '/intake') {
return pathname === '/intake' || (pathname.startsWith('/intake/') && !pathname.startsWith('/intake/new-product-management') && !pathname.startsWith('/intake/oa-board') && !pathname.startsWith('/intake/sample-progress'))
}
if (href === '/supply-chain/new-products/overview') {
return pathname === href || pathname.startsWith(`${href}/`) || pathname.startsWith('/intake/new-product-management') || pathname.startsWith('/intake/oa-board') || pathname.startsWith('/intake/sample-progress')
if (href === '/intake/new-product-management') {
return pathname === href || pathname.startsWith(`${href}/`) || pathname.startsWith('/intake/oa-board') || pathname.startsWith('/intake/sample-progress')
}
return pathname === href || pathname.startsWith(`${href}/`)
}