| | |
| | | import { message, Tag } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getLeaveTypeConfigList } from '#/api/hrm/leave-type-config'; |
| | | import { |
| | | deleteLeaveTypeConfig, |
| | | getLeaveTypeConfigList, |
| | | } from '#/api/hrm/leave-type-config'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns } from './data'; |
| | |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** 新增配置 */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** 编辑配置 */ |
| | | function handleEdit(row: HrmLeaveTypeConfigApi.LeaveTypeConfig) { |
| | | formModalApi.setData({ id: row.id, row }).open(); |
| | | formModalApi.setData({ formType: 'update', row }).open(); |
| | | } |
| | | |
| | | /** 删除配置 */ |
| | | async function handleDelete(row: HrmLeaveTypeConfigApi.LeaveTypeConfig) { |
| | | await deleteLeaveTypeConfig(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', ['请假扣款配置'])); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <Grid table-title="请假扣款配置列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['请假扣款配置']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['hrm:leave-type-config:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #deductionRatio="{ row }"> |
| | | <Tag :color="row.deductionRatio === 0 ? 'success' : row.deductionRatio === 1 ? 'error' : 'warning'"> |
| | | {{ row.deductionRatio === 0 ? '不扣款' : `${(row.deductionRatio * 100).toFixed(0)}%` }} |
| | |
| | | auth: ['hrm:leave-type-config:update'], |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['hrm:leave-type-config:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', ['请假扣款配置']), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |