gaoluyang
2 天以前 b64a0deae5b5d33f9e20671a68936b27f0b9b00b
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
<script lang="ts" setup>
import type { BpmOALeaveApi } from '#/api/bpm/oa/leave';
 
import { computed, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
 
import { ContentWrap } from '@vben/common-ui';
 
import { Spin } from 'ant-design-vue';
 
import { getLeave } from '#/api/bpm/oa/leave';
import { useDescription } from '#/components/description';
 
import { useDetailFormSchema } from './data';
 
const props = defineProps<{
  id: string;
}>();
 
const { query } = useRoute();
 
const loading = ref(false);
const formData = ref<BpmOALeaveApi.Leave>();
const queryId = computed(() => query.id as string);
 
const [Descriptions] = useDescription({
  bordered: true,
  column: 1,
  class: 'mx-4',
  schema: useDetailFormSchema(),
});
 
/** 获取详情数据 */
async function getDetailData() {
  try {
    loading.value = true;
    formData.value = await getLeave(Number(props.id || queryId.value));
  } finally {
    loading.value = false;
  }
}
 
/** 初始化 */
onMounted(() => {
  getDetailData();
});
</script>
 
<template>
  <ContentWrap class="m-2">
    <Spin :spinning="loading" tip="加载中...">
      <Descriptions :data="formData" />
    </Spin>
  </ContentWrap>
</template>