liu
16 小时以前 1da75e1e70af40a8598943b4af5901f1e0ca7b1d
fix(hrm): 修复考勤异常新增字段错误
已修改4个文件
58 ■■■■■ 文件已修改
src/api/hrm/attendance/exception/index.ts 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/attendance/exception/data.ts 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/attendance/exception/detail/approve/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/attendance/exception/modules/audit-modal.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hrm/attendance/exception/index.ts
@@ -10,14 +10,13 @@
    userId?: number;
    userName?: string;
    deptName?: string;
    date?: string;
    exceptionType?: number;
    exceptionTypeName?: string;
    exceptionDate?: string;
    exceptionTime?: string;
    type?: number;
    reason?: string;
    blobIds?: number[];
    attachmentList?: SystemStorageApi.StorageBlob[];
    status?: number;
    exceptionDate?: string;
    // 以下为审核派生字段,由后端在审核时写入,前端只读展示
    reviewerId?: number; // 审核人ID(实际执行审核的用户)
    reviewerName?: string; // 审核人姓名
@@ -83,4 +82,4 @@
    pass,
    reviewRemark,
  });
}
}
src/views/hrm/attendance/exception/data.ts
@@ -8,6 +8,18 @@
/** 表单类型 */
export type FormType = 'create' | 'detail';
/** 考勤异常类型,与后端 HrmAttendanceExceptionTypeEnum 保持一致 */
const EXCEPTION_TYPE_OPTIONS = [
  { label: '补卡', value: 1 },
  { label: '加班', value: 2 },
  { label: '出差', value: 3 },
];
/** 考勤异常类型名称 */
export function formatExceptionType(value?: number) {
  return EXCEPTION_TYPE_OPTIONS.find((item) => item.value === value)?.label ?? '-';
}
/** 新增考勤异常申请的表单 */
export function useFormSchema(formType: FormType): VbenFormSchema[] {
  return [
@@ -20,28 +32,23 @@
      },
    },
    {
      fieldName: 'date',
      label: '考勤日期',
      fieldName: 'exceptionDate',
      label: '异常日期',
      component: 'DatePicker',
      componentProps: {
        placeholder: '请选择考勤日期',
        placeholder: '请选择异常日期',
        valueFormat: 'YYYY-MM-DD',
        style: { width: '100%' },
      },
      rules: 'required',
    },
    {
      fieldName: 'exceptionType',
      fieldName: 'type',
      label: '异常类型',
      component: 'Select',
      componentProps: {
        placeholder: '请选择异常类型',
        options: [
          { label: '漏打卡', value: 1 },
          { label: '迟到', value: 2 },
          { label: '早退', value: 3 },
          { label: '其他', value: 4 },
        ],
        options: EXCEPTION_TYPE_OPTIONS,
      },
      rules: 'selectRequired',
    },
@@ -113,8 +120,14 @@
  return [
    { field: 'userName', title: '申请人', minWidth: 100 },
    { field: 'deptName', title: '部门', minWidth: 120 },
    { field: 'date', title: '考勤日期', width: 110 },
    { field: 'exceptionTypeName', title: '异常类型', width: 100 },
    { field: 'exceptionDate', title: '异常日期', width: 110 },
    {
      field: 'type',
      title: '异常类型',
      width: 100,
      formatter: ({ cellValue }: { cellValue: number }) =>
        formatExceptionType(cellValue),
    },
    { field: 'reason', title: '异常原因', minWidth: 200 },
    {
      field: 'status',
@@ -140,4 +153,4 @@
      },
    },
  ];
}
}
src/views/hrm/attendance/exception/detail/approve/index.vue
@@ -14,6 +14,8 @@
import { DictTag } from '#/components/dict-tag';
import { useDescription } from '#/components/description';
import { formatExceptionType } from '../../data';
defineOptions({ name: 'HrmAttendanceExceptionApproveDetail' });
const props = defineProps<{ id: string }>();
@@ -34,10 +36,10 @@
    { label: '所属部门', field: 'deptName', render: textRender },
    {
      label: '异常日期',
      field: 'date',
      field: 'exceptionDate',
      render: (val) => formatDateTime(val) as string,
    },
    { label: '异常类型', field: 'exceptionTypeName', render: textRender },
    { label: '异常类型', field: 'type', render: formatExceptionType },
    { label: '异常说明', field: 'reason', render: textRender },
    {
      label: '审批状态',
src/views/hrm/attendance/exception/modules/audit-modal.vue
@@ -11,6 +11,8 @@
import { useVbenForm } from '#/adapter/form';
import { auditAttendanceException } from '#/api/hrm/attendance/exception';
import { formatExceptionType } from '../data';
const emit = defineEmits(['success']);
const pass = ref(true); // true=审核通过 / false=审核不通过
@@ -94,7 +96,7 @@
      <div>申请人:{{ rowData.userName }}</div>
      <div>所属部门:{{ rowData.deptName }}</div>
      <div>异常日期:{{ rowData.exceptionDate }}</div>
      <div>异常类型:{{ rowData.exceptionTypeName }}</div>
      <div>异常类型:{{ formatExceptionType(rowData.type) }}</div>
      <div>申请原因:{{ rowData.reason }}</div>
    </div>
    <Form class="mx-4" />