fix: blank_employees 模式不再自动带出基本工资
本月空白模式应所有金额默认 0,去掉从 emp.monthlySalary 自动填充 基本工资的逻辑,保持与"空白"语义一致。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -38,6 +38,7 @@ export default function SocialInsurance() {
|
||||
const [monthlyMonth, setMonthlyMonth] = useState(new Date().toISOString().slice(0, 7))
|
||||
const [monthlyProcessed, setMonthlyProcessed] = useState(false)
|
||||
const [processStatus, setProcessStatus] = useState<{ social: any; housing: any } | null>(null)
|
||||
const [minWageInput, setMinWageInput] = useState('0')
|
||||
const [newVersion, setNewVersion] = useState<any>({
|
||||
effectiveFrom: new Date().toISOString().slice(0, 7),
|
||||
city: '北京',
|
||||
@@ -238,6 +239,27 @@ export default function SocialInsurance() {
|
||||
},
|
||||
})
|
||||
|
||||
// 快速更新最低工资(无需新建版本)
|
||||
const updateMinWageMutation = useMutation({
|
||||
mutationFn: () => {
|
||||
const accountId = selectedAccountId || activeConfig?.accountId
|
||||
if (!accountId) throw new Error('未选择账户')
|
||||
return socialAccountApi.updateMinWage(accountId, Number(minWageInput) || 0)
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['social-config'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['social-config-versions'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['social-accounts'] })
|
||||
toast.success('最低工资标准已更新')
|
||||
},
|
||||
onError: (err: any) => toast.error(err?.response?.data?.error?.message || '更新失败'),
|
||||
})
|
||||
|
||||
// 当前配置变化时同步最低工资输入框
|
||||
useEffect(() => {
|
||||
setMinWageInput(String(activeConfig?.minWage || 0))
|
||||
}, [activeConfig?.minWage])
|
||||
|
||||
const aiSuggestMut = useMutation<any, any, { city: string; effectiveFrom: string; type: 'social' | 'housing' }>({
|
||||
mutationFn: async (vars: { city: string; effectiveFrom: string; type: 'social' | 'housing' }) => {
|
||||
return await socialInsuranceApi.aiSuggest(vars)
|
||||
@@ -524,6 +546,27 @@ export default function SocialInsurance() {
|
||||
{activeConfig.minWage > 0 && (
|
||||
<div className="flex justify-between border-b pb-1.5"><span className="text-gray-500">最低工资标准</span><span className="font-medium text-primary">¥{fmt(activeConfig.minWage)}</span></div>
|
||||
)}
|
||||
{/* 最低工资快速设置(社保 Tab,当前配置区域可直接编辑) */}
|
||||
<div className="flex justify-between items-center border-b pb-1.5">
|
||||
<span className="text-gray-500">最低工资标准</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input
|
||||
type="number"
|
||||
value={minWageInput}
|
||||
onChange={(e) => setMinWageInput(e.target.value)}
|
||||
placeholder="0"
|
||||
className="w-24 h-7 text-sm text-right"
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() => updateMinWageMutation.mutate()}
|
||||
disabled={updateMinWageMutation.isPending}
|
||||
>
|
||||
{updateMinWageMutation.isPending ? '保存中...' : '保存'}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{Array.isArray(activeConfig.extraInsurances) && activeConfig.extraInsurances.map((ins: any, idx: number) => (
|
||||
<div key={idx} className="flex justify-between border-b pb-1.5">
|
||||
<span className="text-gray-500">{ins.name}(企业/个人)</span>
|
||||
|
||||
Reference in New Issue
Block a user