feat: 转正弹窗显示原薪资 + 薪资变化时联动签署
- ConfirmModal 显示原薪资(¥xxx),转正薪资默认填入原薪资 - 转正薪资与原薪资不同时,提示"将发起薪酬调整确认书签署" - confirmMutation onSuccess:薪资变化时弹出签署方式选择弹窗 - scene=POLICY,文件标题为"转正薪酬调整确认书" - 备注记录薪资变化:¥原薪资 → ¥新薪资 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -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 || '转正失败'),
|
||||
})
|
||||
|
||||
@@ -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 }: {
|
||||
<Input type="date" value={form.confirmDate} onChange={(e) => setForm({ ...form, confirmDate: e.target.value })} />
|
||||
</div>
|
||||
<div>
|
||||
<Label>转正薪资(选填)</Label>
|
||||
<Input type="number" value={form.regularSalary} onChange={(e) => setForm({ ...form, regularSalary: e.target.value })} placeholder="不填则保持原薪资" />
|
||||
<div className="text-xs text-gray-400 mt-1">填写后将更新员工月工资并记录薪资变更</div>
|
||||
<Label>转正薪资{originalSalary ? `(原薪资 ¥${originalSalary})` : ''}</Label>
|
||||
<Input type="number" value={form.regularSalary} onChange={(e) => setForm({ ...form, regularSalary: e.target.value })} placeholder={originalSalary ? `不填则保持原薪资 ¥${originalSalary}` : '请输入转正薪资'} />
|
||||
<div className="text-xs text-gray-400 mt-1">
|
||||
{originalSalary
|
||||
? (salaryChanged
|
||||
? <span className="text-amber-600">⚠ 转正薪资与原薪资不同,提交后将发起薪酬调整确认书签署</span>
|
||||
: '填写后将更新员工月工资并记录薪资变更')
|
||||
: '填写后将更新员工月工资并记录薪资变更'}
|
||||
</div>
|
||||
</div>
|
||||
{error && (
|
||||
<div className="text-xs text-danger">
|
||||
|
||||
Reference in New Issue
Block a user