diff --git a/frontend/src/pages/Roster.tsx b/frontend/src/pages/Roster.tsx index d12ce8d..48bd126 100644 --- a/frontend/src/pages/Roster.tsx +++ b/frontend/src/pages/Roster.tsx @@ -281,13 +281,28 @@ export default function Roster() { const confirmMutation = useMutation({ mutationFn: (data: { employeeId: string; confirmDate: string; regularSalary?: number }) => workProcessApi.create({ type: 'CONFIRM', title: '转正', employeeId: data.employeeId, formData: { employeeId: data.employeeId, confirmDate: data.confirmDate, regularSalary: data.regularSalary }, status: 'DRAFT' }), - onSuccess: () => { + onSuccess: (_data, variables) => { queryClient.invalidateQueries({ queryKey: ['roster'] }) queryClient.invalidateQueries({ queryKey: ['dashboard'] }) queryClient.invalidateQueries({ queryKey: ['roster-profile'] }) setShowConfirmModal(false) + const originalSalary = confirmEmployee?.monthlySalary ? Number(confirmEmployee.monthlySalary) : null + const newSalary = variables.regularSalary + // 薪资有变化时弹出签署方式选择 + if (newSalary && newSalary !== originalSalary) { + setSignChoice({ + open: true, + employeeId: variables.employeeId, + employeeName: confirmEmployee?.name || '', + scene: 'POLICY', + documentTitle: `${confirmEmployee?.name || ''}的转正薪酬调整确认书`, + remark: `转正薪资调整:¥${originalSalary || 0} → ¥${newSalary}`, + actionName: '转正调薪', + }) + } else { + toast.success('转正已提交') + } setConfirmEmployee(null) - toast.success('转正已提交') }, onError: (err: any) => toast.error(err?.response?.data?.error?.message || '转正失败'), }) diff --git a/frontend/src/pages/roster/modals.tsx b/frontend/src/pages/roster/modals.tsx index 6bf9523..d6cb15a 100644 --- a/frontend/src/pages/roster/modals.tsx +++ b/frontend/src/pages/roster/modals.tsx @@ -335,11 +335,15 @@ export function ConfirmModal({ employee, onClose, onSubmit, loading, error }: { loading: boolean error: any }) { + const originalSalary = employee.monthlySalary ? Number(employee.monthlySalary) : null const [form, setForm] = useState({ confirmDate: new Date().toISOString().slice(0, 10), - regularSalary: '', + regularSalary: originalSalary ? String(originalSalary) : '', }) + /** 转正薪资与原薪资是否不同 */ + const salaryChanged = form.regularSalary !== '' && Number(form.regularSalary) !== originalSalary + const handleSubmit = () => { onSubmit({ employeeId: employee.id, @@ -363,9 +367,15 @@ export function ConfirmModal({ employee, onClose, onSubmit, loading, error }: { setForm({ ...form, confirmDate: e.target.value })} />