PageDrillPlanView.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="safety-platform-container">
  3. <header class="safety-platform-container__header">
  4. <div>
  5. <BreadcrumbBack />
  6. <span class="breadcrumb-title" style="margin-left: 8px">{{ '演练记录' }}</span>
  7. </div>
  8. <el-tabs v-model="activeName">
  9. <el-tab-pane
  10. v-for="item in EMERGENCY_DRILL_DETAIL_SUBPAGE"
  11. :key="item.value"
  12. :label="item.label"
  13. :name="item.value"
  14. />
  15. </el-tabs>
  16. </header>
  17. <main class="safety-platform-container__main">
  18. <component :is="dynamicComponent" :id="id" ref="dynamicComponentRef" />
  19. </main>
  20. <footer class="safety-platform-container__footer" v-if="activeName === EMERGENCY_DRILL_DETAIL_SUBPAGE[1].value">
  21. <!-- 按钮 -->
  22. <el-button type="primary" @click="downloadPDF">导出</el-button>
  23. </footer>
  24. <UploadLoading :form-loading="formLoading" v-if="formLoading" />
  25. </div>
  26. </template>
  27. <script setup lang="ts">
  28. import { ref, computed, defineAsyncComponent } from 'vue';
  29. import { useRoute, useRouter } from 'vue-router';
  30. import UploadLoading from '@/components/UploadLoading.vue';
  31. import { EMERGENCY_DRILL_DETAIL_SUBPAGE } from './constants';
  32. import { exportEmergencyDrillRecord } from '@/api/emergency-drill/emergency-drill';
  33. const formLoading = ref(false);
  34. const activeName = ref(EMERGENCY_DRILL_DETAIL_SUBPAGE[0].value);
  35. const router = useRouter();
  36. const route = useRoute();
  37. const id = route.query.id;
  38. const dynamicComponent = computed(() => {
  39. switch (activeName.value) {
  40. case 'activities':
  41. return defineAsyncComponent(() => import('./components/DrillPlanViewActivities.vue'));
  42. case 'records':
  43. return defineAsyncComponent(() => import('./components/DrillPlanViewRecords.vue'));
  44. }
  45. });
  46. const downloadPDF = async () => {
  47. try {
  48. await exportEmergencyDrillRecord(id);
  49. } catch (e) {
  50. console.log(e);
  51. }
  52. };
  53. </script>
  54. <style scoped lang="scss">
  55. @use '@/styles/page-details-layout.scss' as *;
  56. .safety-platform-container__header {
  57. padding-bottom: 0 !important;
  58. }
  59. :deep(.el-tabs__header) {
  60. margin: 0;
  61. }
  62. :deep(.el-tabs__item) {
  63. font-size: 14px !important;
  64. }
  65. </style>