SciAchievementOther.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. <view class="common-section-card">
  6. <view class="section-title">基本信息</view>
  7. <view class="info-row"><text class="label">成果名称</text><text class="value">{{ form.achievementName || '-' }}</text></view>
  8. <view class="info-row"><text class="label">申请人</text><text class="value">{{ form.applicant || '-' }}</text></view>
  9. <view class="info-row"><text class="label">所属单位</text><text class="value">{{ form.organization || '-' }}</text></view>
  10. <view class="info-row">
  11. <text class="label">成果类型</text>
  12. <text class="value">{{ getDictLabel('sci_achievement_other_type', form.achievementType) }}</text>
  13. </view>
  14. <view class="info-row"><text class="label">获得日期</text><text class="value">{{ form.acquireTime ? formatDate(form.acquireTime, 'YYYY-MM-DD') : '-' }}</text></view>
  15. <view class="info-row">
  16. <text class="label">成果归属单位</text>
  17. <text class="value">{{ getDictLabel('achievement_owner_unit', form.achievementOwnerUnit) || form.achievementOwnerUnit || '-' }}</text>
  18. </view>
  19. <view class="info-row column">
  20. <text class="label">备注</text>
  21. <text class="value remark">{{ form.remark || '-' }}</text>
  22. </view>
  23. </view>
  24. <!-- 附件 -->
  25. <AttachmentList :file="attachment" title="佐证附件" />
  26. </template>
  27. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  28. </view>
  29. </template>
  30. <script setup lang="ts">
  31. import { ref, onMounted, watch, computed } from 'vue';
  32. import { useDict } from '@/hooks/useDict';
  33. import { useDocumentApi } from '@/api/document';
  34. import { formatDate } from '@/utils/date';
  35. import to from 'await-to-js';
  36. import AttachmentList from './AttachmentList.vue';
  37. const props = defineProps<{
  38. code: string;
  39. }>();
  40. const { getDictLabel } = useDict('sci_achievement_other_type', 'achievement_owner_unit');
  41. const documentApi = useDocumentApi();
  42. const form = ref<any>(null);
  43. const loading = ref(false);
  44. const attachment = computed(() => {
  45. if (form.value?.fileUrl) {
  46. return [{
  47. name: form.value.fileName || '佐证附件',
  48. url: form.value.fileUrl
  49. }];
  50. }
  51. return null;
  52. });
  53. const fetchData = async () => {
  54. if (!props.code) return;
  55. loading.value = true;
  56. const [err, res] = await to(documentApi.getOtherAchievementById(props.code));
  57. if (!err && res?.data) {
  58. form.value = res.data;
  59. }
  60. loading.value = false;
  61. };
  62. onMounted(() => {
  63. fetchData();
  64. });
  65. watch(() => props.code, () => {
  66. fetchData();
  67. });
  68. </script>
  69. <style lang="scss" scoped>
  70. @import "./common.scss";
  71. </style>