diff --git a/PRODUCT.md b/PRODUCT.md index 6b3db8e7..e725f7f8 100644 --- a/PRODUCT.md +++ b/PRODUCT.md @@ -25,6 +25,7 @@ web - “自动化工作流”作为“资产与AI自动化”下的业务入口,集中链接现有的绩效考核调研与作品过稿看板。 - “组织架构”统一品牌中心与全公司范围,默认品牌中心,复用真实组织树、人员明细和原管理员权限。 - “绩效薪资”沿用 `/workspaces/organization/performance-review`,仅启用中的超级管理员及明确授权的无邪、清云、伯言、元泽账号可查看;指定账号按固定用户 ID 校验,普通系统/部门管理员不自动获得权限。导航默认隐藏,服务端页面独立核验当前账号权限。 +- “绩效薪资”页内左侧栏提供“薪资明细”和“后台配置”,默认薪资明细,`?view=configuration` 切换配置;窄屏改为顶部两列菜单。业务内容尚未接入时显示空状态,不展示示例薪资或无效配置操作。 - 品牌中心工作台访问范围以权威人员绑定和 HR 组织路径为准;品牌中心以外的普通用户登录后只进入 `/assets/material-library`,不显示品牌中心侧栏、返回入口,也不能直接访问 `/` 或 `/workspaces/*`。系统管理员保留维护通行能力。 - “权限管理”统一权限组与人员权限视图;组织数据归组织管理,不再保留数据口径的独立入口。旧链接跳转至对应的新视图。 - “进行中项目”只同步两个已确认的钉钉流程类型,并只统计北京时间 2026 年 4 月 1 日起发起且尚未完结的流程;总览和所有下钻维度共用这一口径。 diff --git a/app/workspaces/[section]/[item]/page.tsx b/app/workspaces/[section]/[item]/page.tsx index b483e291..755ed49e 100644 --- a/app/workspaces/[section]/[item]/page.tsx +++ b/app/workspaces/[section]/[item]/page.tsx @@ -16,6 +16,7 @@ import TeamFunctionsDashboard from '@/components/department-dashboard/TeamFuncti import ValueMetricsDashboard from '@/components/department-dashboard/ValueMetricsDashboard' import BrandKnowledgeDashboard from '@/components/department-dashboard/BrandKnowledgeDashboard' import PerformanceConversionDashboard from '@/components/department-dashboard/PerformanceConversionDashboard' +import PerformanceSalaryDashboard from '@/components/department-dashboard/PerformanceSalaryDashboard' import WorkspacePlaceholder from '@/components/department-dashboard/WorkspacePlaceholder' import { getFrameworkWorkspaceParams, @@ -85,6 +86,13 @@ export function generateMetadata({ params }: WorkspaceItemPageProps): Metadata { } } + if (workspace.section.key === 'organization' && workspace.item.key === 'performance-review') { + return { + title: '绩效薪资 | 组织管理 | 品牌中心部门看板', + description: '查看薪资明细与后台配置。', + } + } + if (workspace.section.key === 'assets' && workspace.item.key === 'value-metrics') { return { title: '价值指标 | 资产与AI自动化 | 品牌中心部门看板', @@ -134,6 +142,7 @@ export default async function WorkspaceItemPage({ params, searchParams }: Worksp if (!session?.user) redirect('/login') if (session.user.canAccessBrandCenter !== true) redirect('/assets/material-library') if (!(await canViewPerformanceSalary(session.user.id))) redirect('/workspaces/dashboard/core-metrics') + return } if (workspace.section.key === 'assets' && workspace.item.key === 'automation-workflows') { diff --git a/components/department-dashboard/PerformanceSalaryDashboard.tsx b/components/department-dashboard/PerformanceSalaryDashboard.tsx new file mode 100644 index 00000000..7bcc6297 --- /dev/null +++ b/components/department-dashboard/PerformanceSalaryDashboard.tsx @@ -0,0 +1,49 @@ +import Link from 'next/link' +import { ListChecks, Settings2 } from 'lucide-react' +import DepartmentShell from './DepartmentShell' + +// Operate: inherit the existing split workbench; two URL-backed views, no sample salary data. +const VIEWS = [ + { key: 'details', title: '薪资明细', href: '/workspaces/organization/performance-review', icon: ListChecks }, + { key: 'configuration', title: '后台配置', href: '/workspaces/organization/performance-review?view=configuration', icon: Settings2 }, +] as const + +export default function PerformanceSalaryDashboard({ view = 'details' }: { view?: 'details' | 'configuration' }) { + const activeView = VIEWS.find((item) => item.key === view)! + + return ( + + + + + + {activeView.title} + + + {view === 'details' ? '暂无薪资明细' : '暂无后台配置'} + {view === 'details' ? '薪资数据尚未接入。' : '配置内容尚未设置。'} + + + + + ) +} diff --git a/components/department-dashboard/WorkspaceItemPage.performance-salary.test.tsx b/components/department-dashboard/WorkspaceItemPage.performance-salary.test.tsx index c16ae8e4..1f79e323 100644 --- a/components/department-dashboard/WorkspaceItemPage.performance-salary.test.tsx +++ b/components/department-dashboard/WorkspaceItemPage.performance-salary.test.tsx @@ -2,7 +2,7 @@ import { getServerSession } from 'next-auth' import { redirect } from 'next/navigation' import { prisma } from '@/lib/prisma' import WorkspaceItemPage, { generateMetadata } from '@/app/workspaces/[section]/[item]/page' -import WorkspacePlaceholder from './WorkspacePlaceholder' +import PerformanceSalaryDashboard from './PerformanceSalaryDashboard' jest.mock('next-auth', () => ({ getServerSession: jest.fn() })) jest.mock('next/navigation', () => ({ redirect: jest.fn(), notFound: jest.fn() })) @@ -55,12 +55,28 @@ test.each([ getSession.mockResolvedValue({ user: { id: identity.id, canAccessBrandCenter: true } }) findUser.mockResolvedValue({ ...identity, isActive: true, status: 'active', archivedAt: null }) const page = await WorkspaceItemPage(props) - expect(page.type).toBe(WorkspacePlaceholder) - expect(page.props.title).toBe('绩效薪资') - expect(page.props.description).toContain('绩效薪资') + expect(page.type).toBe(PerformanceSalaryDashboard) + expect(page.props.view).toBe('details') expect(generateMetadata(props).title).toBe('绩效薪资 | 组织管理 | 品牌中心部门看板') }) +test.each([ + ['configuration', 'configuration'], + ['unknown', 'details'], +])('授权访问按 URL 选择视图:%s', async (view, expectedView) => { + getSession.mockResolvedValue({ user: { id: 'super-admin', canAccessBrandCenter: true } }) + findUser.mockResolvedValue({ id: 'super-admin', isSuperAdmin: true, isActive: true, status: 'active', archivedAt: null }) + const page = await WorkspaceItemPage({ ...props, searchParams: { view } }) + expect(page.type).toBe(PerformanceSalaryDashboard) + expect(page.props.view).toBe(expectedView) +}) + +test('后台配置链接同样经过薪资权限门禁', async () => { + getSession.mockResolvedValue({ user: { id: 'ordinary', canAccessBrandCenter: true } }) + findUser.mockResolvedValue({ id: 'ordinary', isSuperAdmin: false, isActive: true, status: 'active', archivedAt: null }) + await expect(WorkspaceItemPage({ ...props, searchParams: { view: 'configuration' } })).rejects.toThrow('redirect:/workspaces/dashboard/core-metrics') +}) + test('其他组织管理板块不受薪资专属权限限制', async () => { await WorkspaceItemPage({ params: { section: 'organization', item: 'team-functions' } }) expect(getSession).not.toHaveBeenCalled()
{view === 'details' ? '薪资数据尚未接入。' : '配置内容尚未设置。'}