diff --git a/app/performance-survey/PerformanceSurveyAdminConfig.test.tsx b/app/performance-survey/PerformanceSurveyAdminConfig.test.tsx index 6d61ca1..a69199a 100644 --- a/app/performance-survey/PerformanceSurveyAdminConfig.test.tsx +++ b/app/performance-survey/PerformanceSurveyAdminConfig.test.tsx @@ -218,8 +218,10 @@ describe('PerformanceSurveyAdminConfig', () => { fireEvent.click(screen.getByRole('button', { name: '删除岗位' })) const dialog = await screen.findByRole('alertdialog', { name: '删除岗位“品牌设计师”?' }) const dialogQueries = within(dialog) - expect(dialog).toHaveTextContent('当前仍有 6 人属于该岗位') - expect(dialog).toHaveTextContent('历史调研记录会保留') + expect(dialog).toHaveTextContent('6 人将变为待分配') + expect(dialog).not.toHaveTextContent('历史调研记录会保留') + expect(dialog).not.toHaveTextContent('原因将记录在管理操作日志中') + expect(dialog.parentElement).toHaveClass('backdrop-blur-[2px]') expect(dialogQueries.getByRole('button', { name: '删除岗位' })).toBeDisabled() fireEvent.change(dialogQueries.getByLabelText(/删除原因/), { target: { value: '岗位合并' } }) @@ -426,7 +428,11 @@ describe('PerformanceSurveyAdminConfig', () => { fireEvent.click(screen.getByRole('button', { name: '删除模板' })) const dialog = await screen.findByRole('alertdialog', { name: '删除模板“视觉案例评分”?' }) const dialogQueries = within(dialog) - expect(dialog).toHaveTextContent('历史调研中的模板和评分数据会继续保留') + expect(dialog).not.toHaveAttribute('aria-describedby') + expect(dialog).not.toHaveTextContent('历史调研中的模板和评分数据会继续保留') + expect(dialog).not.toHaveTextContent('如果岗位仍在使用该模板') + expect(dialog).not.toHaveTextContent('原因将记录在管理操作日志中') + expect(dialog.parentElement).toHaveClass('backdrop-blur-[2px]') fireEvent.change(dialogQueries.getByLabelText(/删除原因/), { target: { value: '模板重复' } }) fireEvent.click(dialogQueries.getByRole('button', { name: '删除模板' })) diff --git a/app/performance-survey/PerformanceSurveyAdminConfig.tsx b/app/performance-survey/PerformanceSurveyAdminConfig.tsx index f6fa714..47e5b1b 100644 --- a/app/performance-survey/PerformanceSurveyAdminConfig.tsx +++ b/app/performance-survey/PerformanceSurveyAdminConfig.tsx @@ -980,24 +980,19 @@ function PositionConfigWorkspace({ const removeGroup = async () => { if (!selected) return - const memberWarning = selected.memberCount > 0 - ? `当前仍有 ${selected.memberCount} 人属于该岗位,删除后这些人员会变为待分配。` - : '该岗位当前没有人员。' + const impactMessages = [ + selected.memberCount > 0 ? `${selected.memberCount} 人将变为待分配。` : '', + dirty ? '未保存的修改会一并丢失。' : '', + ].filter(Boolean) await confirmAction({ title: `删除岗位“${selected.name}”?`, - description: ( -
{memberWarning}
-历史调研记录会保留,但该岗位将不再出现在当前管理列表中。
- {dirty &&当前未保存的岗位修改也会同时放弃。
} -历史调研中的模板和评分数据会继续保留。
-如果岗位仍在使用该模板,需要先从岗位考核项中移除后才能删除。
- {dirty &&当前未保存的模板修改也会同时放弃。
} -- {reason.helperText || '原因将记录在管理操作日志中。'} -
+ {reason.helperText && ( ++ {reason.helperText} +
+ )} )}