liu
3 天以前 602d3975198790f467d7c77d103902c7d3a218b7
src/views/hrm/salary/leave-type-config/index.vue
@@ -7,7 +7,10 @@
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';
@@ -23,9 +26,21 @@
  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({
@@ -56,6 +71,19 @@
  <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)}%` }}
@@ -76,6 +104,17 @@
              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>