feat(hrm): 社保公积金方案新增大病医疗/长期护理(输入支持两位小数)
- 表单新增两组 Divider + 4 个 InputNumber,显示两位小数(0.00%)
- 列表新增大病医疗/长期护理(个人)两列
- 合同页图标改用 @vben/icons,移除未声明的 @ant-design/icons-vue 依赖
| | |
| | | unemploymentPersonalRatio?: number; |
| | | workInjuryRatio?: number; |
| | | maternityRatio?: number; |
| | | /** 大病医疗企业缴纳比例 */ |
| | | seriousIllnessCompanyRatio?: number; |
| | | /** 大病医疗个人缴纳比例 */ |
| | | seriousIllnessPersonalRatio?: number; |
| | | /** 长期护理企业缴纳比例 */ |
| | | longTermCareCompanyRatio?: number; |
| | | /** 长期护理个人缴纳比例 */ |
| | | longTermCarePersonalRatio?: number; |
| | | housingFundCompanyRatio?: number; |
| | | housingFundPersonalRatio?: number; |
| | | status?: number; |
| | |
| | | import { Page, useVbenModal } from '#/packages/effects/common-ui/src'; |
| | | import { downloadFileFromBlobPart } from '#/packages/utils/src'; |
| | | |
| | | import { DownOutlined } from '@ant-design/icons-vue'; |
| | | import { IconifyIcon } from '@vben/icons'; |
| | | import { Button, Dropdown, Menu, message, Modal, Tag } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | |
| | | <template #toolbar-tools> |
| | | <Dropdown> |
| | | <Button class="mr-2" type="primary"> |
| | | 下载合同模板 <DownOutlined /> |
| | | 下载合同模板 <IconifyIcon class="size-3" icon="lucide:chevron-down" /> |
| | | </Button> |
| | | <template #overlay> |
| | | <Menu @click="({ key }) => handleDownloadTemplate(Number(key))"> |
| | |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <Dropdown> |
| | | <a class="text-primary" @click.prevent>生成合同 <DownOutlined /></a> |
| | | <a class="text-primary" @click.prevent>生成合同 <IconifyIcon class="size-3" icon="lucide:chevron-down" /></a> |
| | | <template #overlay> |
| | | <Menu @click="({ key }) => handleGenerate(row, Number(key))"> |
| | | <Menu.Item key="1">劳动合同(简版)</Menu.Item> |
| | |
| | | </Dropdown> |
| | | <a class="ml-3 text-primary" @click="handleAttachments(row)">附件</a> |
| | | <Dropdown> |
| | | <a class="ml-3 text-primary" @click.prevent>更多 <DownOutlined /></a> |
| | | <a class="ml-3 text-primary" @click.prevent>更多 <IconifyIcon class="size-3" icon="lucide:chevron-down" /></a> |
| | | <template #overlay> |
| | | <Menu @click="(e) => handleMore(e, row)"> |
| | | <Menu.Item key="edit">修改</Menu.Item> |
| | |
| | | }; |
| | | } |
| | | |
| | | /** 格式化比例输入(显示两位小数,如 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, |
| | |
| | | return `${(ratio * 100).toFixed(1)}%`; |
| | | } |
| | | |
| | | /** 格式化比例显示(保留两位小数) */ |
| | | function formatRatio2(ratio: number | undefined) { |
| | | if (ratio === undefined || ratio === null) return '-'; |
| | | return `${(ratio * 100).toFixed(2)}%`; |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | |
| | | <template #housingFundPersonalRatio="{ row }"> |
| | | {{ formatRatio(row.housingFundPersonalRatio) }} |
| | | </template> |
| | | <template #seriousIllnessPersonalRatio="{ row }"> |
| | | {{ formatRatio2(row.seriousIllnessPersonalRatio) }} |
| | | </template> |
| | | <template #longTermCarePersonalRatio="{ row }"> |
| | | {{ formatRatio2(row.longTermCarePersonalRatio) }} |
| | | </template> |
| | | <template #status="{ row }"> |
| | | <Tag :color="row.status === 0 ? 'success' : 'default'"> |
| | | {{ row.status === 0 ? '启用' : '禁用' }} |
| | |
| | | maternityRatio: 0.005, |
| | | housingFundCompanyRatio: 0.12, |
| | | housingFundPersonalRatio: 0.12, |
| | | seriousIllnessCompanyRatio: 0, |
| | | seriousIllnessPersonalRatio: 0, |
| | | longTermCareCompanyRatio: 0, |
| | | longTermCarePersonalRatio: 0, |
| | | status: 0, |
| | | }); |
| | | return; |