diff --git a/app/performance-survey/PerformanceSurveyDashboardNavigation.test.tsx b/app/performance-survey/PerformanceSurveyDashboardNavigation.test.tsx index c6d2677..3a7aafe 100644 --- a/app/performance-survey/PerformanceSurveyDashboardNavigation.test.tsx +++ b/app/performance-survey/PerformanceSurveyDashboardNavigation.test.tsx @@ -535,7 +535,7 @@ describe('考核调研顶层导航保护', () => { }) test('公共看板仅按后端权限在分数下显示删除按钮并彻底删除单项调研', async () => { - mockSearchParams = new URLSearchParams('tab=public&workspace=pending') + mockSearchParams = new URLSearchParams('tab=public&workspace=pending&month=2026-07') let dashboardRequestCount = 0 const deleteRequests: Array<{ url: string; init?: RequestInit }> = [] global.fetch = jest.fn(async (input, init) => { diff --git a/app/performance-survey/[[...path]]/page.tsx b/app/performance-survey/[[...path]]/page.tsx index fec2822..6ec4b2d 100644 --- a/app/performance-survey/[[...path]]/page.tsx +++ b/app/performance-survey/[[...path]]/page.tsx @@ -1105,7 +1105,8 @@ function PerformanceDashboardBoard({ canCreateSurvey?: boolean }) { const router = useRouter() - const [month, setMonth] = useState(getCurrentMonthValue()) + const searchParams = useSearchParams() + const [month, setMonth] = useState(searchParams.get('month') || getCurrentMonthValue()) const [department, setDepartment] = useState('') const [employee, setEmployee] = useState(null) const [positionGroupCode, setPositionGroupCode] = useState('') diff --git a/lib/__tests__/performance-survey-service-policy.test.ts b/lib/__tests__/performance-survey-service-policy.test.ts index 44439e3..34424c7 100644 --- a/lib/__tests__/performance-survey-service-policy.test.ts +++ b/lib/__tests__/performance-survey-service-policy.test.ts @@ -457,7 +457,7 @@ describe('performance survey service policies', () => { expect(result.permissions.canDeletePublicDashboardAssessment).toBe(false) }) - test('只有无邪账号获得公共看板人员移除权限', async () => { + test('只有无邪账号获得公共看板单项调研删除权限', async () => { ;(prisma.user.findUnique as jest.Mock).mockResolvedValue({ ...baseUser, username: 'wuxie', @@ -470,6 +470,17 @@ describe('performance survey service policies', () => { expect(result.permissions.canDeletePublicDashboardAssessment).toBe(true) + ;(prisma.user.findUnique as jest.Mock).mockResolvedValue({ + ...baseUser, + username: '无邪', + }) + + const productionAccountResult = await getPerformanceSurveyDashboard(session, new URLSearchParams({ + view: 'public', + month: '2026-07', + })) + expect(productionAccountResult.permissions.canDeletePublicDashboardAssessment).toBe(true) + ;(prisma.user.findUnique as jest.Mock).mockResolvedValue({ ...baseUser, username: 'qingyun', @@ -491,7 +502,7 @@ describe('performance survey service policies', () => { test('无邪可按人员、月份、岗位和考核项彻底删除调研并释放重复校验', async () => { ;(prisma.user.findUnique as jest.Mock).mockResolvedValue({ ...baseUser, - username: 'wuxie', + username: '无邪', realName: '无邪', }) transactionClient.performanceSurveyTarget.findMany.mockResolvedValue([{ diff --git a/lib/performance-survey-service.ts b/lib/performance-survey-service.ts index f7113d1..b16b4d3 100644 --- a/lib/performance-survey-service.ts +++ b/lib/performance-survey-service.ts @@ -881,7 +881,8 @@ function ensureSystemAdministrator(ctx: UserContext) { } function canDeletePerformanceSurveyPublicDashboardAssessment(ctx: UserContext) { - return ctx.user.username.trim().toLowerCase() === 'wuxie' + const username = ctx.user.username.trim().toLowerCase() + return username === 'wuxie' || username === '无邪' } function ensureCanDeletePerformanceSurveyPublicDashboardAssessment(ctx: UserContext) {