gaoluyang
3 天以前 2af66bb5090434a077f8b5b6b01e2ac4248d1cdd
fix(hrm): 考勤异常申请字段与异常类型修正

- 表单/列表统一使用 exceptionDate、type,与后端保存 VO 一致
- 异常类型选项改为 1-补卡 2-加班 3-出差,列表与审批详情按类型显示
- 修复提交时报「异常类型不能为空」「异常日期不能为空」

Co-Authored-By: Claude Code <noreply@anthropic.com>
已修改3个文件
52 ■■■■■ 文件已修改
src/api/hrm/attendance/exception/index.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/attendance/exception/data.ts 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/attendance/exception/detail/approve/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hrm/attendance/exception/index.ts
@@ -10,9 +10,8 @@
    userId?: number;
    userName?: string;
    deptName?: string;
    date?: string;
    exceptionType?: number;
    exceptionTypeName?: string;
    exceptionDate?: string;
    type?: number;
    reason?: string;
    blobIds?: number[];
    attachmentList?: SystemStorageApi.StorageBlob[];
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',
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,14 @@
    { 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: (val) => formatExceptionType(val as number),
    },
    { label: '异常说明', field: 'reason', render: textRender },
    {
      label: '审批状态',