| | |
| | | }; |
| | | } |
| | | |
| | | /** 格式化比例输入(显示两位小数,如 0.50%) */ |
| | | function createRatioFormatter2() { |
| | | return { |
| | | formatter: (value: number) => |
| | | value !== undefined && value !== null ? `${(value * 100).toFixed(2)}%` : '', |
| | | parser: (value: string) => { |
| | | const num = parseFloat(value.replace('%', '')); |
| | | return isNaN(num) ? 0 : num / 100; |
| | | }, |
| | | }; |
| | | } |
| | | |
| | | /** 新增/修改社保公积金方案的表单 */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | |
| | | ...createRatioFormatter(0.001), |
| | | }, |
| | | }, |
| | | // 大病医疗 |
| | | { |
| | | fieldName: 'divider_serious_illness', |
| | | label: '大病医疗', |
| | | component: 'Divider', |
| | | formItemClass: 'col-span-2', |
| | | }, |
| | | { |
| | | fieldName: 'seriousIllnessCompanyRatio', |
| | | label: '企业比例', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | placeholder: '企业缴纳比例', |
| | | min: 0, |
| | | max: 1, |
| | | step: 0.0001, |
| | | precision: 4, |
| | | style: { width: '100%' }, |
| | | ...createRatioFormatter2(), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'seriousIllnessPersonalRatio', |
| | | label: '个人比例', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | placeholder: '个人缴纳比例', |
| | | min: 0, |
| | | max: 1, |
| | | step: 0.0001, |
| | | precision: 4, |
| | | style: { width: '100%' }, |
| | | ...createRatioFormatter2(), |
| | | }, |
| | | }, |
| | | // 长期护理 |
| | | { |
| | | fieldName: 'divider_long_term_care', |
| | | label: '长期护理', |
| | | component: 'Divider', |
| | | formItemClass: 'col-span-2', |
| | | }, |
| | | { |
| | | fieldName: 'longTermCareCompanyRatio', |
| | | label: '企业比例', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | placeholder: '企业缴纳比例', |
| | | min: 0, |
| | | max: 1, |
| | | step: 0.0001, |
| | | precision: 4, |
| | | style: { width: '100%' }, |
| | | ...createRatioFormatter2(), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'longTermCarePersonalRatio', |
| | | label: '个人比例', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | placeholder: '个人缴纳比例', |
| | | min: 0, |
| | | max: 1, |
| | | step: 0.0001, |
| | | precision: 4, |
| | | style: { width: '100%' }, |
| | | ...createRatioFormatter2(), |
| | | }, |
| | | }, |
| | | // 公积金 |
| | | { |
| | | fieldName: 'divider_housing', |
| | |
| | | slots: { default: 'housingFundPersonalRatio' }, |
| | | }, |
| | | { |
| | | field: 'seriousIllnessPersonalRatio', |
| | | title: '大病医疗(个人)', |
| | | width: 120, |
| | | slots: { default: 'seriousIllnessPersonalRatio' }, |
| | | }, |
| | | { |
| | | field: 'longTermCarePersonalRatio', |
| | | title: '长期护理(个人)', |
| | | width: 120, |
| | | slots: { default: 'longTermCarePersonalRatio' }, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: '状态', |
| | | width: 80, |