detail.vue 964 B

12345678910111213141516171819202122232425262728293031
  1. <template>
  2. <Dialog title="详情" v-model="modelVisible" :scroll="true" :max-height="500">
  3. <Descriptions :schema="allSchemas.detailSchema" :data="detailData">
  4. <!-- 展示 HTML 内容 -->
  5. <template #templateContent="{ row }">
  6. <div v-html="row.templateContent"></div>
  7. </template>
  8. </Descriptions>
  9. </Dialog>
  10. </template>
  11. <script setup lang="ts">
  12. import * as MailLogApi from '@/api/system/mail/log'
  13. import { allSchemas } from './log.data'
  14. const modelVisible = ref(false) // 弹窗的是否展示
  15. const detailLoading = ref(false) // 表单的加载中
  16. const detailData = ref() // 详情数据
  17. /** 打开弹窗 */
  18. const openModal = async (id: number) => {
  19. modelVisible.value = true
  20. // 设置数据
  21. detailLoading.value = true
  22. try {
  23. detailData.value = await MailLogApi.getMailLog(id)
  24. } finally {
  25. detailLoading.value = false
  26. }
  27. }
  28. defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
  29. </script>