tuqin
12 小时以前 2cb77a3487b8c5da6fe02f3c1018dcf70f73d29a
src/views/hrm/salary/social-security-scheme/data.ts
@@ -16,6 +16,18 @@
  };
}
/** 格式化比例输入(显示两位小数,如 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 [
@@ -200,6 +212,76 @@
        ...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',
@@ -307,6 +389,18 @@
      slots: { default: 'housingFundPersonalRatio' },
    },
    {
      field: 'seriousIllnessPersonalRatio',
      title: '大病医疗(个人)',
      width: 120,
      slots: { default: 'seriousIllnessPersonalRatio' },
    },
    {
      field: 'longTermCarePersonalRatio',
      title: '长期护理(个人)',
      width: 120,
      slots: { default: 'longTermCarePersonalRatio' },
    },
    {
      field: 'status',
      title: '状态',
      width: 80,