SciAchievementOther.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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="所属平台" isColumn>
  13. <view class="platform-tags">
  14. <template v-if="platformList.length > 0">
  15. <uv-tags v-for="(p, index) in platformList" :key="index" :text="p.platformName === '其他' ? '其他' : (p.platformType ? p.platformName + ' (' + p.platformType + ')' : p.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. return Array.isArray(data) ? data : [];
  64. } catch (e) {
  65. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  66. return [{ platformName: form.value.belongPlatform }];
  67. }
  68. }
  69. return [];
  70. });
  71. const fetchData = async () => {
  72. if (!props.code) return;
  73. loading.value = true;
  74. const [err, res] = await to(documentApi.getOtherAchievementById(props.code));
  75. if (!err && res?.data) {
  76. form.value = res.data;
  77. }
  78. loading.value = false;
  79. };
  80. onMounted(() => {
  81. fetchData();
  82. });
  83. watch(() => props.code, () => {
  84. fetchData();
  85. });
  86. </script>
  87. <style lang="scss" scoped>
  88. @import "./common.scss";
  89. </style>