fix: 精简配置页面月份入口

This commit is contained in:
江林铖 2026-07-29 13:44:03 +08:00
parent c7ac95fc8f
commit ea77f8a73f
2 changed files with 24 additions and 9 deletions

View File

@ -214,6 +214,19 @@ describe('PerformanceSurveyAdminConfig', () => {
await waitFor(() => expect(onMonthChange).toHaveBeenCalledWith('2026-09'))
})
test.each([
['positions', '岗位管理'],
['people', '人员分配'],
['templates', '模板管理'],
] as const)('%s 管理页面不显示月份查看入口', async (mode, heading) => {
const request = createRequest()
render(<PerformanceSurveyAdminConfig mode={mode} request={request} month="2026-07" />)
await waitFor(() => expect(screen.getByRole('heading', { name: heading })).toBeInTheDocument())
expect(screen.queryByLabelText('查看月份')).not.toBeInTheDocument()
expect(request).toHaveBeenCalledWith(`/admin/config?month=2026-07&scope=${mode}`)
})
test('岗位编辑产生 dirty 状态并保护岗位切换', async () => {
const request = createRequest()
const onDirtyChange = jest.fn()

View File

@ -549,15 +549,17 @@ export function PerformanceSurveyAdminConfig({
</h2>
{dirty && <StatusDot label="未保存" tone="warning" />}
</div>
<label className="flex items-center gap-2 text-[12px] font-semibold text-[#5f5e5e]">
查看月份
<input
type="month"
value={month}
onChange={(event) => void changeMonth(event.target.value)}
className="h-11 rounded border border-[#c2c6d8] px-3 text-[13px] font-semibold text-[#1a1c1c] outline-none focus:border-[#0050cb] focus:ring-2 focus:ring-[#dbe6ff]"
/>
</label>
{mode === 'overview' && (
<label className="flex items-center gap-2 text-[12px] font-semibold text-[#5f5e5e]">
查看月份
<input
type="month"
value={month}
onChange={(event) => void changeMonth(event.target.value)}
className="h-11 rounded border border-[#c2c6d8] px-3 text-[13px] font-semibold text-[#1a1c1c] outline-none focus:border-[#0050cb] focus:ring-2 focus:ring-[#dbe6ff]"
/>
</label>
)}
</div>
{notice && (
<div role="status" aria-live="polite" className="border-b border-[#b3c5ff] bg-[#f8faff] px-4 py-3 text-[13px] font-semibold text-[#0050cb]">