SciAchievementOther.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. <CommonSection title="基本信息" :isFirst="true">
  6. <CommonInfoRow label="成果名称" :value="form.achievementName" />
  7. <CommonInfoRow label="申请人" :value="form.applicant" />
  8. <CommonInfoRow label="所属单位" :value="form.organization" />
  9. <CommonInfoRow label="成果类型" :value="getDictLabel('sci_achievement_other_type', form.achievementType)" />
  10. <CommonInfoRow label="获得日期" :value="form.acquireTime ? formatDate(form.acquireTime, 'YYYY-MM-DD') : '-'" />
  11. <CommonInfoRow label="成果归属单位" :value="getDictLabel('achievement_owner_unit', form.achievementOwnerUnit) || form.achievementOwnerUnit || '-'" />
  12. <CommonInfoRow label="所属平台">
  13. <view class="platform-tags">
  14. <template v-if="platformList.length > 0">
  15. <uv-tags v-for="(item, index) in platformList" :key="index" :text="item.platformName === '其他' ? '其他' : (item.platformType ? item.platformName + ' (' + item.platformType + ')' : item.platformName)" type="primary" plain size="mini" class="mr5"></uv-tags>
  16. </template>
  17. <text v-else>-</text>
  18. </view>
  19. </CommonInfoRow>
  20. <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
  21. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  22. </CommonSection>
  23. <!-- 附件 -->
  24. <AttachmentList :file="attachment" title="佐证附件" />
  25. <!-- 审批记录 -->
  26. <CommonSection title="审批记录" v-if="form.id">
  27. <FlowTable :id="form.id" :businessCode="String(form.id)" defCode="sci_achievement_other" />
  28. </CommonSection>
  29. </template>
  30. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  31. </view>
  32. </template>
  33. <script setup lang="ts">
  34. import { ref, onMounted, watch, computed } from 'vue';
  35. import { useDict } from '@/hooks/useDict';
  36. import { useDocumentApi } from '@/api/document';
  37. import { formatDate } from '@/utils/date';
  38. import to from 'await-to-js';
  39. import AttachmentList from './AttachmentList.vue';
  40. import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
  41. import CommonSection from '@/components/ui/CommonSection.vue';
  42. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  43. const props = defineProps<{
  44. code: string;
  45. }>();
  46. const { getDictLabel } = useDict('sci_achievement_other_type', 'achievement_owner_unit');
  47. const documentApi = useDocumentApi();
  48. const form = ref<any>(null);
  49. const loading = ref(false);
  50. const attachment = computed(() => {
  51. if (form.value?.fileUrl) {
  52. return {
  53. fileName: form.value.fileName || '佐证附件',
  54. fileUrl: form.value.fileUrl
  55. };
  56. }
  57. return null;
  58. });
  59. const platformList = computed(() => {
  60. if (form.value?.belongPlatform) {
  61. try {
  62. const data = JSON.parse(form.value.belongPlatform);
  63. if (Array.isArray(data) && data.length > 0) {
  64. return data;
  65. }
  66. } catch (e) {
  67. return [];
  68. }
  69. }
  70. return [];
  71. });
  72. const fetchData = async () => {
  73. if (!props.code) return;
  74. loading.value = true;
  75. const [err, res] = await to(documentApi.getOtherAchievementById(props.code));
  76. if (!err && res?.data) {
  77. form.value = res.data;
  78. }
  79. loading.value = false;
  80. };
  81. onMounted(() => {
  82. fetchData();
  83. });
  84. watch(() => props.code, () => {
  85. fetchData();
  86. });
  87. </script>
  88. <style lang="scss" scoped>
  89. @import "./common.scss";
  90. </style>