DisciplineFinal.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon v-if="loading" mode="circle" text="正在加载学科终验详情..."></uv-loading-icon>
  4. <template v-else-if="form">
  5. <!-- 学科信息 -->
  6. <view class="common-section-card">
  7. <view class="section-title">学科信息</view>
  8. <view class="info-row">
  9. <text class="label">学科名称</text>
  10. <text class="value">{{ form.disciplineTitle || '-' }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="label">学科编号</text>
  14. <text class="value">{{ form.disciplineCode || '-' }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="label">项目来源</text>
  18. <text class="value">{{ form.projectSource || '-' }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">申报级别</text>
  22. <text class="value">{{ getDictLabel('sci_pjt_level', form.declarationLevel) }}</text>
  23. </view>
  24. <view class="info-row">
  25. <text class="label">申报类别</text>
  26. <text class="value">{{ getDictLabel('sci_pjt_type', form.declarationType) }}</text>
  27. </view>
  28. <view class="info-row">
  29. <text class="label">开始日期</text>
  30. <text class="value">{{ formatDate(form.startDate, 'YYYY-MM-DD') }}</text>
  31. </view>
  32. <view class="info-row">
  33. <text class="label">完成日期</text>
  34. <text class="value">{{ formatDate(form.endDate, 'YYYY-MM-DD') }}</text>
  35. </view>
  36. <view class="info-row">
  37. <text class="label">研究方向</text>
  38. <text class="value">{{ form.researchDirection || '-' }}</text>
  39. </view>
  40. </view>
  41. <!-- 详细信息 -->
  42. <view class="common-section-card mt20">
  43. <view class="section-title">详细信息</view>
  44. <view class="info-row">
  45. <text class="label">关联学科</text>
  46. <text class="value">{{ form.disciplineTitle || '-' }}</text>
  47. </view>
  48. <view class="info-row">
  49. <text class="label">终验时间</text>
  50. <text class="value">{{ formatDate(form.finalDate, 'YYYY-MM-DD HH:mm') }}</text>
  51. </view>
  52. <view class="info-row">
  53. <text class="label">备注</text>
  54. <text class="value">{{ form.remark || '-' }}</text>
  55. </view>
  56. </view>
  57. <!-- 附件 -->
  58. <view class="common-section-card mt20" v-if="form.finalReport">
  59. <view class="section-title">附件资料</view>
  60. <view class="common-file-list">
  61. <view class="file-item" @click="previewFile(form.finalReport, '终验报告')">
  62. <view class="file-info">
  63. <uv-icon name="file-text" size="40" color="#1c9bfd"></uv-icon>
  64. <view class="f-content">
  65. <text class="f-name">终验报告</text>
  66. <text class="f-meta">点击预览附件</text>
  67. </view>
  68. </view>
  69. <uv-icon name="arrow-right" size="32" color="#ccc"></uv-icon>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  75. </view>
  76. </template>
  77. <script setup lang="ts">
  78. import { ref, onMounted, watch } from 'vue';
  79. import { useDict } from '@/hooks/useDict';
  80. import { useDocumentApi } from '@/api/document';
  81. import { previewFile } from '@/utils/file';
  82. import { formatDate } from '@/utils/date';
  83. import to from 'await-to-js';
  84. const props = defineProps<{
  85. code: string;
  86. }>();
  87. const { getDictLabel } = useDict('sci_pjt_level', 'sci_pjt_type');
  88. const documentApi = useDocumentApi();
  89. const form = ref<any>(null);
  90. const loading = ref(false);
  91. const fetchData = async () => {
  92. if (!props.code) return;
  93. loading.value = true;
  94. const [err, res] = await to(documentApi.getDisciplineFinalByCode(props.code));
  95. if (!err && res?.data) {
  96. form.value = res.data;
  97. }
  98. loading.value = false;
  99. };
  100. onMounted(() => {
  101. fetchData();
  102. });
  103. watch(() => props.code, () => {
  104. fetchData();
  105. });
  106. </script>
  107. <style lang="scss" scoped>
  108. @import "./common.scss";
  109. </style>