| | |
| | | /** 表单类型 */ |
| | | 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 [ |
| | |
| | | }, |
| | | }, |
| | | { |
| | | 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', |
| | | }, |
| | |
| | | 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', |