189 lines
7.8 KiB
TypeScript
189 lines
7.8 KiB
TypeScript
import type { Metadata } from 'next'
|
||
import { notFound, redirect } from 'next/navigation'
|
||
import { Suspense } from 'react'
|
||
import AutomationWorkflowsDashboard from '@/components/department-dashboard/AutomationWorkflowsDashboard'
|
||
import PermissionsDashboard from '@/components/department-dashboard/PermissionsDashboard'
|
||
import BrandHealthDashboard from '@/components/department-dashboard/BrandHealthDashboard'
|
||
import BusinessTrendsDashboard from '@/components/department-dashboard/BusinessTrendsDashboard'
|
||
import TeamCapacityDashboard from '@/components/department-dashboard/TeamCapacityDashboard'
|
||
import CoreMetricsDashboard from '@/components/department-dashboard/CoreMetricsDashboard'
|
||
import DepartmentShell from '@/components/department-dashboard/DepartmentShell'
|
||
import OrganizationStructureDashboard from '@/components/department-dashboard/OrganizationStructureDashboard'
|
||
import TeamFunctionsDashboard from '@/components/department-dashboard/TeamFunctionsDashboard'
|
||
import ValueMetricsDashboard from '@/components/department-dashboard/ValueMetricsDashboard'
|
||
import BrandKnowledgeDashboard from '@/components/department-dashboard/BrandKnowledgeDashboard'
|
||
import PerformanceConversionDashboard from '@/components/department-dashboard/PerformanceConversionDashboard'
|
||
import WorkspacePlaceholder from '@/components/department-dashboard/WorkspacePlaceholder'
|
||
import {
|
||
getFrameworkWorkspaceParams,
|
||
getWorkspaceItem,
|
||
WORKSPACE_REDIRECTS,
|
||
} from '@/components/department-dashboard/workspace-navigation'
|
||
|
||
type WorkspaceItemPageProps = {
|
||
params: {
|
||
section: string
|
||
item: string
|
||
}
|
||
searchParams?: { view?: string; scope?: string }
|
||
}
|
||
|
||
function AutomationWorkflowsFallback() {
|
||
return (
|
||
<DepartmentShell>
|
||
<main
|
||
className="flex h-[calc(100dvh-72px)] min-h-[560px] flex-col overflow-hidden bg-white lg:grid lg:grid-cols-[232px_minmax(0,1fr)]"
|
||
aria-label="正在加载自动化工作流"
|
||
aria-busy="true"
|
||
>
|
||
<aside className="grid shrink-0 grid-cols-2 gap-2 border-b border-[#e2e8f0] bg-[#f8fafc] px-4 py-4 lg:min-h-0 lg:grid-cols-1 lg:content-start lg:gap-1 lg:border-b-0 lg:border-r lg:py-6">
|
||
<div className="h-[58px] animate-pulse rounded-lg bg-[#e6edf5]" />
|
||
<div className="h-[58px] animate-pulse rounded-lg bg-[#eef2f6]" />
|
||
</aside>
|
||
<section className="min-h-0 min-w-0 flex-1 bg-[#f2f4f7]" />
|
||
</main>
|
||
</DepartmentShell>
|
||
)
|
||
}
|
||
|
||
export function generateStaticParams() {
|
||
return getFrameworkWorkspaceParams()
|
||
}
|
||
|
||
export function generateMetadata({ params }: WorkspaceItemPageProps): Metadata {
|
||
const workspace = getWorkspaceItem(params.section, params.item)
|
||
if (!workspace) return {}
|
||
|
||
if (workspace.section.key === 'assets' && workspace.item.key === 'automation-workflows') {
|
||
return {
|
||
title: '自动化工作流 | 资产与AI自动化 | 品牌中心部门看板',
|
||
description: '集中进入绩效考核调研与作品过稿看板。',
|
||
}
|
||
}
|
||
|
||
if (workspace.section.key === 'governance' && workspace.item.key === 'permissions') {
|
||
return {
|
||
title: '权限管理 | 治理与设置 | 品牌中心部门看板',
|
||
description: '集中配置权限组与查看人员的权限组归属。',
|
||
}
|
||
}
|
||
|
||
if (workspace.section.key === 'organization' && workspace.item.key === 'organization-structure') {
|
||
return {
|
||
title: '组织架构 | 组织管理 | 品牌中心部门看板',
|
||
description: '按品牌中心或全公司范围查看花名册组织层级与人员明细。',
|
||
}
|
||
}
|
||
|
||
if (workspace.section.key === 'organization' && workspace.item.key === 'team-functions') {
|
||
return {
|
||
title: '团队职能 | 组织管理 | 品牌中心部门看板',
|
||
description: '按团队查看品牌服务、前置能力、岗位与职责边界。',
|
||
}
|
||
}
|
||
|
||
if (workspace.section.key === 'assets' && workspace.item.key === 'value-metrics') {
|
||
return {
|
||
title: '价值指标 | 资产与AI自动化 | 品牌中心部门看板',
|
||
description: '从素材资产库按资产类型查看复用率与下载次数明细。',
|
||
}
|
||
}
|
||
|
||
if (workspace.section.key === 'assets' && workspace.item.key === 'brand-knowledge') {
|
||
return {
|
||
title: '品牌知识库 | 资产与AI自动化 | 品牌中心部门看板',
|
||
description: '按素材资产库的浏览方式检索和分类查看品牌知识。',
|
||
}
|
||
}
|
||
|
||
if (workspace.section.key === 'business' && workspace.item.key === 'performance-conversion') {
|
||
return {
|
||
title: '业绩转化 | 业务经营 | 品牌中心部门看板',
|
||
description: '按六个品牌关联已完结美术流程商品 ID,查看流程完结后六个月的每日经营变化。',
|
||
}
|
||
}
|
||
|
||
if (workspace.item.status !== 'framework') return {}
|
||
|
||
return {
|
||
title: `${workspace.item.title} | ${workspace.section.title} | 品牌中心部门看板`,
|
||
description: workspace.section.key === 'dashboard' && workspace.item.key === 'brand-health'
|
||
? '六个品牌的健康度评分维度与权重框架。'
|
||
: workspace.section.key === 'dashboard' && workspace.item.key === 'business-trends'
|
||
? '按六个品牌查看美术设计与内容视频流程近八周的发起、完结数量及每周任务明细。'
|
||
: workspace.section.key === 'dashboard' && workspace.item.key === 'team-capacity'
|
||
? '按二级部门查看团队近八周收到与完结流程,并下钻查看每周任务明细。'
|
||
: `${workspace.item.title}二级页面框架。`,
|
||
}
|
||
}
|
||
|
||
export default function WorkspaceItemPage({ params, searchParams }: WorkspaceItemPageProps) {
|
||
const legacyTarget = WORKSPACE_REDIRECTS[`${params.section}/${params.item}`]
|
||
if (legacyTarget) redirect(legacyTarget)
|
||
const workspace = getWorkspaceItem(params.section, params.item)
|
||
|
||
if (!workspace) {
|
||
notFound()
|
||
}
|
||
|
||
if (workspace.section.key === 'assets' && workspace.item.key === 'automation-workflows') {
|
||
return (
|
||
<Suspense fallback={<AutomationWorkflowsFallback />}>
|
||
<AutomationWorkflowsDashboard />
|
||
</Suspense>
|
||
)
|
||
}
|
||
|
||
if (workspace.section.key === 'organization' && workspace.item.key === 'organization-structure') {
|
||
return <OrganizationStructureDashboard scope={searchParams?.scope === 'company' ? 'company' : 'brand'} />
|
||
}
|
||
|
||
if (workspace.section.key === 'organization' && workspace.item.key === 'team-functions') {
|
||
return <TeamFunctionsDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'assets' && workspace.item.key === 'value-metrics') {
|
||
return <ValueMetricsDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'assets' && workspace.item.key === 'brand-knowledge') {
|
||
return <BrandKnowledgeDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'business' && workspace.item.key === 'performance-conversion') {
|
||
return <PerformanceConversionDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'governance' && workspace.item.key === 'permissions') {
|
||
return <PermissionsDashboard view={searchParams?.view === 'people' ? 'people' : 'groups'} />
|
||
}
|
||
|
||
if (workspace.item.status !== 'framework') notFound()
|
||
|
||
if (workspace.section.key === 'dashboard' && workspace.item.key === 'core-metrics') {
|
||
return <CoreMetricsDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'dashboard' && workspace.item.key === 'brand-health') {
|
||
return <BrandHealthDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'dashboard' && workspace.item.key === 'business-trends') {
|
||
return <BusinessTrendsDashboard />
|
||
}
|
||
|
||
if (workspace.section.key === 'dashboard' && workspace.item.key === 'team-capacity') {
|
||
return <TeamCapacityDashboard />
|
||
}
|
||
|
||
return (
|
||
<WorkspacePlaceholder
|
||
title={workspace.item.title}
|
||
description={`“${workspace.item.title}”属于“${workspace.section.title}”板块,当前先建立独立二级页面框架。`}
|
||
accent={workspace.section.accent}
|
||
accentSoft={workspace.section.accentSoft}
|
||
accentText={workspace.section.accentText}
|
||
/>
|
||
)
|
||
}
|