detail.vue 1003 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <ContentWrap>
  3. <!-- 详情 -->
  4. <Descriptions :schema="allSchemas.detailSchema" :data="formData" />
  5. <el-button @click="routerReturn" type="primary">返回</el-button>
  6. </ContentWrap>
  7. </template>
  8. <script setup lang="ts">
  9. // 业务相关的 import
  10. import * as LeaveApi from '@/api/bpm/leave'
  11. import { allSchemas } from '@/views/bpm/oa/leave/leave.data'
  12. import { useRouter } from 'vue-router'
  13. const router = useRouter()
  14. const { query } = useRoute() // 查询参数
  15. const message = useMessage() // 消息弹窗
  16. const id = ref() // 请假编号
  17. // 表单参数
  18. const formData = ref({
  19. startTime: undefined,
  20. endTime: undefined,
  21. type: undefined,
  22. reason: undefined
  23. })
  24. const routerReturn = () => {
  25. router.back()
  26. }
  27. onMounted(() => {
  28. id.value = query.id
  29. if (!id.value) {
  30. message.error('未传递 id 参数,无法查看 OA 请假信息')
  31. return
  32. }
  33. // 获得请假信息
  34. LeaveApi.getLeave(id.value).then((data) => {
  35. formData.value = data
  36. })
  37. })
  38. </script>