liu
7 天以前 5c124cdf26e4d749eae1e7fc9df366e9a5f4d259
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<script lang="ts" setup>
import type { HrmAttendanceExceptionApi } from '#/api/hrm/attendance/exception';
import type { DescriptionItemSchema } from '#/components/description';
 
import { h, onMounted, ref } from 'vue';
 
import { ContentWrap } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
import { formatDateTime } from '@vben/utils';
 
import { Spin } from 'ant-design-vue';
 
import { getAttendanceException } from '#/api/hrm/attendance/exception';
import { DictTag } from '#/components/dict-tag';
import { useDescription } from '#/components/description';
 
defineOptions({ name: 'HrmAttendanceExceptionApproveDetail' });
 
const props = defineProps<{ id: string }>();
 
const loading = ref(false);
const formData = ref<HrmAttendanceExceptionApi.AttendanceException>();
 
/** 文本字段空值占位 */
function textRender(val: unknown) {
  return val === 0 || val ? String(val) : '-';
}
 
const [Descriptions] = useDescription({
  bordered: true,
  column: 2,
  schema: [
    { label: '员工姓名', field: 'userName', render: textRender },
    { label: '所属部门', field: 'deptName', render: textRender },
    {
      label: '异常日期',
      field: 'date',
      render: (val) => formatDateTime(val) as string,
    },
    { label: '异常类型', field: 'exceptionTypeName', render: textRender },
    { label: '异常说明', field: 'reason', render: textRender },
    {
      label: '审批状态',
      field: 'status',
      render: (val) =>
        h(DictTag, { type: DICT_TYPE.HRM_AUDIT_STATUS, value: val }),
    },
    { label: '备注', field: 'remark', render: textRender },
    {
      label: '创建时间',
      field: 'createTime',
      render: (val) => formatDateTime(val) as string,
    },
  ] as DescriptionItemSchema[],
});
 
onMounted(async () => {
  try {
    loading.value = true;
    formData.value = await getAttendanceException(Number(props.id));
  } finally {
    loading.value = false;
  }
});
</script>
 
<template>
  <ContentWrap class="m-2">
    <Spin :spinning="loading" tip="加载中...">
      <div class="space-y-4">
        <!-- 考勤异常基本信息 -->
        <div class="rounded-lg border border-border bg-background p-4">
          <div class="mb-4 flex items-center gap-2">
            <span class="inline-block h-4 w-1 rounded bg-primary" />
            <span class="text-base font-semibold">考勤异常基本信息</span>
          </div>
          <Descriptions :data="formData" />
        </div>
      </div>
    </Spin>
  </ContentWrap>
</template>